[clang] [CIR] Upstream comparison ops for VectorType (PR #140597)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Tue May 20 01:21:31 PDT 2025


================
@@ -1777,6 +1778,35 @@ mlir::LogicalResult CIRToLLVMVecInsertOpLowering::matchAndRewrite(
   return mlir::success();
 }
 
+mlir::LogicalResult CIRToLLVMVecCmpOpLowering::matchAndRewrite(
+    cir::VecCmpOp op, OpAdaptor adaptor,
+    mlir::ConversionPatternRewriter &rewriter) const {
+  assert(mlir::isa<cir::VectorType>(op.getType()) &&
+         mlir::isa<cir::VectorType>(op.getLhs().getType()) &&
+         mlir::isa<cir::VectorType>(op.getRhs().getType()) &&
+         "Vector compare with non-vector type");
+  // LLVM IR vector comparison returns a vector of i1. This one-bit vector
+  // must be sign-extended to the correct result type.
----------------
xlauko wrote:

Can you move this comment above creation of SExt , where it make more sense.

https://github.com/llvm/llvm-project/pull/140597


More information about the cfe-commits mailing list