================
@@ -184,6 +184,37 @@ static mlir::Value emitX86Select(CIRGenBuilderTy &builder,
mlir::Location loc,
return cir::VecTernaryOp::create(builder, loc, mask, op0, op1);
}
+static mlir::Value emitX86ScalarSelect(CIRGenBuilderTy &builder,
+ mlir::Location loc, mlir::Value mask,
+ mlir::Value op0, mlir::Value op1) {
+
+ // If the mask is all ones just return first argument.
+ if (auto c = mlir::dyn_cast_or_null<cir::ConstantOp>(mask.getDefiningOp()))
+ if (c.isAllOnesValue())
+ return op0;
+ // Cast to cir::IntType to safely get the width of a CIR integer
+ unsigned width = 0;
+ if (auto intTy = mlir::dyn_cast<cir::IntType>(mask.getType())) {
+ width = intTy.getWidth();
+ } else {
+ // Fallback or handle unexpected type
+ width = 8;
----------------
badumbatish wrote:
we can do an assertion in front to make sure mask is always int type
https://github.com/llvm/llvm-project/pull/174003
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits