[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / X86 / x86-bswap.c
blob589dd83606983cb90af1c87b4dc75c6c7d07ffc2
1 // RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-apple-darwin -no-enable-noundef-analysis -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-apple-darwin -no-enable-noundef-analysis -emit-llvm -o - | FileCheck %s
4 #include <x86intrin.h>
6 int test__bswapd(int X) {
7 // CHECK-LABEL: test__bswapd
8 // CHECK: call i32 @llvm.bswap.i32
9 return __bswapd(X);
12 int test_bswap(int X) {
13 // CHECK-LABEL: test_bswap
14 // CHECK: call i32 @llvm.bswap.i32
15 return _bswap(X);
18 long test__bswapq(long long X) {
19 // CHECK-LABEL: test__bswapq
20 // CHECK: call i64 @llvm.bswap.i64
21 return __bswapq(X);
24 long test_bswap64(long long X) {
25 // CHECK-LABEL: test_bswap64
26 // CHECK: call i64 @llvm.bswap.i64
27 return _bswap64(X);
30 // Test constexpr handling.
31 #if defined(__cplusplus) && (__cplusplus >= 201103L)
33 char bswapd_0[__bswapd(0x00000000) == 0x00000000 ? 1 : -1];
34 char bswapd_1[__bswapd(0x01020304) == 0x04030201 ? 1 : -1];
36 char bswap_0[_bswap(0x00000000) == 0x00000000 ? 1 : -1];
37 char bswap_1[_bswap(0x10203040) == 0x40302010 ? 1 : -1];
39 char bswapq_0[__bswapq(0x0000000000000000ULL) == 0x0000000000000000 ? 1 : -1];
40 char bswapq_1[__bswapq(0x0102030405060708ULL) == 0x0807060504030201 ? 1 : -1];
42 char bswap64_0[_bswap64(0x0000000000000000ULL) == 0x0000000000000000 ? 1 : -1];
43 char bswap64_1[_bswap64(0x1020304050607080ULL) == 0x8070605040302010 ? 1 : -1];
45 #endif