[clang] [CIR] Upstream ThreeWayCmpOp (PR #169963)

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 2 17:45:45 PST 2025


Hendrik =?utf-8?q?Hübner?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/169963 at github.com>


================
@@ -1362,6 +1346,60 @@ mlir::LogicalResult CIRToLLVMPtrStrideOpLowering::matchAndRewrite(
   return mlir::success();
 }
 
+static std::string getThreeWayCmpIntrinsicName(bool signedCmp,
+                                               unsigned operandWidth,
+                                               unsigned resultWidth) {
+  // The intrinsic's name takes the form:
+  // `llvm.<scmp|ucmp>.i<resultWidth>.i<operandWidth>`
+
+  std::string result = "llvm.";
+
+  if (signedCmp)
+    result.append("scmp.");
+  else
+    result.append("ucmp.");
+
+  // Result type part.
+  result.push_back('i');
+  result.append(std::to_string(resultWidth));
+  result.push_back('.');
+
+  // Operand type part.
+  result.push_back('i');
+  result.append(std::to_string(operandWidth));
+
+  return result;
+}
+
+mlir::LogicalResult CIRToLLVMCmpThreeWayOpLowering::matchAndRewrite(
----------------
bcardosolopes wrote:

I also see this in the incubator, it's a left over we should eliminate

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


More information about the cfe-commits mailing list