================
@@ -69,6 +69,23 @@ static mlir::Value emitUnaryNVVMIntrinsic(CIRGenFunction
&cgf,
.getResult();
}
+static mlir::Value emitBar0Reduction(CIRGenFunction &cgf, const CallExpr *expr,
+ llvm::StringRef intrinsicName,
+ bool returnsPred) {
+ CIRGenBuilderTy &builder = cgf.getBuilder();
+ mlir::Location loc = cgf.getLoc(expr->getExprLoc());
+ mlir::Value zero = builder.getConstInt(loc, builder.getSInt32Ty(), 0);
+ mlir::Value pred = builder.createCompare(
+ loc, cir::CmpOpKind::ne, cgf.emitScalarExpr(expr->getArg(0)), zero);
+ mlir::Type resultTy =
+ returnsPred ? mlir::Type(builder.getBoolTy()) : builder.getSInt32Ty();
+ mlir::Value result = builder.emitIntrinsicCallOp(
+ loc, intrinsicName, resultTy, mlir::ValueRange{zero, pred});
+ if (returnsPred)
+ result = builder.createBoolToInt(result, builder.getSInt32Ty());
----------------
andykaylor wrote:
```suggestion
result = builder.createBoolToInt(result, si32Ty);
```
https://github.com/llvm/llvm-project/pull/221255
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits