| 1 |
// Check arches with 32bit ints. (Not you, AVR & MSP430) |
| 2 |
|
| 3 |
// Configs that have cheap unaligned access |
| 4 |
|
| 5 |
// 64-bit Little Endian |
| 6 |
// RUN: %clang_cc1 -triple=aarch64-apple-darwin %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX64,CHECK-64,LAYOUT-64-DWN %s |
| 7 |
// RUN: %clang_cc1 -triple=aarch64-linux-gnu %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX64,CHECK-64,LAYOUT-64,LAYOUT-64-FLEX %s |
| 8 |
// RUN: %clang_cc1 -triple=loongarch64-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX64,CHECK-64,LAYOUT-64,LAYOUT-64-FLEX %s |
| 9 |
// RUN: %clang_cc1 -triple=ve-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX64 %s |
| 10 |
// RUN: %clang_cc1 -triple=wasm64 %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX64 %s |
| 11 |
// RUN: %clang_cc1 -triple=x86_64-linux-gnu %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX64,CHECK-64,LAYOUT-64,LAYOUT-64-FLEX %s |
| 12 |
|
| 13 |
// 64-bit Big Endian |
| 14 |
// RUN: %clang_cc1 -triple=powerpc64-linux-gnu %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX64,CHECK-64,LAYOUT-64,LAYOUT-64-FLEX %s |
| 15 |
// RUN: %clang_cc1 -triple=systemz %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX64,CHECK-64,LAYOUT-64,LAYOUT-64-FLEX %s |
| 16 |
|
| 17 |
// 32-bit Little Endian |
| 18 |
// RUN: %clang_cc1 -triple=arm-apple-darwin %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT-DWN32,LAYOUT-DWN32-FLEX %s |
| 19 |
// RUN: %clang_cc1 -triple=arm-none-eabi %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX32 %s |
| 20 |
// RUN: %clang_cc1 -triple=i686-linux-gnu %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX32 %s |
| 21 |
// RUN: %clang_cc1 -triple=powerpcle-linux-gnu %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX32 %s |
| 22 |
// RUN: %clang_cc1 -triple=wasm32 %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX32 %s |
| 23 |
|
| 24 |
// 32-bit Big Endian |
| 25 |
// RUN: %clang_cc1 -triple=powerpc-linux-gnu %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-FLEX,LAYOUT-FLEX32 %s |
| 26 |
|
| 27 |
// Configs that have expensive unaligned access |
| 28 |
// 64-bit Little Endian |
| 29 |
// RUN: %clang_cc1 -triple=aarch64-linux-gnu %s -target-feature +strict-align -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT,CHECK-64,LAYOUT-64,LAYOUT-64-STRICT %s |
| 30 |
// RUN: %clang_cc1 -triple=amdgcn-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT,CHECK-64,LAYOUT-64,LAYOUT-64-STRICT %s |
| 31 |
// RUN: %clang_cc1 -triple=loongarch64-elf -target-feature -ual %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT,CHECK-64,LAYOUT-64,LAYOUT-64-STRICT %s |
| 32 |
// RUN: %clang_cc1 -triple=riscv64 %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT,CHECK-64,LAYOUT-64,LAYOUT-64-STRICT %s |
| 33 |
|
| 34 |
// 64-big Big endian |
| 35 |
// RUN: %clang_cc1 -triple=mips64-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT,CHECK-64,LAYOUT-64,LAYOUT-64-STRICT %s |
| 36 |
|
| 37 |
// 32-bit Little Endian |
| 38 |
// RUN: %clang_cc1 -triple=arc-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 39 |
// RUN: %clang_cc1 -triple=arm-apple-darwin %s -target-feature +strict-align -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT-DWN32,LAYOUT-DWN32-STRICT %s |
| 40 |
// RUN: %clang_cc1 -triple=arm-none-eabi %s -target-feature +strict-align -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 41 |
// RUN: %clang_cc1 -triple=bpf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 42 |
// RUN: %clang_cc1 -triple=csky %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 43 |
// RUN: %clang_cc1 -triple=hexagon-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 44 |
// RUN: %clang_cc1 -triple=loongarch32-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 45 |
// RUN: %clang_cc1 -triple=nvptx-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 46 |
// RUN: %clang_cc1 -triple=riscv32 %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 47 |
// RUN: %clang_cc1 -triple=spir-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 48 |
// RUN: %clang_cc1 -triple=xcore-none-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 49 |
|
| 50 |
// 32-bit Big Endian |
| 51 |
// RUN: %clang_cc1 -triple=lanai-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 52 |
// RUN: %clang_cc1 -triple=mips-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 53 |
// RUN: %clang_cc1 -triple=sparc-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 54 |
// RUN: %clang_cc1 -triple=tce-elf %s -emit-llvm -o /dev/null -fdump-record-layouts-simple | FileCheck --check-prefixes CHECK,LAYOUT,LAYOUT-STRICT %s |
| 55 |
|
| 56 |
// m68-elf is a strict alignment ISA with 4-byte aligned 64-bit or 2-byte |
| 57 |
// aligned 32-bit integer types. This more compex to describe here. |
| 58 |
|
| 59 |
// If unaligned access is expensive don't stick these together. |
| 60 |
struct A { |
| 61 |
char a : 7; |
| 62 |
char b : 7; |
| 63 |
} a; |
| 64 |
// CHECK-LABEL: LLVMType:%struct.A = |
| 65 |
// LAYOUT-FLEX-SAME: type { i16 } |
| 66 |
// LAYOUT-STRICT-SAME: type { i8, i8 } |
| 67 |
// LAYOUT-DWN32-SAME: type { i16 } |
| 68 |
// CHECK: BitFields:[ |
| 69 |
// LAYOUT-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:0 |
| 70 |
// LAYOUT-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:0 |
| 71 |
|
| 72 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:8 StorageOffset:0 |
| 73 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:8 StorageOffset:1 |
| 74 |
|
| 75 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:0 |
| 76 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:0 |
| 77 |
// CHECK-NEXT: ]> |
| 78 |
|
| 79 |
// But do here. |
| 80 |
struct __attribute__((aligned(2))) B { |
| 81 |
char a : 7; |
| 82 |
char b : 7; |
| 83 |
} b; |
| 84 |
// CHECK-LABEL: LLVMType:%struct.B = |
| 85 |
// LAYOUT-SAME: type { i16 } |
| 86 |
// LAYOUT-DWN32-SAME: type { i16 } |
| 87 |
// CHECK: BitFields:[ |
| 88 |
// LAYOUT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:0 |
| 89 |
// LAYOUT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:0 |
| 90 |
|
| 91 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:0 |
| 92 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:0 |
| 93 |
// CHECK-NEXT: ]> |
| 94 |
|
| 95 |
// Not here -- poor alignment within struct |
| 96 |
struct C { |
| 97 |
int f1; |
| 98 |
char f2; |
| 99 |
char a : 7; |
| 100 |
char b : 7; |
| 101 |
} c; |
| 102 |
// CHECK-LABEL: LLVMType:%struct.C = |
| 103 |
// LAYOUT-FLEX-SAME: type <{ i32, i8, i16, i8 }> |
| 104 |
// LAYOUT-STRICT-SAME: type { i32, i8, i8, i8 } |
| 105 |
// LAYOUT-DWN32-SAME: type <{ i32, i8, i16, i8 }> |
| 106 |
// CHECK: BitFields:[ |
| 107 |
// LAYOUT-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:5 |
| 108 |
// LAYOUT-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:5 |
| 109 |
|
| 110 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:8 StorageOffset:5 |
| 111 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:8 StorageOffset:6 |
| 112 |
|
| 113 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:5 |
| 114 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:16 StorageOffset:5 |
| 115 |
// CHECK-NEXT: ]> |
| 116 |
|
| 117 |
// Not here, we're packed |
| 118 |
struct __attribute__((packed)) D { |
| 119 |
int f1; |
| 120 |
int a : 8; |
| 121 |
int b : 8; |
| 122 |
char _; |
| 123 |
} d; |
| 124 |
// CHECK-LABEL: LLVMType:%struct.D = |
| 125 |
// LAYOUT-FLEX-SAME: type <{ i32, i16, i8 }> |
| 126 |
// LAYOUT-STRICT-SAME: type <{ i32, i8, i8, i8 }> |
| 127 |
// LAYOUT-DWN32-FLEX-SAME: type <{ i32, i16, i8 }> |
| 128 |
// LAYOUT-DWN32-STRICT-SAME: type <{ i32, i8, i8, i8 }> |
| 129 |
// CHECK: BitFields:[ |
| 130 |
// LAYOUT-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:16 StorageOffset:4 |
| 131 |
// LAYOUT-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:16 StorageOffset:4 |
| 132 |
|
| 133 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:8 StorageOffset:4 |
| 134 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:8 StorageOffset:5 |
| 135 |
|
| 136 |
// LAYOUT-DWN32-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:16 StorageOffset:4 |
| 137 |
// LAYOUT-DWN32-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:16 StorageOffset:4 |
| 138 |
// LAYOUT-DWN32-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:8 StorageOffset:4 |
| 139 |
// LAYOUT-DWN32-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:8 StorageOffset:5 |
| 140 |
// CHECK-NEXT: ]> |
| 141 |
|
| 142 |
struct E { |
| 143 |
char a : 7; |
| 144 |
short b : 13; |
| 145 |
unsigned c : 12; |
| 146 |
} e; |
| 147 |
// CHECK-LABEL: LLVMType:%struct.E = |
| 148 |
// LAYOUT-FLEX64-SAME: type { i64 } |
| 149 |
// LAYOUT-FLEX32-SAME: type { i32, i16 } |
| 150 |
// LAYOUT-STRICT-SAME: type { i32, i16 } |
| 151 |
// LAYOUT-DWN32-SAME: type { i32 } |
| 152 |
// CHECK: BitFields:[ |
| 153 |
// LAYOUT-FLEX64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 154 |
// LAYOUT-FLEX64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:13 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 155 |
// LAYOUT-FLEX64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:12 IsSigned:0 StorageSize:64 StorageOffset:0 |
| 156 |
|
| 157 |
// LAYOUT-FLEX32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 158 |
// LAYOUT-FLEX32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:13 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 159 |
// LAYOUT-FLEX32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:12 IsSigned:0 StorageSize:16 StorageOffset:4 |
| 160 |
|
| 161 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 162 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:13 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 163 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:12 IsSigned:0 StorageSize:16 StorageOffset:4 |
| 164 |
|
| 165 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 166 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:13 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 167 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:12 IsSigned:0 StorageSize:32 StorageOffset:0 |
| 168 |
// CHECK-NEXT: ]> |
| 169 |
|
| 170 |
struct F { |
| 171 |
char a : 7; |
| 172 |
short b : 13; |
| 173 |
unsigned c : 12; |
| 174 |
signed char d : 7; |
| 175 |
} f; |
| 176 |
// CHECK-LABEL: LLVMType:%struct.F = |
| 177 |
// LAYOUT-FLEX64-SAME: type { i64 } |
| 178 |
// LAYOUT-FLEX32-SAME: type { i32, i32 } |
| 179 |
// LAYOUT-STRICT-SAME: type { i32, i32 } |
| 180 |
// LAYOUT-DWN32-SAME: type <{ i32, i8 }> |
| 181 |
// CHECK: BitFields:[ |
| 182 |
// LAYOUT-FLEX64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 183 |
// LAYOUT-FLEX64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:13 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 184 |
// LAYOUT-FLEX64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:12 IsSigned:0 StorageSize:64 StorageOffset:0 |
| 185 |
// LAYOUT-FLEX64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 186 |
|
| 187 |
// LAYOUT-FLEX32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 188 |
// LAYOUT-FLEX32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:13 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 189 |
// LAYOUT-FLEX32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:12 IsSigned:0 StorageSize:32 StorageOffset:4 |
| 190 |
// LAYOUT-FLEX32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:32 StorageOffset:4 |
| 191 |
|
| 192 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 193 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:13 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 194 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:12 IsSigned:0 StorageSize:32 StorageOffset:4 |
| 195 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:32 StorageOffset:4 |
| 196 |
|
| 197 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 198 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:13 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 199 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:12 IsSigned:0 StorageSize:32 StorageOffset:0 |
| 200 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:8 StorageOffset:4 |
| 201 |
// CHECK-NEXT: ]> |
| 202 |
|
| 203 |
struct G { |
| 204 |
char a : 7; |
| 205 |
short b : 13; |
| 206 |
unsigned c : 12; |
| 207 |
signed char d : 7; |
| 208 |
signed char e; |
| 209 |
} g; |
| 210 |
// CHECK-LABEL: LLVMType:%struct.G = |
| 211 |
// LAYOUT-SAME: type { i32, i16, i8, i8 } |
| 212 |
// LAYOUT-DWN32-SAME: type <{ i32, i8, i8 }> |
| 213 |
// CHECK: BitFields:[ |
| 214 |
// LAYOUT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 215 |
// LAYOUT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:13 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 216 |
// LAYOUT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:12 IsSigned:0 StorageSize:16 StorageOffset:4 |
| 217 |
// LAYOUT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:8 StorageOffset:6 |
| 218 |
|
| 219 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 220 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:13 IsSigned:1 StorageSize:32 StorageOffset:0 |
| 221 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:12 IsSigned:0 StorageSize:32 StorageOffset:0 |
| 222 |
// LAYOUT-DWN32-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:8 StorageOffset:4 |
| 223 |
// CHECK-NEXT: ]> |
| 224 |
|
| 225 |
struct __attribute__((aligned(8))) H { |
| 226 |
char a; |
| 227 |
unsigned b : 24; // on expensive alignment we want this to stay 24 |
| 228 |
unsigned c __attribute__((aligned(8))); // Think 'long long' or lp64 ptr |
| 229 |
} h; |
| 230 |
// CHECK-LABEL: LLVMType:%struct.H = |
| 231 |
// LAYOUT-FLEX-SAME: type <{ i8, i32, [3 x i8], i32, [4 x i8] }> |
| 232 |
// LAYOUT-STRICT-SAME: type { i8, [3 x i8], [4 x i8], i32, [4 x i8] } |
| 233 |
// LAYOUT-DWN32-FLEX-SAME: type <{ i8, i32, [3 x i8], i32, [4 x i8] }> |
| 234 |
// LAYOUT-DWN32-STRICT-SAME: type { i8, [3 x i8], [4 x i8], i32, [4 x i8] } |
| 235 |
// CHECK: BitFields:[ |
| 236 |
// LAYOUT-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:24 IsSigned:0 StorageSize:32 StorageOffset:1 |
| 237 |
// LAYOUT-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:24 IsSigned:0 StorageSize:24 StorageOffset:1 |
| 238 |
|
| 239 |
// LAYOUT-DWN32-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:24 IsSigned:0 StorageSize:32 StorageOffset:1 |
| 240 |
// LAYOUT-DWN32-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:24 IsSigned:0 StorageSize:24 StorageOffset:1 |
| 241 |
// CHECK-NEXT: ]> |
| 242 |
|
| 243 |
#if _LP64 |
| 244 |
struct A64 { |
| 245 |
int a : 16; |
| 246 |
short b : 8; |
| 247 |
long c : 16; |
| 248 |
int d : 16; |
| 249 |
signed char e : 8; |
| 250 |
} a64; |
| 251 |
// CHECK-64-LABEL: LLVMType:%struct.A64 = |
| 252 |
// LAYOUT-64-SAME: type { i64 } |
| 253 |
// LAYOUT-64-DWN-SAME: type { i64 } |
| 254 |
// CHECK-64: BitFields:[ |
| 255 |
// LAYOUT-64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 256 |
// LAYOUT-64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 257 |
// LAYOUT-64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 258 |
// LAYOUT-64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 259 |
// LAYOUT-64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 260 |
|
| 261 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 262 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 263 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 264 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 265 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 266 |
// CHECK-64-NEXT: ]> |
| 267 |
|
| 268 |
struct B64 { |
| 269 |
int a : 16; |
| 270 |
short b : 8; |
| 271 |
long c : 16; |
| 272 |
int d : 16; |
| 273 |
signed char e; // not a bitfield |
| 274 |
} b64; |
| 275 |
// CHECK-64-LABEL: LLVMType:%struct.B64 = |
| 276 |
// LAYOUT-64-FLEX-SAME: type <{ i16, i8, i32, i8 }> |
| 277 |
// LAYOUT-64-STRICT-SAME: type <{ i16, i8, i16, i16, i8 }> |
| 278 |
// LAYOUT-64-DWN-SAME: type <{ i16, i8, i32, i8 }> |
| 279 |
// CHECK-64: BitFields:[ |
| 280 |
// LAYOUT-64-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:16 StorageOffset:0 |
| 281 |
// LAYOUT-64-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:8 StorageOffset:2 |
| 282 |
// LAYOUT-64-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:32 StorageOffset:3 |
| 283 |
// LAYOUT-64-FLEX-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:32 StorageOffset:3 |
| 284 |
|
| 285 |
// LAYOUT-64-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:16 StorageOffset:0 |
| 286 |
// LAYOUT-64-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:8 StorageOffset:2 |
| 287 |
// LAYOUT-64-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:16 StorageOffset:3 |
| 288 |
// LAYOUT-64-STRICT-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:16 StorageOffset:5 |
| 289 |
|
| 290 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:16 StorageOffset:0 |
| 291 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:8 StorageOffset:2 |
| 292 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:32 StorageOffset:3 |
| 293 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:32 StorageOffset:3 |
| 294 |
// CHECK-64-NEXT: ]> |
| 295 |
|
| 296 |
struct C64 { |
| 297 |
int a : 15; |
| 298 |
short b : 8; |
| 299 |
long c : 16; |
| 300 |
int d : 15; |
| 301 |
signed char e : 7; |
| 302 |
} c64; |
| 303 |
// CHECK-64-LABEL: LLVMType:%struct.C64 = |
| 304 |
// LAYOUT-64-SAME: type { i64 } |
| 305 |
// LAYOUT-64-DWN-SAME: type { i64 } |
| 306 |
// CHECK-64: BitFields:[ |
| 307 |
// LAYOUT-64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:15 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 308 |
// LAYOUT-64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 309 |
// LAYOUT-64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 310 |
// LAYOUT-64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:15 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 311 |
// LAYOUT-64-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 312 |
|
| 313 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:15 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 314 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:8 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 315 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:16 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 316 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:15 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 317 |
// LAYOUT-64-DWN-NEXT: <CGBitFieldInfo Offset:{{[0-9]+}} Size:7 IsSigned:1 StorageSize:64 StorageOffset:0 |
| 318 |
// CHECK-64-NEXT: ]> |
| 319 |
|
| 320 |
#endif |