[clang] [PATCH] [PATCH] [CIR][X86] Add support for cmp builtins (PR #174318)

Sirui Mu via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 4 03:40:12 PST 2026


================
@@ -1339,6 +1334,29 @@ mlir::LogicalResult CIRToLLVMCastOpLowering::matchAndRewrite(
     assert(!MissingFeatures::cxxABI());
     assert(!MissingFeatures::methodType());
     break;
+  case cir::CastKind::vector_to_int: {
+    mlir::Type srcType = castOp.getSrc().getType();
+    mlir::Type dstType = castOp.getType();
+    mlir::Value llvmSrcVal = adaptor.getSrc();
+    cir::IntType srcIntType =
+    mlir::cast<cir::IntType>(elementTypeIfVector(srcType));
+    cir::IntType dstIntType =
+        mlir::cast<cir::IntType>(elementTypeIfVector(dstType));
+    uint64_t numElements =
+        mlir::cast<cir::VectorType>(srcType).getSize();
+
+    auto width = numElements * srcIntType.getWidth();
+    auto convertIntTypeOp = rewriter.create<mlir::LLVM::BitcastOp>(castOp.getLoc(), rewriter.getIntegerType(width),
+                                                       llvmSrcVal);
+    // truncate to the destination integer type
+    auto dstWidth = dstIntType.getWidth();
----------------
Lancern wrote:

Do not use `auto` here.

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


More information about the cfe-commits mailing list