================
@@ -184,6 +185,53 @@ 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;
+
+  // Extract the scalar values from the vector operands
+  auto vecTy0 = mlir::dyn_cast<cir::VectorType>(op0.getType());
+  auto vecTy1 = mlir::dyn_cast<cir::VectorType>(op1.getType());
+
+  mlir::Value scalar0 = op0;
+  mlir::Value scalar1 = op1;
+
+  if (vecTy0)
----------------
andykaylor wrote:

Classic codegen extracts these elements before calling this function. Handling 
vector types in a function named `emitX86ScalarSelect` seems wrong.

https://github.com/llvm/llvm-project/pull/174003
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to