aboutsummaryrefslogtreecommitdiff
path: root/clang/test/AST/ByteCode/builtin-functions.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2024-12-02 16:04:49 +0100
committerGitHub <noreply@github.com>2024-12-02 16:04:49 +0100
commitb587b910d5b6fd27f4730ad933a8465528d6f5be (patch)
tree19c7231b0bd2441f56678336fefaf10c94bbe911 /clang/test/AST/ByteCode/builtin-functions.cpp
parenteae30a240e34e1fd31b57096a1b8bdbd8b84352d (diff)
downloadllvm-b587b910d5b6fd27f4730ad933a8465528d6f5be.zip
llvm-b587b910d5b6fd27f4730ad933a8465528d6f5be.tar.gz
llvm-b587b910d5b6fd27f4730ad933a8465528d6f5be.tar.bz2
[clang][bytecode] Implement __builtin_reduce_xor (#118299)
Diffstat (limited to 'clang/test/AST/ByteCode/builtin-functions.cpp')
-rw-r--r--clang/test/AST/ByteCode/builtin-functions.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp
index 81fed29..61b78e8 100644
--- a/clang/test/AST/ByteCode/builtin-functions.cpp
+++ b/clang/test/AST/ByteCode/builtin-functions.cpp
@@ -1096,6 +1096,18 @@ namespace ReduceOr {
#endif
}
+namespace ReduceXor {
+ static_assert(__builtin_reduce_xor((vector4char){}) == 0);
+ static_assert(__builtin_reduce_xor((vector4char){(char)0x11, (char)0x22, (char)0x44, (char)0x88}) == (char)0xFF);
+ static_assert(__builtin_reduce_xor((vector4short){(short)0x1111, (short)0x2222, (short)0x4444, (short)0x8888}) == (short)0xFFFF);
+#if __INT_WIDTH__ == 32
+ static_assert(__builtin_reduce_xor((vector4int){(int)0x11111111, (int)0x22222222, (int)0x44444444, (int)0x88888888}) == (int)0xFFFFFFFF);
+ 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);
+#endif
+}
+
namespace BuiltinMemcpy {
constexpr int simple() {
int a = 12;