[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:16 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",
----------------
dc03-work wrote:
Small nit: I feel like `ucmp/scmp` would be easier to read than `[us]cmp`.
Also, I don't think I would use the word destination here as there is no exact "destination" per se, so something like `[us]cmp argument and result types must both be either vector or scalar types` would be better.
https://github.com/llvm/llvm-project/pull/83227
More information about the llvm-commits
mailing list