[clang] [clang] constexpr built-in elementwise popcount function. (PR #117473)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 25 04:26:07 PST 2024
================
@@ -797,3 +797,21 @@ static_assert(__builtin_reduce_xor((vector4int){(int)0x11111111, (int)0x22222222
static_assert(__builtin_reduce_xor((vector4long){(long long)0x1111111111111111L, (long long)0x2222222222222222L, (long long)0x4444444444444444L, (long long)0x8888888888888888L}) == (long long)0xFFFFFFFFFFFFFFFFL);
static_assert(__builtin_reduce_xor((vector4uint){0x11111111U, 0x22222222U, 0x44444444U, 0x88888888U}) == 0xFFFFFFFFU);
static_assert(__builtin_reduce_xor((vector4ulong){0x1111111111111111UL, 0x2222222222222222UL, 0x4444444444444444UL, 0x8888888888888888UL}) == 0xFFFFFFFFFFFFFFFFUL);
+
+static_assert(__builtin_reduce_add(__builtin_elementwise_popcount((vector4int){1, 2, 3, 4})) == 5);
----------------
Fznamznon wrote:
Could you please also add a test checking vector result but without using `__builtin_reduce_add` ?
https://github.com/llvm/llvm-project/pull/117473
More information about the cfe-commits
mailing list