[llvm] [LangRef][IR] Add 3-way compare intrinsics llvm.scmp/llvm.ucmp (PR #83227)
Dhruv Chawla via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 15 09:39:17 PDT 2024
Miguel Raz =?utf-8?q?Guzmán?= Macedo,
Miguel Raz =?utf-8?q?Guzmán?= Macedo,
Miguel Raz =?utf-8?q?Guzmán?= Macedo,
Miguel Raz =?utf-8?q?Guzmán?= Macedo,miguelraz
<miguelraz at ciencias.unam.mx>,miguelraz <miguelraz at ciencias.unam.mx>,miguelraz
<miguelraz at ciencias.unam.mx>,miguelraz <miguelraz at ciencias.unam.mx>,miguelraz
<miguelraz at ciencias.unam.mx>,miguelraz <miguelraz at ciencias.unam.mx>,
Miguel Raz =?utf-8?q?Guzmán?= Macedo,
Miguel Raz =?utf-8?q?Guzmán?= Macedo,
Miguel Raz =?utf-8?q?Guzmán?= Macedo,
Miguel Raz =?utf-8?q?Guzmán?= Macedo,
Miguel Raz =?utf-8?q?Guzmán?= Macedo,miguelraz
<miguelraz at ciencias.unam.mx>,Miguel Raz =?utf-8?q?Guzmán?= Macedo,miguelraz
<miguelraz at ciencias.unam.mx>,miguelraz <miguelraz at ciencias.unam.mx>,miguelraz
<miguelraz at ciencias.unam.mx>,miguelraz <miguelraz at ciencias.unam.mx>,miguelraz
<miguelraz at ciencias.unam.mx>,miguelraz <miguelraz at ciencias.unam.mx>,miguelraz
<miguelraz at ciencias.unam.mx>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/83227 at github.com>
================
@@ -5235,6 +5235,28 @@ 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(DestTy->getScalarSizeInBits() >= 2,
+ "result type must be at least 2 bits wide", Call);
+
+ bool IsDestTypeVector = DestTy->isVectorTy();
+ Check(SrcTy->isVectorTy() == IsDestTypeVector,
+ "[us]cmp source and destination must both be a vector or neither",
+ Call);
+ if (IsDestTypeVector) {
+ auto SrcVecLen = cast<VectorType>(SrcTy)->getElementCount();
+ auto DestVecLen = cast<VectorType>(DestTy)->getElementCount();
+ Check(SrcVecLen == DestVecLen,
+ "return type and first arg type must have the same number of "
+ "elements",
----------------
dc03-work wrote:
Small nit: have it be `arguments` (`argument types`?) instead of `first arg type`.
https://github.com/llvm/llvm-project/pull/83227
More information about the llvm-commits
mailing list