[clang] [clang] constexpr built-in reduce and function. (PR #116822)
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 19 08:56:59 PST 2024
================
@@ -765,3 +765,11 @@ constexpr long long reduceMulLong2 = __builtin_reduce_mul((vector4long){(1LL <<
// expected-note at -1 {{outside the range of representable values of type 'long long'}}
static_assert(__builtin_reduce_mul((vector4uint){~0U, 1, 1, 2}) == ~0U - 1);
static_assert(__builtin_reduce_mul((vector4ulong){~0ULL, 1, 1, 2}) == ~0ULL - 1);
+
+static_assert(__builtin_reduce_and((vector4char){}) == 0);
+static_assert(__builtin_reduce_and((vector4char){(char)0x11, (char)0x22, (char)0x44, (char)0x88}) == 0);
----------------
RKSimon wrote:
Include some tests that give non-zero results (helps to check for sign-extensions in the comparisons)
https://github.com/llvm/llvm-project/pull/116822
More information about the cfe-commits
mailing list