Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / mms-bitfields.c
blob2ccce326c7131d8666a70fceea94d00ed4b4b06b
1 // RUN: %clang_cc1 -triple i386-apple-darwin10 -mms-bitfields -emit-llvm %s -o - | FileCheck %s
3 struct s1 {
4 int f32;
5 long long f64;
6 } s1;
8 // CHECK: %struct.s1 = type { i32, [4 x i8], i64 }
10 struct s2 {
11 int f32;
12 long long f64[4];
13 } s2;
15 // CHECK: %struct.s2 = type { i32, [4 x i8], [4 x i64] }
17 struct s3 {
18 int f32;
19 struct s1 s;
20 } s3;
22 // CHECK: %struct.s3 = type { i32, [4 x i8], %struct.s1 }
24 // PR32482:
26 #pragma pack (push,1)
28 typedef unsigned int UINT32;
30 struct Inner {
31 UINT32 A : 1;
32 UINT32 B : 1;
33 UINT32 C : 1;
34 UINT32 D : 30;
35 } Inner;
37 #pragma pack (pop)
39 // CHECK: %struct.Inner = type { i32, i32 }
41 // CHECK: %struct.A = type { i32, i32, i32 }
43 #pragma pack(push, 1)
45 union HEADER {
46 struct A {
47 int : 3; // Bits 2:0
48 int a : 9; // Bits 11:3
49 int : 12; // Bits 23:12
50 int b : 17; // Bits 40:24
51 int : 7; // Bits 47:41
52 int c : 4; // Bits 51:48
53 int : 4; // Bits 55:52
54 int d : 3; // Bits 58:56
55 int : 5; // Bits 63:59
56 } Bits;
57 } HEADER;
59 #pragma pack(pop)
61 struct Inner variable = { 1,0,1, 21 };
62 union HEADER hdr = {{1,2,3,4}};
64 // CHECK: @variable ={{.*}} global { i8, [3 x i8], i8, i8, i8, i8 } { i8 5, [3 x i8] zeroinitializer, i8 21, i8 0, i8 0, i8 0 }, align 1
65 // CHECK: @hdr ={{.*}} global { { i8, i8, [2 x i8], i8, i8, i8, i8, i8, [3 x i8] } } { { i8, i8, [2 x i8], i8, i8, i8, i8, i8, [3 x i8] } { i8 8, i8 0, [2 x i8] zeroinitializer, i8 2, i8 0, i8 0, i8 3, i8 4, [3 x i8] zeroinitializer } }, align 1