lhs, rhs, [](AffineExpr d0, AffineExpr d1) { return d0.ceilDiv(d1); });
}
+Value mlir::edsc::op::negate(Value value) {
+ assert(value.getType().isInteger(1) && "expected boolean expression");
+ return ValueBuilder<ConstantIntOp>(1, 1) - value;
+}
+
Value mlir::edsc::op::operator&&(Value lhs, Value rhs) {
assert(lhs.getType().isInteger(1) && "expected boolean expression on LHS");
assert(rhs.getType().isInteger(1) && "expected boolean expression on RHS");
}
LoopBuilder mlir::edsc::makeParallelLoopBuilder(MutableArrayRef<Value> ivs,
- ArrayRef<Value> lbHandles,
- ArrayRef<Value> ubHandles,
+ ArrayRef<Value> lbs,
+ ArrayRef<Value> ubs,
ArrayRef<Value> steps) {
LoopBuilder result;
- auto opHandle = OperationHandle::create<loop::ParallelOp>(
- SmallVector<Value, 4>(lbHandles.begin(), lbHandles.end()),
- SmallVector<Value, 4>(ubHandles.begin(), ubHandles.end()),
- SmallVector<Value, 4>(steps.begin(), steps.end()));
+ auto opHandle = OperationHandle::create<loop::ParallelOp>(lbs, ubs, steps);
loop::ParallelOp parallelOp =
cast<loop::ParallelOp>(*opHandle.getOperation());
return result;
}
-mlir::edsc::LoopBuilder mlir::edsc::makeLoopBuilder(
- Value *iv, Value lbHandle, Value ubHandle, Value stepHandle,
- MutableArrayRef<Value> iterArgsHandles, ValueRange iterArgsInitValues) {
+mlir::edsc::LoopBuilder
+mlir::edsc::makeLoopBuilder(Value *iv, Value lb, Value ub, Value step,
+ MutableArrayRef<Value> iterArgsHandles,
+ ValueRange iterArgsInitValues) {
mlir::edsc::LoopBuilder result;
- auto forOp = OperationHandle::createOp<loop::ForOp>(
- lbHandle, ubHandle, stepHandle, iterArgsInitValues);
+ auto forOp =
+ OperationHandle::createOp<loop::ForOp>(lb, ub, step, iterArgsInitValues);
*iv = forOp.getInductionVar();
auto *body = loop::getForInductionVarOwner(*iv).getBody();
for (size_t i = 0, e = iterArgsHandles.size(); i < e; ++i) {
ScopedContext scope(builder, f.getLoc());
using op::operator&&;
+ using op::negate;
Value lhs(f.getArgument(0));
Value rhs(f.getArgument(1));
- lhs &&rhs;
+ negate(lhs && rhs);
// CHECK-LABEL: @operator_and
// CHECK: [[ARG0:%.*]]: i1, [[ARG1:%.*]]: i1
- // CHECK: and [[ARG0]], [[ARG1]]
+ // CHECK: [[AND:%.*]] = and [[ARG0]], [[ARG1]]
+ // CHECK: [[TRUE:%.*]] = constant 1 : i1
+ // CHECK: subi [[TRUE]], [[AND]] : i1
f.print(llvm::outs());
f.erase();
}