-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[Clang][X86] Add tests for AVX512 integer comparison intrinsics to be used in constexpr #169452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
|
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-clang Author: irhs0 (shri-acha) ChangesCovers the test for AVX512 comparison intrinsics mentioned in: Full diff: https://github.com/llvm/llvm-project/pull/169452.diff 1 Files Affected:
diff --git a/clang/test/CodeGen/X86/avx512vlbw-builtins.c b/clang/test/CodeGen/X86/avx512vlbw-builtins.c
index 16e113031bfda..cb69205664a3d 100644
--- a/clang/test/CodeGen/X86/avx512vlbw-builtins.c
+++ b/clang/test/CodeGen/X86/avx512vlbw-builtins.c
@@ -645,20 +645,123 @@ __mmask16 test_mm_cmp_epi8_mask(__m128i __a, __m128i __b) {
return (__mmask16)_mm_cmp_epi8_mask(__a, __b, 0);
}
+// cmpeq tests
TEST_CONSTEXPR(_mm_cmpeq_epi8_mask(
- ((__m128i)(__v16qi){5, 3, 7, 2, 9, 3, 7, 1, 5, 4, 8, 2, 9, 6, 7, 5}),
- ((__m128i)(__v16qi){5, 2, 7, 3, 9, 4, 6, 1, 5, 3, 8, 1, 9, 5, 7, 5})
-) == (__mmask16)0xd595);
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}),
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
+) == (__mmask16)0xffff);
+
+TEST_CONSTEXPR(_mm_cmpeq_epi8_mask(
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}),
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})
+) == (__mmask16)0xffff);
+
+TEST_CONSTEXPR(_mm_cmpeq_epi8_mask(
+ ((__m128i)(__v16qi){127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127}),
+ ((__m128i)(__v16qi){-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128})
+) == (__mmask16)0x0000);
+
+TEST_CONSTEXPR(_mm_cmpeq_epi8_mask(
+ ((__m128i)(__v16qi){-31, 90, -66, 3, 27, -22, -64, 111, -87, 105, -19, 0, 26, -111, 24, -72}),
+ ((__m128i)(__v16qi){-84, -98, 20, -83, -98, 80, -46, -9, 22, -120, -123, 53, 117, -85, 50, 94})
+) == (__mmask16)0x0000);
+
+// cmpneq tests
+TEST_CONSTEXPR(_mm_cmpneq_epi8_mask(
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}),
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
+) == (__mmask16)0x0000);
+
+TEST_CONSTEXPR(_mm_cmpneq_epi8_mask(
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}),
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})
+) == (__mmask16)0x0000);
+
+TEST_CONSTEXPR(_mm_cmpneq_epi8_mask(
+ ((__m128i)(__v16qi){127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127}),
+ ((__m128i)(__v16qi){-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128})
+) == (__mmask16)0xffff);
+
+TEST_CONSTEXPR(_mm_cmpneq_epi8_mask(
+ ((__m128i)(__v16qi){-2, 49, -5, -11, 21, -70, 121, -111, 20, 112, -121, 18, -34, -73, 89, 122}),
+ ((__m128i)(__v16qi){14, 36, 2, 3, 118, 88, -126, -21, 104, -125, -1, 39, 99, -12, 35, -126})
+) == (__mmask16)0xffff);
+
+// cmplt tests
+TEST_CONSTEXPR(_mm_cmplt_epi8_mask(
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}),
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
+) == (__mmask16)0x0000);
TEST_CONSTEXPR(_mm_cmplt_epi8_mask(
- ((__m128i)(__v16qi){1, 5, 3, 7, 2, 8, 4, 6, 9, 5, 3, 11, 2, 6, 15, 8}),
- ((__m128i)(__v16qi){2, 4, 6, 8, 3, 5, 7, 9, 4, 6, 8, 10, 5, 7, 9, 11})
-) == (__mmask16)0xb6dd);
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}),
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})
+) == (__mmask16)0x0000);
+TEST_CONSTEXPR(_mm_cmplt_epi8_mask(
+ ((__m128i)(__v16qi){127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127}),
+ ((__m128i)(__v16qi){-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128})
+) == (__mmask16)0x0000);
+
+TEST_CONSTEXPR(_mm_cmplt_epi8_mask(
+ ((__m128i)(__v16qi){-111, -10, -60, -123, -6, -110, -43, -32, -58, -7, 42, -128, -21, 24, 8, -101}),
+ ((__m128i)(__v16qi){-108, 30, 71, 73, 20, 117, 63, -93, 79, -30, 99, -100, 34, 49, 83, 68})
+) == (__mmask16)0xfd7f);
+
+// cmple tests
+TEST_CONSTEXPR(_mm_cmple_epi8_mask(
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}),
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
+) == (__mmask16)0xffff);
TEST_CONSTEXPR(_mm_cmple_epi8_mask(
- ((__m128i)(__v16qi){1, 3, 5, 7, 2, 6, 6, 8, 1, 3, 9, 7, 2, 4, 6, 10}),
- ((__m128i)(__v16qi){2, 3, 4, 7, 3, 4, 5, 8, 2, 3, 4, 7, 3, 4, 5, 8})
-) == (__mmask16)0x3b9b);
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}),
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})
+) == (__mmask16)0xffff);
+TEST_CONSTEXPR(_mm_cmple_epi8_mask(
+ ((__m128i)(__v16qi){127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127}),
+ ((__m128i)(__v16qi){-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128})
+) == (__mmask16)0x0000);
+TEST_CONSTEXPR(_mm_cmple_epi8_mask(
+ ((__m128i)(__v16qi){122, 6, -22, -94, 78, -35, -43, -16, -69, 124, -2, 24, -117, 8, -17, 118}),
+ ((__m128i)(__v16qi){53, -50, 104, 11, 63, -77, -25, 102, 46, 62, 27, -28, -61, 68, 40, -65})
+) == (__mmask16)0x75cc);
+
+// cmpge tests
+TEST_CONSTEXPR(_mm_cmpge_epi8_mask(
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}),
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
+) == (__mmask16)0xffff);
+TEST_CONSTEXPR(_mm_cmpge_epi8_mask(
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}),
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})
+) == (__mmask16)0xffff);
+TEST_CONSTEXPR(_mm_cmpge_epi8_mask(
+ ((__m128i)(__v16qi){127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127}),
+ ((__m128i)(__v16qi){-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128})
+) == (__mmask16)0xffff);
+TEST_CONSTEXPR(_mm_cmpge_epi8_mask(
+ ((__m128i)(__v16qi){-11, 0, 97, 123, -48, 105, 26, -118, 62, -86, -94, -32, 14, -4, -50, 72}),
+ ((__m128i)(__v16qi){-33, 49, 22, 31, -4, -81, 6, -22, 40, 127, -1, -106, 6, -64, 12, 8})
+) == (__mmask16)0xb96d);
+
+// cmpgt tests
+TEST_CONSTEXPR(_mm_cmpgt_epi8_mask(
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}),
+ ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
+) == (__mmask16)0x0000);
+TEST_CONSTEXPR(_mm_cmpgt_epi8_mask(
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}),
+ ((__m128i)(__v16qi){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})
+) == (__mmask16)0x0000);
+TEST_CONSTEXPR(_mm_cmpgt_epi8_mask(
+ ((__m128i)(__v16qi){127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127}),
+ ((__m128i)(__v16qi){-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128})
+) == (__mmask16)0xffff);
+TEST_CONSTEXPR(_mm_cmpgt_epi8_mask(
+ ((__m128i)(__v16qi){-127, 37, -123, -60, 98, -68, -115, 96, 80, -27, -105, 64, -6, -51, -45, -81}),
+ ((__m128i)(__v16qi){-124, 59, 8, 59, 122, 47, -74, 120, 19, -43, -33, -76, 7, -22, -24, -14})
+) == (__mmask16)0x0b00);
+
__mmask16 test_mm_mask_cmp_epi8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
// CHECK-LABEL: test_mm_mask_cmp_epi8_mask
|
|
@RKSimon could you verify the nature of the tests?, after i'll add the other generated tests from the script |
|
|
| ) == (__mmask16)0xd595); | ||
| ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}), | ||
| ((__m128i)(__v16qi){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}) | ||
| ) == (__mmask16)0xffff); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid 'splat' tests like this - all ones/zero results always make me suspicious :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:) okay ,will modify the 'splat' cases here onwards.
| ((__m128i)(__v16qi){-31, 90, -66, 3, 27, -22, -64, 111, -87, 105, -19, 0, 26, -111, 24, -72}), | ||
| ((__m128i)(__v16qi){-84, -98, 20, -83, -98, 80, -46, -9, 22, -120, -123, 53, 117, -85, 50, 94}) | ||
| ) == (__mmask16)0x0000); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need _mm_mask_cmpeq_epi8_mask (et al) test coverage as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I do have those in mind aswell, i will cover those after all of the _mm_mask_cmp*_epi* are complete.
🐧 Linux x64 Test Results
Failed Tests(click on a test name to see its output) ClangClang.CodeGen/X86/avx512vlbw-builtins.cIf these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the |
Covers the test for AVX512 comparison intrinsics mentioned in:
#162054