[llvm] Add 3 way compare <=> integer intrinsics to Langref (PR #83227)

Miguel Raz Guzmán Macedo via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 10:18:45 PDT 2024


================
@@ -5235,6 +5235,25 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
     }
     break;
   }
+  case Intrinsic::ucmp:
+  case Intrinsic::scmp: {
+
+    Type *SrcTy = Call.getOperand(0)->getType();
+    Type *DestTy = Call.getType();
+
+    Check(SrcTy->isIntOrIntVectorTy(), "[u]scmp only operates on integers", Call);
+    Check(DestTy->isIntOrIntVectorTy(), "[u]scmp only produces integers", Call);
+    Check(DestTy->getScalarSizeInBits() >= 2, "DestTy must be at least 2 bits wide", Call);
----------------
miguelraz wrote:

I've added a `llvm/test/Verifier/intrinsic-cmp.ll` test file where I'll add a test for the 
* ` Check(DestTy->getScalarSizeInBits() >= 2, ...)` and
* `Check(SrcTy->isVectorTy() == isDestTypeVector, ...)`

Both in that same file, does that seem like the right approach here?

It's my first time setting up the `RUN; ...` unit tests and I'm trying to make sure I'm not missing something obvious here.

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


More information about the llvm-commits mailing list