================
@@ -242,6 +250,16 @@ unsigned char test_kortest_mask32_u8(__m512i __A, __m512i 
__B, __m512i __C, __m5
                             _mm512_cmpneq_epu16_mask(__C, __D), CF);
 }
 
+#if TEST_STD_VER > 17
+TEST_CONSTEXPR bool test_kortest_mask32_u8() {
+  unsigned char all_ones = 0;
+  return (_kortest_mask32_u8(0x0000'0000, 0x0000'0000, &all_ones) == 1) && 
(all_ones == 0)
+      && (_kortest_mask32_u8(0x0000'0000, 0x8000'0000, &all_ones) == 0) && 
(all_ones == 0)
+      && (_kortest_mask32_u8(0x0123'4567, 0xFEDC'BA98, &all_ones) == 0) && 
(all_ones == 1)
+      ;
+}
----------------
rturrado wrote:

Something like this would do?

But I would have to use `_cplusplus >= 201402L` because `std::pair<U1, U2>` 
constructor is only `constexpr` since C++14.

```
// Test constexpr handling.
#if defined(__cplusplus) && (__cplusplus >= 201402L)
constexpr std::pair<unsigned char, unsigned char>
test_kortest_mask32_u8(unsigned int A, unsigned int B) {
  unsigned char all_ones{};
  unsigned char result = _kortest_mask32_u8(A, B, &all_ones);
  return std::pair<unsigned char, unsigned char>(result, all_ones);
}

void _kortest_mask32_u8() {
  constexpr unsigned int A1 = 0x0000'0000;
  constexpr unsigned int B1 = 0x0000'0000;
  constexpr std::pair<unsigned char, unsigned char> expected_result_1{1, 0};
  static_assert(test_kortest_mask32_u8(A1, B1) == expected_result_1);
  constexpr unsigned int A2 = 0x0000'0000;
  constexpr unsigned int B2 = 0x8000'0000;
  constexpr std::pair<unsigned char, unsigned char> expected_result_2{0, 0};
  static_assert(test_kortest_mask32_u8(A2, B2) == expected_result_2);
  constexpr unsigned int A3 = 0x0123'4567;
  constexpr unsigned int B3 = 0xFEDC'BA98;
  constexpr std::pair<unsigned char, unsigned char> expected_result_3{0, 1};
  static_assert(test_kortest_mask32_u8(A3, B3) == expected_result_3);
}
#endif
```

https://github.com/llvm/llvm-project/pull/166103
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to