[Mlir-commits] [llvm] [mlir] [IR][Verifier] Add element count constraint for intrinsics (PR #231024)

Yingwei Zheng llvmlistbot at llvm.org
Tue Nov 3 10:57:08 PST 2026


================
@@ -1294,10 +1316,14 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrNoCreateUndefOrPoison]
 
   // If the value doesn't fit an unspecified value is returned, but this
   // is not poison so we can still mark these as IntrNoCreateUndefOrPoison.
-  def int_lround : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
-  def int_llround : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
-  def int_lrint : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
-  def int_llrint : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
+  def int_lround : DefaultAttrsIntrinsic<[llvm_anyint_ty],
+                                         [llvm_anyfloat_same_width_ty<0>]>;
+  def int_llround : DefaultAttrsIntrinsic<[llvm_anyint_ty],
+                                         [llvm_anyfloat_same_width_ty<0>]>;
+  def int_lrint : DefaultAttrsIntrinsic<[llvm_anyint_ty],
+                                        [llvm_anyfloat_same_width_ty<0>]>;
+  def int_llrint : DefaultAttrsIntrinsic<[llvm_anyint_ty],
+                                         [llvm_anyfloat_same_width_ty<0>]>;
 
   // TODO: int operand should be constrained to same number of elements as the
   // result.
----------------
dtcxzyw wrote:

I can cherry-pick the patch if the direction is confirmed correct.


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


More information about the Mlir-commits mailing list