[llvm] Add 3 way compare <=> integer intrinsics to Langref (PR #83227)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 08:28:40 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
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/83227 at github.com>
================
@@ -0,0 +1,22 @@
+; RUN: not opt -S -passes=verify 2>&1 < %s | FileCheck %s
+
+
+define @matching_vector_lens(<4 x i32> %arg1, <4 x i32> %arg2) {
+ ; CHECK-LABEL: cmp_vector_lens_match
+ ; CHECK: return type and first arg type must have the same number of elements
+ %res = call <8 x i32> @llvm.scmp.v8i32.v4i32(<4 x i32> %arg1, <4 x i32> %arg2)
+}
+
+define @result_len_is_at_least_2(i32 %arg1, i32 %arg2) {
+ ; CHECK-LABEL: cmp_result_len_is_at_least_2bits_wide
+ ; CHECK: result type must be at least 2 bits wide
+ %res2 = call i1 @llvm.scmp.i1.i32(i32 %arg1, i32 %arg2)
+}
+
+define @both_args_are_vecs_or_neither(<4 x i32> %arg1, i32 %arg2) {
+ ; CHECK-LABEL: cmp_sources_and_dest_types_ranks_match
+ ; CHECK: [us]cmp source and destination must both be a vector or neither
+ @res3 = call i2 @llvm.scmp.i2.v4i32(<4 x i32> %arg1, i32 %arg2)
+ ; CHECK: [us]cmp source and destination must both be a vector or neither
+ @res4 = call <4 x i32> @llvm.scmp.v4i32.i32(<4 x i32> %arg2, i32 %arg2)
+}
----------------
nikic wrote:
> @nikic : What about scalable vector types? Do you think it is viable within the scope of the project?
Yes, scalable vectors are generally assumed to be supported for intrinsics like this. I don't think they need any special handling.
> Also, I feel there should be tests that check correct code as well.
I think it's fine to omit these for now -- there's going to be (a lot of!) tests with correct code in the followup patches.
https://github.com/llvm/llvm-project/pull/83227
More information about the llvm-commits
mailing list