[clang] Implement select/selectsh builtins in CIR (PR #172299)
Priyanshu Kumar via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 15 20:10:38 PST 2025
================
@@ -417,8 +417,26 @@ static mlir::Value emitX86vpcom(CIRGenBuilderTy &builder, mlir::Location loc,
return builder.createVecCompare(loc, pred, op0, op1);
}
-std::optional<mlir::Value>
-CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID, const CallExpr *expr) {
+static mlir::Value emitX86VectorSelect(CIRGenBuilderTy &builder,
+ mlir::Location loc, mlir::Value mask,
+ mlir::Value Op0, mlir::Value Op1) {
+ return cir::VecTernaryOp::create(builder, loc, Op0.getType(), mask, Op0, Op1);
+}
+
+static mlir::Value emitX86ScalarSelect(CIRGenBuilderTy &builder,
+ mlir::Location loc, mlir::Value mask,
+ mlir::Value Op0, mlir::Value Op1) {
+
+ auto zeroAttr = builder.getZeroAttr(mask.getType());
+ mlir::Value zero =
+ cir::ConstantOp::create(builder, loc, mask.getType(), zeroAttr);
+ mlir::Value cond = builder.createCompare(loc, cir::CmpOpKind::ne, mask, zero);
----------------
Priyanshu3820 wrote:
updated
https://github.com/llvm/llvm-project/pull/172299
More information about the cfe-commits
mailing list