@@ -12,9 +12,11 @@ void foo(int x) {
12
12
A a = {.x = x };
13
13
}
14
14
15
- // CHECK: ![[anon:.*]] = !cir.struct<struct {!s32i}>
16
- // CHECK: #[[bfi_x:.*]] = #cir.bitfield_info<name = "x", storage_type = !u32i, size = 16, offset = 0, is_signed = true>
17
- // CHECK: #[[bfi_y:.*]] = #cir.bitfield_info<name = "y", storage_type = !u32i, size = 16, offset = 16, is_signed = true>
15
+ // CHECK-DAG: ![[anon0:.*]] = !cir.struct<struct {!u32i}>
16
+ // CHECK-DAG: ![[anon:.*]] = !cir.struct<struct {!s32i}>
17
+ // CHECK-DAG: #[[bfi_x:.*]] = #cir.bitfield_info<name = "x", storage_type = !u32i, size = 16, offset = 0, is_signed = true>
18
+ // CHECK-DAG: #[[bfi_y:.*]] = #cir.bitfield_info<name = "y", storage_type = !u32i, size = 16, offset = 16, is_signed = true>
19
+ // CHECK-DAG: ![[anon1:.*]] = !cir.struct<union "{{.*}}" {!u32i, !cir.array<!u8i x 4>}
18
20
19
21
// CHECK-LABEL: cir.func @foo(
20
22
// CHECK: %[[VAL_1:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", init] {alignment = 4 : i64}
@@ -30,4 +32,17 @@ void foo(int x) {
30
32
// CHECK: cir.return
31
33
32
34
union { int i ; float f ; } u = { };
33
- // CHECK: cir.global external @u = #cir.zero : ![[anon]]
35
+ // CHECK: cir.global external @u = #cir.zero : ![[anon]]
36
+
37
+ unsigned is_little (void ) {
38
+ const union {
39
+ unsigned int u ;
40
+ unsigned char c [4 ];
41
+ } one = {1 };
42
+ return one .c [0 ];
43
+ }
44
+
45
+ // CHECK: cir.func @is_little
46
+ // CHECK: %[[VAL_1:.*]] = cir.get_global @is_little.one : !cir.ptr<![[anon0]]>
47
+ // CHECK: %[[VAL_2:.*]] = cir.cast(bitcast, %[[VAL_1]] : !cir.ptr<![[anon0]]>), !cir.ptr<![[anon1]]>
48
+ // CHECK: %[[VAL_3:.*]] = cir.get_member %[[VAL_2]][1] {name = "c"} : !cir.ptr<![[anon1]]> -> !cir.ptr<!cir.array<!u8i x 4>>
0 commit comments