Anders Carlsson | 6ba3815 | 2010-04-17 22:54:57 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -O3 | FileCheck -check-prefix LP64 %s |
| 2 | // RUN: %clang_cc1 %s -triple=i386-apple-darwin10 -emit-llvm -o - -O3 | FileCheck -check-prefix LP32 %s |
Anders Carlsson | de9f153 | 2010-04-17 20:21:41 +0000 | [diff] [blame] | 3 | |
Anders Carlsson | 6ba3815 | 2010-04-17 22:54:57 +0000 | [diff] [blame] | 4 | // CHECK-LP64: %union.Test1 = type { i32, [4 x i8] } |
Anders Carlsson | de9f153 | 2010-04-17 20:21:41 +0000 | [diff] [blame] | 5 | union Test1 { |
| 6 | int a; |
| 7 | int b: 39; |
Anders Carlsson | d62328e | 2010-04-17 21:04:52 +0000 | [diff] [blame] | 8 | } t1; |
Anders Carlsson | de9f153 | 2010-04-17 20:21:41 +0000 | [diff] [blame] | 9 | |
Anders Carlsson | 6ba3815 | 2010-04-17 22:54:57 +0000 | [diff] [blame] | 10 | // CHECK-LP64: %union.Test2 = type { i8 } |
Anders Carlsson | d62328e | 2010-04-17 21:04:52 +0000 | [diff] [blame] | 11 | union Test2 { |
| 12 | int : 6; |
| 13 | } t2; |
| 14 | |
Anders Carlsson | 6ba3815 | 2010-04-17 22:54:57 +0000 | [diff] [blame] | 15 | // CHECK-LP64: %union.Test3 = type { [2 x i8] } |
Anders Carlsson | d62328e | 2010-04-17 21:04:52 +0000 | [diff] [blame] | 16 | union Test3 { |
| 17 | int : 9; |
| 18 | } t3; |
Anders Carlsson | 6ba3815 | 2010-04-17 22:54:57 +0000 | [diff] [blame] | 19 | |
| 20 | |
| 21 | #define CHECK(x) if (!(x)) return __LINE__ |
| 22 | |
| 23 | int f() { |
| 24 | struct { |
| 25 | int a; |
| 26 | |
| 27 | unsigned long long b : 65; |
| 28 | |
| 29 | int c; |
| 30 | } c; |
| 31 | |
| 32 | c.a = 0; |
| 33 | c.b = (unsigned long long)-1; |
| 34 | c.c = 0; |
| 35 | |
| 36 | CHECK(c.a == 0); |
| 37 | CHECK(c.b == (unsigned long long)-1); |
| 38 | CHECK(c.c == 0); |
| 39 | |
| 40 | // CHECK-LP64: ret i32 0 |
| 41 | // CHECK-LP32: ret i32 0 |
| 42 | return 0; |
| 43 | } |