1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -O3 | FileCheck -check-prefix=CHECK -check-prefix=CHECK-LP64 %s
2 // RUN: %clang_cc1 %s -triple=i386-apple-darwin10 -emit-llvm -o - -O3 | FileCheck %s
3 // RUN: %clang_cc1 %s -triple=aarch64_be -emit-llvm -o - -O3 | FileCheck %s
4 // RUN: %clang_cc1 %s -triple=thumbv7_be-none-eabi -emit-llvm -o - -O3 | FileCheck %s
5 // RUN: %clang_cc1 %s -triple=x86_64-unknown-unknown -emit-llvm -o - -O3 -std=c++11 | FileCheck -check-prefix=CHECK -check-prefix=CHECK-LP64 %s
7 // CHECK-LP64: %union.Test1 = type { i32, [4 x i8] }
14 // CHECK-LP64: %union.Test2 = type { i8 }
19 // CHECK-LP64: %union.Test3 = type { i16 }
24 // CHECK: %union.Test4 = type { i8, i8 }
30 #define CHECK(x) if (!(x)) return __LINE__
32 // CHECK: define{{.*}} i32 @_Z11test_assignv()
37 unsigned long long b
: 65;
43 c
.b
= (unsigned long long)-1;
47 CHECK(c
.b
== (unsigned long long)-1);
63 // CHECK: define{{.*}} i32 @_Z9test_initv()
68 unsigned long long b
: 65;
75 CHECK(s1
.b
== (unsigned long long)42);
90 int test_trunc_int() {
92 int i
: 4; // truncated to 0b1111 == -1
93 } const U
= {15}; // 0b00001111
96 // CHECK: define{{.*}} i32 @test_trunc_int()
99 int test_trunc_three_bits() {
101 int i
: 3; // truncated to 0b111 == -1
102 } const U
= {15}; // 0b00001111
105 // CHECK: define{{.*}} i32 @test_trunc_three_bits()
108 int test_trunc_one_bit() {
110 int i
: 1; // truncated to 0b1 == -1
111 } const U
= {1}; // 0b00000001
114 // CHECK: define{{.*}} i32 @test_trunc_one_bit()
119 int i
: 1; // truncated to 0b1 == -1
120 } const U
= {15}; // 0b00001111
123 // CHECK: define{{.*}} i32 @test_trunc_1()
126 int test_trunc_zero() {
128 int i
: 4; // truncated to 0b0000 == 0
129 } const U
= {80}; // 0b01010000
132 // CHECK: define{{.*}} i32 @test_trunc_zero()
135 int test_constexpr() {
137 int i
: 3; // truncated to 0b111 == -1
138 } const U
= {1 + 2 + 4 + 8}; // 0b00001111
141 // CHECK: define{{.*}} i32 @test_constexpr()
146 int i
: 12; // not truncated
147 } const U
= {1 + 2 + 4 + 8}; // 0b00001111
150 // CHECK: define{{.*}} i32 @test_notrunc()
153 long long test_trunc_long_long() {
155 long long i
: 14; // truncated to 0b00111101001101 ==
156 } const U
= {0b0100111101001101};
159 // CHECK: define{{.*}} i64 @test_trunc_long_long()
160 // CHECK: ret i64 3917