https://github.com/RKSimon updated https://github.com/llvm/llvm-project/pull/169452
>From dccf63b4def97b6836384343a724813ce0459cfd Mon Sep 17 00:00:00 2001 From: shri-acha <[email protected]> Date: Tue, 25 Nov 2025 10:15:24 +0545 Subject: [PATCH 1/5] add: tests for _mm_cmp*_epi8 --- clang/test/CodeGen/X86/avx512vlbw-builtins.c | 121 +++++++++++++++++-- 1 file changed, 112 insertions(+), 9 deletions(-) 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 >From 120d264fcb915cc47e5c2b88db17b662658f177a Mon Sep 17 00:00:00 2001 From: shri-acha <[email protected]> Date: Tue, 25 Nov 2025 21:22:53 +0545 Subject: [PATCH 2/5] add tests for _mm_cmp*_epi16 --- clang/test/CodeGen/X86/avx512vlbw-builtins.c | 135 +++++++++++++++++++ 1 file changed, 135 insertions(+) diff --git a/clang/test/CodeGen/X86/avx512vlbw-builtins.c b/clang/test/CodeGen/X86/avx512vlbw-builtins.c index cb69205664a3d..3111c04ddd3e0 100644 --- a/clang/test/CodeGen/X86/avx512vlbw-builtins.c +++ b/clang/test/CodeGen/X86/avx512vlbw-builtins.c @@ -762,6 +762,141 @@ TEST_CONSTEXPR(_mm_cmpgt_epi8_mask( ((__m128i)(__v16qi){-124, 59, 8, 59, 122, 47, -74, 120, 19, -43, -33, -76, 7, -22, -24, -14}) ) == (__mmask16)0x0b00); +// _mm_cmp*_epi16_mask tests +// cmpeq tests +TEST_CONSTEXPR(_mm_cmpeq_epi16_mask( + ((__m128i)(__v8hi){-3442, 30871, -12144, -1454, -22826, -2857, -15573, 31071}), + ((__m128i)(__v8hi){18051, 1305, 19877, 25257, -1276, -27260, -2189, -12561}) +) == (__mmask8)0x00); +TEST_CONSTEXPR(_mm_cmpeq_epi16_mask( + ((__m128i)(__v8hi){-30000, -12116, -26732, -25017, 1825, 22572, -23178, -19747}), + ((__m128i)(__v8hi){2100, 15453, 17949, -29756, 17479, -18870, -22571, -17226}) +) == (__mmask8)0x00); +TEST_CONSTEXPR(_mm_cmpeq_epi16_mask( + ((__m128i)(__v8hi){31014, -1995, -10083, -9515, 10226, -21525, 253, 30999}), + ((__m128i)(__v8hi){-25332, -30218, 31439, 15484, -31344, 17581, -30883, -1427}) +) == (__mmask8)0x00); +TEST_CONSTEXPR(_mm_cmpeq_epi16_mask( + ((__m128i)(__v8hi){-9653, -20924, -20387, 285, -14945, 19791, 21735, -31655}), + ((__m128i)(__v8hi){-19129, -16192, 6453, -3246, -22032, 9464, -15122, -12084}) +) == (__mmask8)0x00); +TEST_CONSTEXPR(_mm_cmpeq_epi16_mask( + ((__m128i)(__v8hi){-24008, 21674, 8299, -31133, 23486, -29407, -15611, -7613}), + ((__m128i)(__v8hi){10079, -14333, 2802, 21711, -10849, 11468, -528, -18259}) +) == (__mmask8)0x00); + +// cmpneq tests +TEST_CONSTEXPR(_mm_cmpneq_epi16_mask( + ((__m128i)(__v8hi){29745, -23358, -12495, -13908, 3162, -15181, -20831, -9264}), + ((__m128i)(__v8hi){-32594, -25364, -11888, -32704, 25399, -14592, -8293, -19662}) +) == (__mmask8)0xff); +TEST_CONSTEXPR(_mm_cmpneq_epi16_mask( + ((__m128i)(__v8hi){21379, -15275, -31427, -29628, 14433, 30414, -24752, 119}), + ((__m128i)(__v8hi){-23650, -17663, 2882, -8677, -13639, -6226, -17564, -17024}) +) == (__mmask8)0xff); +TEST_CONSTEXPR(_mm_cmpneq_epi16_mask( + ((__m128i)(__v8hi){5659, -8091, 28040, 7676, 3226, -12548, 29893, 12766}), + ((__m128i)(__v8hi){23731, -3987, -27073, 5995, -5765, 10343, 21504, -18513}) +) == (__mmask8)0xff); +TEST_CONSTEXPR(_mm_cmpneq_epi16_mask( + ((__m128i)(__v8hi){17386, 29612, 28099, -8524, -7042, -23864, 13718, 16802}), + ((__m128i)(__v8hi){8658, 5451, 782, -9208, 8027, 14983, -4011, -31827}) +) == (__mmask8)0xff); +TEST_CONSTEXPR(_mm_cmpneq_epi16_mask( + ((__m128i)(__v8hi){-24378, 20934, 25612, 4427, -29446, 26311, -2533, -27963}), + ((__m128i)(__v8hi){28538, -27232, 21741, -31546, -18083, 17112, -25750, -28016}) +) == (__mmask8)0xff); + +// cmplt tests +TEST_CONSTEXPR(_mm_cmplt_epi16_mask( + ((__m128i)(__v8hi){13828, -2305, -29543, 13467, 13750, 4765, -20421, -1340}), + ((__m128i)(__v8hi){17531, 9112, -7503, -2262, 12476, -24405, 543, 24076}) +) == (__mmask8)0xc7); +TEST_CONSTEXPR(_mm_cmplt_epi16_mask( + ((__m128i)(__v8hi){26544, 10625, -23568, -9115, -27479, -15046, -2294, 17617}), + ((__m128i)(__v8hi){-17598, -27694, 3374, 32022, 25371, -3401, -1466, 18741}) +) == (__mmask8)0xfc); +TEST_CONSTEXPR(_mm_cmplt_epi16_mask( + ((__m128i)(__v8hi){-20731, -29738, 15746, 14938, -18069, -3978, 25561, -23366}), + ((__m128i)(__v8hi){12163, -26845, -19607, 12781, -2854, 23771, 6504, 21136}) +) == (__mmask8)0xb3); +TEST_CONSTEXPR(_mm_cmplt_epi16_mask( + ((__m128i)(__v8hi){2923, -3968, 11644, 28855, -6225, 32503, -10027, -18296}), + ((__m128i)(__v8hi){17481, -24809, 24058, -5767, -1033, 16133, -8332, -24426}) +) == (__mmask8)0x55); +TEST_CONSTEXPR(_mm_cmplt_epi16_mask( + ((__m128i)(__v8hi){-23454, -12570, 28483, -2443, -10879, 21881, -27324, 10746}), + ((__m128i)(__v8hi){31572, -12990, 27653, -25336, 26491, 21811, 19562, -27562}) +) == (__mmask8)0x51); + +// cmple tests +TEST_CONSTEXPR(_mm_cmple_epi16_mask( + ((__m128i)(__v8hi){-13404, 5773, -2912, 12257, -21386, 12244, -25523, 28508}), + ((__m128i)(__v8hi){2730, -15074, 7642, -15989, -17979, -8818, -28069, 1577}) +) == (__mmask8)0x15); +TEST_CONSTEXPR(_mm_cmple_epi16_mask( + ((__m128i)(__v8hi){-30681, 29588, -21231, 17008, 4229, -12947, -6153, -2183}), + ((__m128i)(__v8hi){-9893, 12451, 3221, 2418, 6992, -9738, 21000, 7839}) +) == (__mmask8)0xf5); +TEST_CONSTEXPR(_mm_cmple_epi16_mask( + ((__m128i)(__v8hi){9571, 3844, 19158, 8637, 27094, -16447, -31005, 11095}), + ((__m128i)(__v8hi){3929, 901, 31907, 15912, 5595, -6562, -9664, -13180}) +) == (__mmask8)0x6c); +TEST_CONSTEXPR(_mm_cmple_epi16_mask( + ((__m128i)(__v8hi){-29653, -19891, 32155, -13473, -1745, 23019, -30659, 9319}), + ((__m128i)(__v8hi){11054, 23285, -27270, 31021, -2491, 7728, 30175, 3553}) +) == (__mmask8)0x4b); +TEST_CONSTEXPR(_mm_cmple_epi16_mask( + ((__m128i)(__v8hi){10008, -28465, -29830, 22527, 8820, -32356, 15584, 23957}), + ((__m128i)(__v8hi){-4691, 13730, -28788, -17664, 14597, -29281, -30463, 7606}) +) == (__mmask8)0x36); + +// cmpge tests +TEST_CONSTEXPR(_mm_cmpge_epi16_mask( + ((__m128i)(__v8hi){-11140, 18900, -28192, 12396, 12691, -17637, -5639, 13640}), + ((__m128i)(__v8hi){13120, 27235, 31917, 5559, 31947, -16460, 12054, -11750}) +) == (__mmask8)0x88); +TEST_CONSTEXPR(_mm_cmpge_epi16_mask( + ((__m128i)(__v8hi){29089, -626, 23207, 7124, 19598, 15564, 6422, 9504}), + ((__m128i)(__v8hi){-5950, -29409, -25182, 30585, -31424, -12209, 1669, -31761}) +) == (__mmask8)0xf7); +TEST_CONSTEXPR(_mm_cmpge_epi16_mask( + ((__m128i)(__v8hi){-20490, -26633, -14323, -14815, -23375, 18639, 30382, 10679}), + ((__m128i)(__v8hi){-19313, 26898, -1867, -31542, 25972, -24148, 14949, -21235}) +) == (__mmask8)0xe8); +TEST_CONSTEXPR(_mm_cmpge_epi16_mask( + ((__m128i)(__v8hi){-1967, 20611, 17473, -3220, -8421, 23008, -4566, 32760}), + ((__m128i)(__v8hi){6049, 26996, 3995, 3649, 22926, -31207, 5407, -25394}) +) == (__mmask8)0xa4); +TEST_CONSTEXPR(_mm_cmpge_epi16_mask( + ((__m128i)(__v8hi){-29193, 9029, 15883, -20070, 12934, -20531, 32059, -16251}), + ((__m128i)(__v8hi){-392, -23600, 21384, 3664, -23762, -25166, 5219, -5042}) +) == (__mmask8)0x72); + +// cmpgt tests +TEST_CONSTEXPR(_mm_cmpgt_epi16_mask( + ((__m128i)(__v8hi){15267, -11951, -5449, 23797, -2214, -9874, 9646, -21342}), + ((__m128i)(__v8hi){9306, 8824, 29545, 26005, 31680, -21215, 32078, 24049}) +) == (__mmask8)0x21); +TEST_CONSTEXPR(_mm_cmpgt_epi16_mask( + ((__m128i)(__v8hi){31831, 31959, -26932, -29861, 24449, -4255, 28223, -21248}), + ((__m128i)(__v8hi){-7535, -25898, 21764, 20515, 18797, -7540, -9244, -8230}) +) == (__mmask8)0x73); +TEST_CONSTEXPR(_mm_cmpgt_epi16_mask( + ((__m128i)(__v8hi){7503, -3478, 26774, -3300, 21598, -20865, 6044, -8590}), + ((__m128i)(__v8hi){5765, 29485, 26086, 13029, 7790, -24192, -14148, -25392}) +) == (__mmask8)0xf5); +TEST_CONSTEXPR(_mm_cmpgt_epi16_mask( + ((__m128i)(__v8hi){5627, -22902, 25994, -19341, -30428, 6898, 29163, -9331}), + ((__m128i)(__v8hi){31016, -1554, 23610, -25442, 28669, 22077, 28653, 22826}) +) == (__mmask8)0x4c); +TEST_CONSTEXPR(_mm_cmpgt_epi16_mask( + ((__m128i)(__v8hi){-16014, 12488, 2614, -25164, -8107, -20887, -21726, 32065}), + ((__m128i)(__v8hi){-32191, 26305, -6600, 3970, -31254, 30169, 22872, -2017}) +) == (__mmask8)0x95); + + + __mmask16 test_mm_mask_cmp_epi8_mask(__mmask16 __u, __m128i __a, __m128i __b) { // CHECK-LABEL: test_mm_mask_cmp_epi8_mask >From 448d362af17f0efc177af357de41166e3417526d Mon Sep 17 00:00:00 2001 From: shri-acha <[email protected]> Date: Tue, 25 Nov 2025 21:26:33 +0545 Subject: [PATCH 3/5] add: tests for _mm_cmp*_epu8_mask --- clang/test/CodeGen/X86/avx512vlbw-builtins.c | 132 +++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/clang/test/CodeGen/X86/avx512vlbw-builtins.c b/clang/test/CodeGen/X86/avx512vlbw-builtins.c index 3111c04ddd3e0..a473e2cb4d35c 100644 --- a/clang/test/CodeGen/X86/avx512vlbw-builtins.c +++ b/clang/test/CodeGen/X86/avx512vlbw-builtins.c @@ -895,6 +895,138 @@ TEST_CONSTEXPR(_mm_cmpgt_epi16_mask( ((__m128i)(__v8hi){-32191, 26305, -6600, 3970, -31254, 30169, 22872, -2017}) ) == (__mmask8)0x95); +// Test cases for _mm_cmp*_epu8_mask +// cmpeq tests +TEST_CONSTEXPR(_mm_cmpeq_epu8_mask( + ((__m128i)(__v16qu){16, 136, 12, 57, 51, 16, 77, 210, 75, 252, 75, 9, 225, 11, 166, 94}), + ((__m128i)(__v16qu){225, 224, 24, 209, 45, 121, 99, 61, 10, 97, 27, 158, 101, 233, 34, 12}) +) == (__mmask16)0x0000); +TEST_CONSTEXPR(_mm_cmpeq_epu8_mask( + ((__m128i)(__v16qu){224, 224, 206, 52, 121, 157, 252, 238, 48, 100, 124, 229, 100, 234, 30, 208}), + ((__m128i)(__v16qu){61, 95, 167, 40, 44, 237, 43, 102, 132, 252, 109, 244, 185, 115, 205, 2}) +) == (__mmask16)0x0000); +TEST_CONSTEXPR(_mm_cmpeq_epu8_mask( + ((__m128i)(__v16qu){12, 206, 18, 41, 83, 198, 246, 178, 153, 221, 101, 107, 46, 116, 173, 28}), + ((__m128i)(__v16qu){127, 214, 9, 253, 109, 138, 48, 204, 110, 34, 91, 206, 157, 216, 22, 157}) +) == (__mmask16)0x0000); +TEST_CONSTEXPR(_mm_cmpeq_epu8_mask( + ((__m128i)(__v16qu){239, 95, 183, 64, 22, 28, 232, 140, 235, 134, 213, 29, 47, 9, 75, 224}), + ((__m128i)(__v16qu){224, 78, 249, 228, 241, 3, 175, 176, 226, 242, 76, 169, 231, 49, 135, 97}) +) == (__mmask16)0x0000); +TEST_CONSTEXPR(_mm_cmpeq_epu8_mask( + ((__m128i)(__v16qu){145, 106, 8, 210, 56, 39, 72, 146, 99, 151, 112, 16, 160, 80, 140, 70}), + ((__m128i)(__v16qu){203, 124, 25, 113, 140, 85, 126, 152, 170, 25, 6, 121, 146, 40, 113, 57}) +) == (__mmask16)0x0000); + +// cmpneq tests +TEST_CONSTEXPR(_mm_cmpneq_epu8_mask( + ((__m128i)(__v16qu){225, 50, 34, 45, 215, 179, 100, 173, 136, 135, 252, 121, 217, 29, 82, 98}), + ((__m128i)(__v16qu){160, 184, 95, 94, 53, 251, 207, 101, 37, 176, 104, 54, 21, 228, 221, 180}) +) == (__mmask16)0xffff); +TEST_CONSTEXPR(_mm_cmpneq_epu8_mask( + ((__m128i)(__v16qu){25, 167, 250, 22, 212, 147, 54, 115, 226, 5, 240, 116, 158, 154, 120, 134}), + ((__m128i)(__v16qu){142, 156, 34, 216, 124, 89, 209, 226, 119, 133, 230, 19, 204, 218, 38, 124}) +) == (__mmask16)0xffff); +TEST_CONSTEXPR(_mm_cmpneq_epu8_mask( + ((__m128i)(__v16qu){19, 219, 73, 161, 64, 71, 158, 100, 163, 157, 73, 111, 208, 90, 168, 136}), + ((__m128i)(__v16qu){4, 15, 146, 12, 104, 227, 125, 133, 28, 148, 58, 111, 107, 172, 181, 33}) +) == (__mmask16)0xf7ff); +TEST_CONSTEXPR(_mm_cmpneq_epu8_mask( + ((__m128i)(__v16qu){134, 53, 253, 117, 213, 129, 192, 67, 243, 215, 233, 223, 121, 100, 180, 173}), + ((__m128i)(__v16qu){4, 198, 27, 51, 149, 246, 28, 192, 18, 157, 214, 77, 119, 147, 1, 28}) +) == (__mmask16)0xffff); +TEST_CONSTEXPR(_mm_cmpneq_epu8_mask( + ((__m128i)(__v16qu){241, 10, 186, 52, 173, 193, 93, 240, 187, 30, 147, 130, 221, 70, 210, 44}), + ((__m128i)(__v16qu){65, 145, 226, 92, 171, 211, 64, 61, 82, 183, 135, 205, 124, 25, 81, 244}) +) == (__mmask16)0xffff); + +// cmplt tests +TEST_CONSTEXPR(_mm_cmplt_epu8_mask( + ((__m128i)(__v16qu){188, 3, 27, 241, 77, 48, 233, 136, 166, 7, 248, 212, 73, 41, 134, 236}), + ((__m128i)(__v16qu){99, 67, 183, 99, 117, 11, 225, 198, 61, 141, 198, 145, 244, 68, 198, 52}) +) == (__mmask16)0x7296); +TEST_CONSTEXPR(_mm_cmplt_epu8_mask( + ((__m128i)(__v16qu){90, 197, 4, 61, 147, 4, 63, 30, 93, 225, 249, 120, 130, 225, 204, 27}), + ((__m128i)(__v16qu){131, 238, 224, 204, 79, 190, 139, 127, 145, 229, 163, 118, 119, 15, 122, 71}) +) == (__mmask16)0x83ef); +TEST_CONSTEXPR(_mm_cmplt_epu8_mask( + ((__m128i)(__v16qu){75, 44, 98, 1, 152, 251, 197, 192, 27, 36, 33, 183, 80, 24, 217, 121}), + ((__m128i)(__v16qu){214, 10, 95, 115, 65, 179, 194, 230, 93, 92, 209, 78, 32, 88, 119, 223}) +) == (__mmask16)0xa789); +TEST_CONSTEXPR(_mm_cmplt_epu8_mask( + ((__m128i)(__v16qu){143, 136, 99, 215, 124, 156, 108, 234, 94, 186, 245, 21, 253, 27, 218, 93}), + ((__m128i)(__v16qu){54, 248, 105, 21, 188, 253, 148, 114, 168, 96, 151, 167, 185, 152, 37, 1}) +) == (__mmask16)0x2976); +TEST_CONSTEXPR(_mm_cmplt_epu8_mask( + ((__m128i)(__v16qu){155, 8, 76, 39, 55, 79, 74, 78, 129, 144, 169, 84, 32, 112, 201, 226}), + ((__m128i)(__v16qu){185, 107, 11, 239, 21, 120, 63, 105, 153, 148, 182, 2, 0, 181, 144, 100}) +) == (__mmask16)0x27ab); + +// cmple tests +TEST_CONSTEXPR(_mm_cmple_epu8_mask( + ((__m128i)(__v16qu){89, 172, 39, 168, 219, 32, 80, 82, 190, 122, 23, 37, 15, 28, 217, 18}), + ((__m128i)(__v16qu){122, 245, 45, 82, 41, 70, 1, 117, 26, 169, 89, 160, 147, 78, 105, 226}) +) == (__mmask16)0xbea7); +TEST_CONSTEXPR(_mm_cmple_epu8_mask( + ((__m128i)(__v16qu){175, 250, 230, 32, 79, 107, 111, 206, 244, 181, 147, 110, 95, 178, 7, 32}), + ((__m128i)(__v16qu){173, 117, 248, 184, 244, 190, 240, 65, 119, 215, 67, 30, 252, 224, 86, 42}) +) == (__mmask16)0xf27c); +TEST_CONSTEXPR(_mm_cmple_epu8_mask( + ((__m128i)(__v16qu){14, 90, 183, 71, 139, 11, 177, 242, 104, 66, 206, 15, 214, 178, 91, 120}), + ((__m128i)(__v16qu){255, 3, 220, 86, 47, 19, 208, 93, 76, 231, 175, 247, 111, 146, 51, 9}) +) == (__mmask16)0x0a6d); +TEST_CONSTEXPR(_mm_cmple_epu8_mask( + ((__m128i)(__v16qu){104, 98, 30, 11, 120, 187, 239, 183, 105, 114, 48, 201, 5, 5, 88, 10}), + ((__m128i)(__v16qu){145, 250, 12, 166, 92, 215, 45, 237, 122, 132, 41, 25, 93, 15, 88, 32}) +) == (__mmask16)0xf3ab); +TEST_CONSTEXPR(_mm_cmple_epu8_mask( + ((__m128i)(__v16qu){31, 238, 238, 163, 38, 109, 134, 50, 251, 250, 68, 2, 132, 238, 236, 148}), + ((__m128i)(__v16qu){26, 223, 228, 186, 240, 53, 148, 56, 106, 196, 76, 246, 114, 102, 237, 127}) +) == (__mmask16)0x4cd8); + +// cmpge tests +TEST_CONSTEXPR(_mm_cmpge_epu8_mask( + ((__m128i)(__v16qu){209, 5, 40, 54, 128, 0, 44, 248, 51, 117, 117, 106, 57, 231, 172, 234}), + ((__m128i)(__v16qu){127, 165, 98, 192, 238, 10, 85, 220, 132, 177, 167, 233, 173, 232, 215, 90}) +) == (__mmask16)0x8081); +TEST_CONSTEXPR(_mm_cmpge_epu8_mask( + ((__m128i)(__v16qu){41, 233, 30, 65, 230, 138, 250, 66, 252, 130, 119, 231, 237, 228, 122, 34}), + ((__m128i)(__v16qu){71, 153, 86, 224, 213, 87, 212, 43, 234, 194, 148, 66, 243, 238, 59, 221}) +) == (__mmask16)0x49f2); +TEST_CONSTEXPR(_mm_cmpge_epu8_mask( + ((__m128i)(__v16qu){198, 89, 26, 129, 103, 127, 255, 110, 186, 70, 43, 10, 12, 216, 254, 209}), + ((__m128i)(__v16qu){83, 120, 28, 162, 196, 225, 222, 24, 172, 30, 154, 144, 65, 56, 94, 146}) +) == (__mmask16)0xe3c1); +TEST_CONSTEXPR(_mm_cmpge_epu8_mask( + ((__m128i)(__v16qu){59, 193, 244, 59, 108, 159, 53, 244, 201, 6, 253, 224, 211, 74, 146, 0}), + ((__m128i)(__v16qu){107, 244, 12, 240, 201, 25, 88, 46, 179, 174, 124, 99, 112, 4, 69, 16}) +) == (__mmask16)0x7da4); +TEST_CONSTEXPR(_mm_cmpge_epu8_mask( + ((__m128i)(__v16qu){165, 179, 185, 74, 129, 89, 42, 170, 195, 35, 151, 20, 240, 155, 245, 254}), + ((__m128i)(__v16qu){104, 175, 83, 169, 96, 144, 164, 61, 6, 46, 150, 36, 177, 188, 77, 147}) +) == (__mmask16)0xd597); + +// cmpgt tests +TEST_CONSTEXPR(_mm_cmpgt_epu8_mask( + ((__m128i)(__v16qu){38, 190, 130, 195, 187, 214, 113, 247, 178, 29, 139, 40, 157, 185, 136, 248}), + ((__m128i)(__v16qu){142, 87, 246, 176, 127, 177, 41, 209, 155, 139, 105, 140, 191, 70, 15, 224}) +) == (__mmask16)0xe5fa); +TEST_CONSTEXPR(_mm_cmpgt_epu8_mask( + ((__m128i)(__v16qu){64, 243, 108, 190, 6, 147, 219, 249, 213, 244, 43, 185, 134, 167, 89, 98}), + ((__m128i)(__v16qu){249, 226, 180, 166, 53, 137, 244, 172, 105, 31, 30, 43, 218, 96, 36, 140}) +) == (__mmask16)0x6faa); +TEST_CONSTEXPR(_mm_cmpgt_epu8_mask( + ((__m128i)(__v16qu){66, 24, 106, 97, 243, 223, 111, 54, 33, 138, 171, 254, 228, 155, 195, 178}), + ((__m128i)(__v16qu){204, 154, 118, 221, 206, 135, 119, 52, 84, 105, 228, 68, 184, 244, 85, 243}) +) == (__mmask16)0x5ab0); +TEST_CONSTEXPR(_mm_cmpgt_epu8_mask( + ((__m128i)(__v16qu){222, 143, 193, 146, 136, 215, 84, 82, 172, 158, 189, 199, 246, 114, 149, 116}), + ((__m128i)(__v16qu){152, 16, 193, 198, 99, 235, 130, 181, 211, 129, 39, 210, 94, 169, 4, 11}) +) == (__mmask16)0xd613); +TEST_CONSTEXPR(_mm_cmpgt_epu8_mask( + ((__m128i)(__v16qu){25, 67, 207, 46, 203, 0, 89, 144, 93, 235, 192, 245, 29, 67, 227, 66}), + ((__m128i)(__v16qu){59, 110, 28, 206, 112, 88, 82, 187, 108, 82, 224, 47, 184, 168, 201, 105}) +) == (__mmask16)0x4a54); >From e4e4e01a01afedaff7b9aa08fbabbad53f6d8b28 Mon Sep 17 00:00:00 2001 From: shri-acha <[email protected]> Date: Tue, 25 Nov 2025 21:32:46 +0545 Subject: [PATCH 4/5] add: tests for _mm_cmp*_epu16_mask --- clang/test/CodeGen/X86/avx512vlbw-builtins.c | 133 +++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/clang/test/CodeGen/X86/avx512vlbw-builtins.c b/clang/test/CodeGen/X86/avx512vlbw-builtins.c index a473e2cb4d35c..341df150232f0 100644 --- a/clang/test/CodeGen/X86/avx512vlbw-builtins.c +++ b/clang/test/CodeGen/X86/avx512vlbw-builtins.c @@ -1028,6 +1028,139 @@ TEST_CONSTEXPR(_mm_cmpgt_epu8_mask( ((__m128i)(__v16qu){59, 110, 28, 206, 112, 88, 82, 187, 108, 82, 224, 47, 184, 168, 201, 105}) ) == (__mmask16)0x4a54); +// Test cases for _mm_cmp*_epu16_mask +// cmpeq tests +TEST_CONSTEXPR(_mm_cmpeq_epu16_mask( + ((__m128i)(__v8hu){26017, 41021, 1946, 38661, 30561, 19297, 15060, 15737}), + ((__m128i)(__v8hu){8185, 18330, 37519, 42141, 61247, 31228, 6264, 59456}) +) == (__mmask8)0x00); +TEST_CONSTEXPR(_mm_cmpeq_epu16_mask( + ((__m128i)(__v8hu){36575, 60206, 3432, 10195, 34831, 43860, 40303, 49709}), + ((__m128i)(__v8hu){1432, 64285, 48336, 3804, 18528, 49977, 15597, 51759}) +) == (__mmask8)0x00); +TEST_CONSTEXPR(_mm_cmpeq_epu16_mask( + ((__m128i)(__v8hu){25178, 38322, 33003, 43178, 39760, 44915, 5994, 55537}), + ((__m128i)(__v8hu){34277, 7150, 30624, 59335, 51255, 12845, 65164, 3858}) +) == (__mmask8)0x00); +TEST_CONSTEXPR(_mm_cmpeq_epu16_mask( + ((__m128i)(__v8hu){57800, 61974, 13596, 50836, 40573, 216, 31321, 38806}), + ((__m128i)(__v8hu){28357, 61850, 47986, 47656, 1664, 36978, 15274, 60611}) +) == (__mmask8)0x00); +TEST_CONSTEXPR(_mm_cmpeq_epu16_mask( + ((__m128i)(__v8hu){57064, 51949, 42152, 43038, 65515, 7797, 23751, 12389}), + ((__m128i)(__v8hu){38499, 21192, 9584, 15701, 4826, 6826, 47257, 20923}) +) == (__mmask8)0x00); + +// cmpneq tests +TEST_CONSTEXPR(_mm_cmpneq_epu16_mask( + ((__m128i)(__v8hu){14257, 58047, 39173, 29624, 18365, 12002, 39567, 46161}), + ((__m128i)(__v8hu){39492, 1657, 38848, 30475, 33784, 22129, 16165, 39862}) +) == (__mmask8)0xff); +TEST_CONSTEXPR(_mm_cmpneq_epu16_mask( + ((__m128i)(__v8hu){35289, 33907, 13787, 15259, 39250, 33252, 47224, 23905}), + ((__m128i)(__v8hu){62303, 41983, 19416, 4638, 48011, 59449, 46768, 20704}) +) == (__mmask8)0xff); +TEST_CONSTEXPR(_mm_cmpneq_epu16_mask( + ((__m128i)(__v8hu){43035, 24266, 48861, 29042, 24252, 18719, 2345, 15378}), + ((__m128i)(__v8hu){12179, 44184, 13531, 23032, 7839, 49161, 39424, 17456}) +) == (__mmask8)0xff); +TEST_CONSTEXPR(_mm_cmpneq_epu16_mask( + ((__m128i)(__v8hu){30106, 39497, 21733, 28765, 52826, 54726, 50106, 61970}), + ((__m128i)(__v8hu){34749, 64882, 7430, 10309, 26658, 22489, 34795, 35513}) +) == (__mmask8)0xff); +TEST_CONSTEXPR(_mm_cmpneq_epu16_mask( + ((__m128i)(__v8hu){17033, 42616, 6158, 53144, 14513, 29528, 57905, 62537}), + ((__m128i)(__v8hu){38447, 51378, 320, 16853, 48397, 49715, 53668, 43839}) +) == (__mmask8)0xff); + +// cmplt tests +TEST_CONSTEXPR(_mm_cmplt_epu16_mask( + ((__m128i)(__v8hu){12351, 47995, 11802, 16970, 16956, 13965, 33529, 18928}), + ((__m128i)(__v8hu){48792, 59915, 50576, 62643, 3758, 16415, 7966, 39475}) +) == (__mmask8)0xaf); +TEST_CONSTEXPR(_mm_cmplt_epu16_mask( + ((__m128i)(__v8hu){64376, 821, 6646, 56557, 41027, 54650, 38293, 65034}), + ((__m128i)(__v8hu){16194, 13150, 9765, 40643, 62592, 32105, 37358, 43042}) +) == (__mmask8)0x16); +TEST_CONSTEXPR(_mm_cmplt_epu16_mask( + ((__m128i)(__v8hu){5197, 38111, 57400, 21773, 6778, 55251, 43022, 23599}), + ((__m128i)(__v8hu){25453, 44508, 11034, 51861, 28507, 3586, 50043, 22852}) +) == (__mmask8)0x5b); +TEST_CONSTEXPR(_mm_cmplt_epu16_mask( + ((__m128i)(__v8hu){45352, 2829, 63457, 8858, 31243, 17792, 61465, 39468}), + ((__m128i)(__v8hu){36906, 65156, 12702, 36312, 25463, 30740, 17784, 16985}) +) == (__mmask8)0x2a); +TEST_CONSTEXPR(_mm_cmplt_epu16_mask( + ((__m128i)(__v8hu){55773, 8388, 56635, 32082, 18204, 53351, 33529, 17025}), + ((__m128i)(__v8hu){40397, 47032, 24886, 11409, 5864, 42244, 24984, 9087}) +) == (__mmask8)0x02); + +// cmple tests +TEST_CONSTEXPR(_mm_cmple_epu16_mask( + ((__m128i)(__v8hu){7117, 51838, 34713, 59818, 13657, 57172, 51354, 44657}), + ((__m128i)(__v8hu){43684, 29399, 39679, 60107, 61794, 25979, 20734, 59740}) +) == (__mmask8)0x9d); +TEST_CONSTEXPR(_mm_cmple_epu16_mask( + ((__m128i)(__v8hu){34191, 12870, 38578, 50725, 13944, 40695, 8891, 56035}), + ((__m128i)(__v8hu){15935, 55419, 10154, 43268, 20049, 46161, 14264, 35221}) +) == (__mmask8)0x72); +TEST_CONSTEXPR(_mm_cmple_epu16_mask( + ((__m128i)(__v8hu){33955, 56125, 59463, 56265, 62541, 27516, 15841, 10852}), + ((__m128i)(__v8hu){110, 25696, 52299, 36663, 26130, 22670, 40665, 36384}) +) == (__mmask8)0xc0); +TEST_CONSTEXPR(_mm_cmple_epu16_mask( + ((__m128i)(__v8hu){30109, 45669, 64670, 2417, 24233, 12069, 21306, 31838}), + ((__m128i)(__v8hu){41978, 40368, 4025, 37501, 5634, 43889, 27907, 243}) +) == (__mmask8)0x69); +TEST_CONSTEXPR(_mm_cmple_epu16_mask( + ((__m128i)(__v8hu){30467, 14437, 9940, 54360, 37732, 61408, 1077, 33377}), + ((__m128i)(__v8hu){21329, 57575, 30740, 42725, 26374, 53724, 12, 11808}) +) == (__mmask8)0x06); + +// cmpge tests +TEST_CONSTEXPR(_mm_cmpge_epu16_mask( + ((__m128i)(__v8hu){18151, 20516, 44819, 57353, 65147, 3123, 59838, 46999}), + ((__m128i)(__v8hu){55970, 31815, 16503, 37882, 46380, 47912, 2076, 33014}) +) == (__mmask8)0xdc); +TEST_CONSTEXPR(_mm_cmpge_epu16_mask( + ((__m128i)(__v8hu){60160, 48803, 35124, 42510, 62783, 18767, 26220, 16209}), + ((__m128i)(__v8hu){22162, 54330, 56847, 11199, 46429, 7012, 12165, 42137}) +) == (__mmask8)0x79); +TEST_CONSTEXPR(_mm_cmpge_epu16_mask( + ((__m128i)(__v8hu){15118, 50748, 64103, 47033, 11223, 61427, 3201, 61926}), + ((__m128i)(__v8hu){19094, 30041, 5839, 62591, 59904, 1530, 40604, 34353}) +) == (__mmask8)0xa6); +TEST_CONSTEXPR(_mm_cmpge_epu16_mask( + ((__m128i)(__v8hu){37865, 12467, 45289, 60251, 60268, 3908, 51781, 35681}), + ((__m128i)(__v8hu){30915, 32324, 1515, 24432, 15318, 33790, 22826, 64258}) +) == (__mmask8)0x5d); +TEST_CONSTEXPR(_mm_cmpge_epu16_mask( + ((__m128i)(__v8hu){53950, 52988, 13868, 25190, 31823, 62039, 43379, 51291}), + ((__m128i)(__v8hu){35593, 54830, 49773, 10890, 44742, 48266, 45280, 14226}) +) == (__mmask8)0xa9); + +// cmpgt tests +TEST_CONSTEXPR(_mm_cmpgt_epu16_mask( + ((__m128i)(__v8hu){53569, 10332, 63903, 42861, 45572, 36510, 50522, 36590}), + ((__m128i)(__v8hu){20661, 10192, 56056, 56939, 27398, 16004, 27165, 43131}) +) == (__mmask8)0x77); +TEST_CONSTEXPR(_mm_cmpgt_epu16_mask( + ((__m128i)(__v8hu){64844, 511, 53950, 40143, 20601, 53105, 34756, 60447}), + ((__m128i)(__v8hu){20846, 55132, 57724, 35384, 25368, 41097, 3764, 52879}) +) == (__mmask8)0xe9); +TEST_CONSTEXPR(_mm_cmpgt_epu16_mask( + ((__m128i)(__v8hu){64715, 31454, 34266, 43085, 52260, 7304, 25587, 43911}), + ((__m128i)(__v8hu){25076, 3569, 11981, 11259, 63537, 32468, 23699, 9601}) +) == (__mmask8)0xcf); +TEST_CONSTEXPR(_mm_cmpgt_epu16_mask( + ((__m128i)(__v8hu){57954, 26888, 1708, 125, 19459, 44354, 29760, 23713}), + ((__m128i)(__v8hu){2188, 13828, 28514, 39528, 42286, 41311, 28270, 11063}) +) == (__mmask8)0xe3); +TEST_CONSTEXPR(_mm_cmpgt_epu16_mask( + ((__m128i)(__v8hu){36435, 57842, 17322, 33066, 51263, 58618, 57550, 23212}), + ((__m128i)(__v8hu){150, 39532, 62935, 34670, 57126, 9790, 21078, 3593}) +) == (__mmask8)0xe3); + __mmask16 test_mm_mask_cmp_epi8_mask(__mmask16 __u, __m128i __a, __m128i __b) { >From bffb0d837bf376790704af0e09d98edb5ea6f3cd Mon Sep 17 00:00:00 2001 From: shri-acha <[email protected]> Date: Fri, 28 Nov 2025 09:45:16 +0545 Subject: [PATCH 5/5] add: tests for _mm256_cmp*_epi8_mask --- clang/test/CodeGen/X86/avx512vlbw-builtins.c | 159 +++++++++++++++++++ 1 file changed, 159 insertions(+) diff --git a/clang/test/CodeGen/X86/avx512vlbw-builtins.c b/clang/test/CodeGen/X86/avx512vlbw-builtins.c index 341df150232f0..9336090cad6e8 100644 --- a/clang/test/CodeGen/X86/avx512vlbw-builtins.c +++ b/clang/test/CodeGen/X86/avx512vlbw-builtins.c @@ -1163,6 +1163,165 @@ TEST_CONSTEXPR(_mm_cmpgt_epu16_mask( +// tests for _mm256_cmp*_mask + +// cmpeq +TEST_CONSTEXPR(_mm256_cmpeq_epi8_mask( + ((__m256i)(__v32qi){65, 123, -1, -81, 85, -32, -1, -128, -69, 118, -114, -22, 97, 48, -64, -53, -76, -112, 40, 123, 35, -90, 125, 1, 4, 117, -13, -78, -118, -26, -59, -27}), + ((__m256i)(__v32qi){-122, -37, 93, 112, -113, 36, 72, -110, -75, 57, 52, 69, -51, -85, 36, -62, 45, -90, -45, 102, -87, 114, 34, -97, 13, 15, -125, -72, 74, 115, -92, -5}) +) == (__mmask32)0x0); + +TEST_CONSTEXPR(_mm256_cmpeq_epi8_mask( + ((__m256i)(__v32qi){9, 23, 36, -105, -32, 41, -58, 107, -118, 13, -53, 49, -71, 127, 81, -50, -27, 102, -120, 63, -26, 64, -11, 34, 95, -124, -42, 98, 121, -39, 54, 86}), + ((__m256i)(__v32qi){126, 115, -9, -58, -80, 105, -98, -57, -43, -16, 3, 27, -43, -56, 11, -81, 15, -64, -30, -55, -6, 19, 116, 115, -41, -23, 110, 36, 114, 4, 90, 62}) +) == (__mmask32)0x0); + +TEST_CONSTEXPR(_mm256_cmpeq_epi8_mask( + ((__m256i)(__v32qi){-107, 108, 114, 56, 115, 41, -5, 77, -124, 123, -3, -117, 101, 89, 41, 87, -43, 95, 62, 45, 115, 30, -125, 81, 46, -28, -34, 125, -99, -110, 106, 34}), + ((__m256i)(__v32qi){36, 53, 102, -84, 11, 21, 55, 87, 28, -36, -1, 7, 7, 112, 33, 100, 69, -96, 12, 44, 14, -38, -23, -99, -79, 1, -77, 82, 3, 32, 5, -123}) +) == (__mmask32)0x0); + +TEST_CONSTEXPR(_mm256_cmpeq_epi8_mask( + ((__m256i)(__v32qi){-117, 57, -55, -65, 41, 101, 41, 91, 55, -54, -33, 55, 14, -29, 117, 124, 72, -98, -57, 77, -126, 9, -86, 45, -128, 86, -57, -12, 37, -81, -108, 107}), + ((__m256i)(__v32qi){-94, -25, 126, -53, -72, 84, -88, -56, -20, -117, 97, 127, 63, 53, -3, -88, -83, -34, 60, -82, 42, -86, 126, -20, 16, -33, 97, -90, -95, 48, 88, -124}) +) == (__mmask32)0x0); + +TEST_CONSTEXPR(_mm256_cmpeq_epi8_mask( + ((__m256i)(__v32qi){-62, 71, 111, 70, 20, 26, 34, -11, 49, 122, 80, 96, -30, 103, -11, 73, -105, -20, -98, 12, 106, 7, 61, 25, 39, -6, -109, 2, -26, -86, -77, -94}), + ((__m256i)(__v32qi){-2, 120, 99, -40, -72, -83, 73, 80, -74, -110, 4, 91, -33, -24, 38, -122, -41, 115, 63, 43, 113, -43, 121, 46, -30, 92, 52, -117, -75, -113, -31, -47}) +) == (__mmask32)0x0); + +// cmpneq +TEST_CONSTEXPR(_mm256_cmpneq_epi8_mask( + ((__m256i)(__v32qi){108, -96, -35, 20, 25, -22, -28, 44, 4, -14, 99, -112, -94, 110, -2, -88, 70, 99, -80, -31, -9, -10, 81, 16, -125, -91, -112, 79, -117, 123, 14, 3}), + ((__m256i)(__v32qi){80, 69, 32, -43, -124, -8, 64, 27, -1, 119, -62, 5, -42, 5, 39, -44, 21, 46, -48, 60, 117, 51, -96, 53, 35, 29, -53, -99, 80, 89, 41, 33}) +) == (__mmask32)0xffffffff); + +TEST_CONSTEXPR(_mm256_cmpneq_epi8_mask( + ((__m256i)(__v32qi){-86, 105, -105, 99, -125, -40, -75, -82, 27, 72, 68, -23, -95, -128, -87, -103, 86, 123, -96, -124, 64, 109, -74, 64, 17, 28, 27, 22, 108, 36, -16, -1}), + ((__m256i)(__v32qi){-43, -26, 56, -30, -66, 18, 52, 90, 60, 5, -110, 0, -36, 83, 94, -29, -36, -5, -39, 106, -36, 120, -14, 23, 38, 48, -5, -95, -65, -118, -27, -104}) +) == (__mmask32)0xffffffff); + +TEST_CONSTEXPR(_mm256_cmpneq_epi8_mask( + ((__m256i)(__v32qi){-111, 117, -70, -12, -61, -20, -78, 75, 115, -70, 25, -51, -76, 44, 93, -73, 47, -23, 115, -40, -93, -29, 76, 66, 32, 19, 113, -71, 61, -50, 19, 89}), + ((__m256i)(__v32qi){17, -32, -44, -72, 56, 46, 71, -77, 117, 122, -15, 27, 94, -61, -8, -41, 31, -10, 65, -96, 61, 41, -114, -59, -38, 86, -18, -79, -4, 30, -121, -35}) +) == (__mmask32)0xffffffff); + +TEST_CONSTEXPR(_mm256_cmpneq_epi8_mask( + ((__m256i)(__v32qi){-93, -108, 39, 110, 62, -79, 114, 47, -82, -38, -27, -114, 66, 66, 98, 12, 53, -37, 13, -45, -120, -46, -108, 28, -79, 19, -24, 44, -127, -115, 123, 113}), + ((__m256i)(__v32qi){4, -109, 82, 27, 53, -127, -113, -102, -51, -59, -122, -117, 6, -11, -16, -72, 107, 78, 10, -6, -34, -47, 104, 33, -69, 53, 33, 83, -24, 52, 109, 124}) +) == (__mmask32)0xffffffff); + +TEST_CONSTEXPR(_mm256_cmpneq_epi8_mask( + ((__m256i)(__v32qi){1, -32, 61, 98, 123, 34, 99, -77, -34, 68, 101, 37, 29, -99, 33, -22, 85, 13, 26, 85, 8, -17, -124, 19, 69, -40, -32, 58, -35, -4, -125, -112}), + ((__m256i)(__v32qi){30, 45, 85, -71, -111, 111, -82, 107, -71, -4, -46, 8, 52, -107, 107, -14, 33, 35, 31, 116, -75, -33, -82, -60, 26, 40, 82, 85, -78, 97, 104, -91}) +) == (__mmask32)0xffffffff); + +// cmplt +// +TEST_CONSTEXPR(_mm256_cmplt_epi8_mask( + ((__m256i)(__v32qi){101, -24, 65, 23, -24, -46, 114, 45, -95, 125, -113, 27, -121, -41, -9, -87, -41, 40, -105, -5, 10, 68, 18, -121, -73, -89, -22, 95, 85, 112, 88, -46}), + ((__m256i)(__v32qi){80, -31, 9, -9, -61, -18, 97, -115, -102, -16, 7, -106, -73, 119, 43, -45, 22, 60, -110, -83, 100, 97, 102, 30, 22, -10, 106, 116, -90, 75, 34, 41}) +) == (__mmask32)0x8ff3f420); + +TEST_CONSTEXPR(_mm256_cmplt_epi8_mask( + ((__m256i)(__v32qi){-26, 127, 107, 82, 115, 115, 0, -61, -46, -98, -128, 114, -44, 43, -121, 60, 43, 99, 77, 67, -24, 100, 22, 121, 44, 42, -102, 30, 64, 25, -83, -56}), + ((__m256i)(__v32qi){118, -39, -70, -97, 76, 95, 100, 5, 122, -79, 5, 114, -18, 27, 110, -58, -62, -30, -72, -19, 37, 55, 42, 36, 93, -117, 97, -40, 13, 119, 83, -120}) +) == (__mmask32)0x655057c1); + +TEST_CONSTEXPR(_mm256_cmplt_epi8_mask( + ((__m256i)(__v32qi){33, -60, -34, -23, 5, -90, -96, 11, 24, 110, -17, 104, 74, -111, 66, -53, 84, 28, -124, 10, 104, 114, -32, -13, 124, 76, -101, -18, -46, -41, 127, -11}), + ((__m256i)(__v32qi){-26, 94, -39, -19, -122, -107, -6, 122, 43, 6, 19, -121, 103, 26, 48, -9, 58, 120, 35, 29, -60, 11, -24, 104, -1, -44, -22, -112, -95, 93, -13, 34}) +) == (__mmask32)0xa4ceb5ca); + +TEST_CONSTEXPR(_mm256_cmplt_epi8_mask( + ((__m256i)(__v32qi){-97, -105, -72, 99, 9, 46, -15, -69, -79, 71, 87, 93, 58, -50, 112, -119, 90, 25, -18, 83, 3, -37, -56, -23, 119, -49, -52, 12, -47, -84, -41, -58}), + ((__m256i)(__v32qi){107, -19, -95, -7, 63, -25, -55, 4, 109, 51, 90, -62, 53, -9, -69, -58, -98, -35, 32, -25, 40, -53, -66, 86, -121, -92, 116, 93, 122, -111, 105, -114}) +) == (__mmask32)0x5c94a593); + +TEST_CONSTEXPR(_mm256_cmplt_epi8_mask( + ((__m256i)(__v32qi){72, -110, -26, 40, -96, -73, 13, 72, 112, -34, -25, 49, -82, 84, 21, -78, 67, 55, -2, -23, 2, 8, -103, 60, -30, 107, 87, -17, -6, -86, 118, -115}), + ((__m256i)(__v32qi){64, 40, -74, 122, 111, -128, 21, 62, 22, 99, -10, -128, -118, 70, -61, 117, 0, 20, -28, 77, 45, 88, -7, -74, -34, 85, -15, 3, -16, -4, 127, 46}) +) == (__mmask32)0xe878865a); + +// cmple +TEST_CONSTEXPR(_mm256_cmple_epi8_mask( + ((__m256i)(__v32qi){-5, -85, 40, -29, -25, -124, 8, 119, 118, -3, -106, 115, -89, -35, -31, 66, 67, -95, 35, 86, 44, 12, -65, -18, -118, 57, 76, 41, -48, 123, -107, -28}), + ((__m256i)(__v32qi){-49, 7, -66, -90, -71, 44, 67, -65, 100, -83, 93, 95, -20, 91, 73, -16, -127, -45, -89, 86, -3, -112, -6, 87, 34, -76, -16, -89, 87, -77, -29, 18}) +) == (__mmask32)0xd1ca7462); + +TEST_CONSTEXPR(_mm256_cmple_epi8_mask( + ((__m256i)(__v32qi){-37, 68, 22, 32, -46, 5, -1, -117, -54, -127, 67, 54, -8, -98, -3, 13, -120, 119, 13, -70, -38, -85, -97, -6, -49, -89, 95, 83, 76, 5, -125, 92}), + ((__m256i)(__v32qi){-98, 43, -13, 119, -58, 95, 64, 35, -41, 105, -114, -16, -52, -18, 126, -20, 22, -87, 90, -127, 33, -42, 45, 103, -117, 41, -65, -76, 34, -14, -69, -9}) +) == (__mmask32)0x42f563e8); + +TEST_CONSTEXPR(_mm256_cmple_epi8_mask( + ((__m256i)(__v32qi){-53, 43, -115, -57, -116, 70, -116, -123, 66, -12, -32, 7, -30, -1, -25, 22, 14, -46, -87, -26, 110, -69, -83, 16, 20, 77, 43, -128, 68, -15, 104, 6}), + ((__m256i)(__v32qi){54, -84, 126, -69, 102, 80, 97, 19, 21, 39, -26, -12, -26, -114, -3, 10, 0, 89, 89, -73, -119, -13, 6, 97, -44, 64, -49, 92, 25, 55, 16, -39}) +) == (__mmask32)0x28e656f5); + +TEST_CONSTEXPR(_mm256_cmple_epi8_mask( + ((__m256i)(__v32qi){-23, -75, -97, -103, -121, 60, -80, 61, 118, 51, 89, 118, -71, 111, -28, -92, 12, 94, 40, 10, 26, -38, 14, -82, 42, 18, -104, 120, 43, 126, 84, -51}), + ((__m256i)(__v32qi){-52, -76, 27, -52, -21, -105, -128, 101, -18, 60, -70, -24, -72, -19, 47, 108, 7, 22, -37, -50, -51, 58, 0, -87, 12, 126, -57, 81, 73, 111, -71, -81}) +) == (__mmask32)0x1620c29c); + +TEST_CONSTEXPR(_mm256_cmple_epi8_mask( + ((__m256i)(__v32qi){91, -39, -23, 58, 12, 71, -56, 34, -100, 111, -77, -48, -101, -25, -126, -5, 100, 47, 110, 6, 73, 52, -92, 34, 96, -98, 41, -60, 88, 5, -101, -11}), + ((__m256i)(__v32qi){73, -81, 68, -86, -8, -16, -47, 56, -30, 18, 3, -29, -73, -98, -37, 57, -30, 79, 26, -71, -99, 15, 61, 18, -12, 59, -114, 14, -105, 38, -63, 101}) +) == (__mmask32)0xea42ddc4); + + +// cmpgt +TEST_CONSTEXPR(_mm256_cmpgt_epi8_mask( + ((__m256i)(__v32qi){0, -46, -12, -123, 80, 117, -10, -29, -68, 98, -70, 53, -99, -120, -92, 70, 91, -45, -55, -38, -73, 15, 20, -109, 57, 72, 65, -101, -38, 17, -59, 12}), + ((__m256i)(__v32qi){52, 104, -97, 48, 90, 98, 1, 97, -28, -98, 106, 104, -64, -90, -9, 0, -28, 69, -54, -20, -29, -77, 3, 99, 48, 56, 21, -38, 61, 125, 30, -30}) +) == (__mmask32)0x87618224); + +TEST_CONSTEXPR(_mm256_cmpgt_epi8_mask( + ((__m256i)(__v32qi){-96, 2, 2, -27, -8, 85, -108, 39, -115, 31, -122, 36, -75, -57, 25, 109, 121, -1, -85, -24, 91, -61, -17, 83, -111, 82, -81, -112, 104, 61, -24, 14}), + ((__m256i)(__v32qi){-104, 33, -53, -37, 96, 32, 14, -41, -10, 108, 49, 102, 91, -56, 22, -102, -67, -105, -102, 32, 42, -97, 38, -67, -23, -119, -100, 82, -12, -78, -61, 62}) +) == (__mmask32)0x76b7c0ad); + +TEST_CONSTEXPR(_mm256_cmpgt_epi8_mask( + ((__m256i)(__v32qi){-125, 53, -122, -91, 112, 37, 49, -112, 27, -79, -72, -79, -22, 87, 87, -124, 127, -87, -64, 126, 59, 9, 35, -17, -81, -76, -91, -33, 22, -18, -122, 13}), + ((__m256i)(__v32qi){-45, -16, -111, 98, -102, -46, 26, 124, 41, 8, -45, -118, -97, -66, -44, 108, 110, -3, 83, 84, -11, 98, 25, 86, 77, 84, -100, 3, 72, 90, 102, -2}) +) == (__mmask32)0x84597872); + +TEST_CONSTEXPR(_mm256_cmpgt_epi8_mask( + ((__m256i)(__v32qi){-126, -6, 92, -46, -126, -20, -126, -124, -121, 39, 118, -106, -48, -118, -83, 36, -125, 28, -48, -91, -31, 68, -38, 123, -69, -35, -10, 18, -82, 48, 114, -121}), + ((__m256i)(__v32qi){42, -56, 92, -106, -50, -20, 53, -36, -40, -77, 76, 119, -104, 76, -52, -65, 34, -126, 69, 108, 33, 108, 3, 93, -60, -113, -104, -8, -6, 55, 105, 52}) +) == (__mmask32)0x4e82960a); + +TEST_CONSTEXPR(_mm256_cmpgt_epi8_mask( + ((__m256i)(__v32qi){17, -85, 47, -4, 36, 38, -60, 33, -35, 89, -87, 23, 104, 30, -49, 41, 1, 112, -7, 22, 126, 26, -57, -23, 67, -124, -120, 62, 72, 126, 43, -49}), + ((__m256i)(__v32qi){-48, -107, -125, 53, 78, 121, 92, 17, -51, 79, 116, -21, -52, 26, 63, -71, -86, -99, -11, 13, 75, -120, -113, -87, 115, -94, 74, -82, 117, -6, -47, 103}) +) == (__mmask32)0x68ffbb87); +// cmpge +TEST_CONSTEXPR(_mm256_cmpge_epi8_mask( + ((__m256i)(__v32qi){55, -102, 124, 13, 94, 13, -23, 98, -101, -124, 116, 90, -88, -123, 72, 28, -29, 10, -48, 11, -102, 7, 81, -88, -82, -9, -116, -31, -74, 45, 0, 27}), + ((__m256i)(__v32qi){-125, -35, -45, -16, -125, 93, 81, -70, 43, -93, 116, 46, -82, -61, -54, -55, -18, 62, 11, -4, 106, -2, -26, -27, -114, -70, 33, -27, 37, -116, 77, 94}) +) == (__mmask32)0x2368cc9d); + +TEST_CONSTEXPR(_mm256_cmpge_epi8_mask( + ((__m256i)(__v32qi){34, -31, 101, 49, -69, 57, 94, -127, -32, 22, 10, -79, 29, 68, -31, 71, 96, 99, 17, -39, -41, -121, 103, -22, -74, -112, -110, -121, -97, -86, -122, -88}), + ((__m256i)(__v32qi){24, 119, -121, 29, -13, -19, -48, 50, -109, 48, 38, 54, 85, 87, 48, 5, -3, 4, 21, -110, -119, 15, 114, -113, 95, -100, 105, 78, -77, 43, 30, 79}) +) == (__mmask32)0x9b816d); + +TEST_CONSTEXPR(_mm256_cmpge_epi8_mask( + ((__m256i)(__v32qi){81, 85, -34, -6, 112, -36, -99, 18, -47, 3, -54, 56, -12, -86, -33, 60, 92, 49, 82, 0, 103, -109, 99, -25, -62, -15, 64, -119, -8, 13, -77, -56}), + ((__m256i)(__v32qi){90, -42, -23, -101, 113, -66, 87, 66, 72, -103, 67, -56, -128, 118, 112, 58, 56, 83, -7, -103, -91, 40, -64, 91, -108, -62, 22, 41, -32, 78, 92, -2}) +) == (__mmask32)0x175d9a2a); + +TEST_CONSTEXPR(_mm256_cmpge_epi8_mask( + ((__m256i)(__v32qi){-80, 84, -7, -109, 70, -116, -120, -87, -75, 92, -42, -12, -78, -81, 1, -117, -93, -24, -19, -16, -110, -120, -71, 124, 75, 20, -69, 65, -67, -39, -50, -56}), + ((__m256i)(__v32qi){75, -102, -40, -112, 36, -112, 34, 50, 4, -54, -60, -35, -44, 107, -94, -110, 47, -116, -101, 9, -44, 42, -121, 93, 26, -13, -127, 37, -17, 112, 60, -10}) +) == (__mmask32)0xfc64e1e); + +TEST_CONSTEXPR(_mm256_cmpge_epi8_mask( + ((__m256i)(__v32qi){66, 9, 79, -49, 14, 49, 81, -4, 33, -113, 18, -85, -77, -112, -119, 19, 80, -74, 105, 120, 76, -123, -12, 8, 98, 72, -37, -29, -120, 17, -107, 101}), + ((__m256i)(__v32qi){119, 10, 36, 76, -116, 12, -9, 75, 53, -52, -9, -57, -28, -80, -27, 34, 106, 44, -109, 20, -10, 119, 116, 16, 36, 9, -14, -61, 6, -70, 26, 84}) +) == (__mmask32)0xab1c0474); + __mmask16 test_mm_mask_cmp_epi8_mask(__mmask16 __u, __m128i __a, __m128i __b) { // CHECK-LABEL: test_mm_mask_cmp_epi8_mask // CHECK: icmp eq <16 x i8> %{{.*}}, %{{.*}} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
