[RISCV] Rename a lambda to have plural nouns to reflect that it contains a loop. NFC
[llvm-project.git] / clang / test / CodeGen / aapcs-bitfield.c
blobe195267761ef9f068d17f66fc2f30da5387fc990
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple armv8-none-linux-eabi -fno-aapcs-bitfield-width -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s -check-prefix=LE
3 // RUN: %clang_cc1 -triple armebv8-none-linux-eabi -fno-aapcs-bitfield-width -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s -check-prefix=BE
5 // RUN: %clang_cc1 -triple armv8-none-linux-eabi -faapcs-bitfield-load -fno-aapcs-bitfield-width -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s -check-prefixes=LENUMLOADS
6 // RUN: %clang_cc1 -triple armebv8-none-linux-eabi -faapcs-bitfield-load -fno-aapcs-bitfield-width -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s -check-prefixes=BENUMLOADS
8 // RUN: %clang_cc1 -triple armv8-none-linux-eabi -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s -check-prefix=LEWIDTH
9 // RUN: %clang_cc1 -triple armebv8-none-linux-eabi -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s -check-prefix=BEWIDTH
11 // RUN: %clang_cc1 -triple armv8-none-linux-eabi -faapcs-bitfield-load -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s -check-prefixes=LEWIDTHNUM
12 // RUN: %clang_cc1 -triple armebv8-none-linux-eabi -faapcs-bitfield-load -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s -check-prefixes=BEWIDTHNUM
14 struct st0 {
15 short c : 7;
18 // LE-LABEL: @st0_check_load(
19 // LE-NEXT: entry:
20 // LE-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
21 // LE-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 1
22 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 1
23 // LE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
24 // LE-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
25 // LE-NEXT: ret i32 [[CONV]]
27 // BE-LABEL: @st0_check_load(
28 // BE-NEXT: entry:
29 // BE-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
30 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 1
31 // BE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
32 // BE-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
33 // BE-NEXT: ret i32 [[CONV]]
35 // LENUMLOADS-LABEL: @st0_check_load(
36 // LENUMLOADS-NEXT: entry:
37 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
38 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 1
39 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 1
40 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
41 // LENUMLOADS-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
42 // LENUMLOADS-NEXT: ret i32 [[CONV]]
44 // BENUMLOADS-LABEL: @st0_check_load(
45 // BENUMLOADS-NEXT: entry:
46 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
47 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 1
48 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
49 // BENUMLOADS-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
50 // BENUMLOADS-NEXT: ret i32 [[CONV]]
52 // LEWIDTH-LABEL: @st0_check_load(
53 // LEWIDTH-NEXT: entry:
54 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
55 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 1
56 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 1
57 // LEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
58 // LEWIDTH-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
59 // LEWIDTH-NEXT: ret i32 [[CONV]]
61 // BEWIDTH-LABEL: @st0_check_load(
62 // BEWIDTH-NEXT: entry:
63 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
64 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 1
65 // BEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
66 // BEWIDTH-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
67 // BEWIDTH-NEXT: ret i32 [[CONV]]
69 // LEWIDTHNUM-LABEL: @st0_check_load(
70 // LEWIDTHNUM-NEXT: entry:
71 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
72 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 1
73 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 1
74 // LEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
75 // LEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
76 // LEWIDTHNUM-NEXT: ret i32 [[CONV]]
78 // BEWIDTHNUM-LABEL: @st0_check_load(
79 // BEWIDTHNUM-NEXT: entry:
80 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
81 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 1
82 // BEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
83 // BEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
84 // BEWIDTHNUM-NEXT: ret i32 [[CONV]]
86 int st0_check_load(struct st0 *m) {
87 return m->c;
90 // LE-LABEL: @st0_check_store(
91 // LE-NEXT: entry:
92 // LE-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
93 // LE-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -128
94 // LE-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 1
95 // LE-NEXT: store i8 [[BF_SET]], ptr [[M]], align 2
96 // LE-NEXT: ret void
98 // BE-LABEL: @st0_check_store(
99 // BE-NEXT: entry:
100 // BE-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
101 // BE-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 1
102 // BE-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 2
103 // BE-NEXT: store i8 [[BF_SET]], ptr [[M]], align 2
104 // BE-NEXT: ret void
106 // LENUMLOADS-LABEL: @st0_check_store(
107 // LENUMLOADS-NEXT: entry:
108 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
109 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -128
110 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 1
111 // LENUMLOADS-NEXT: store i8 [[BF_SET]], ptr [[M]], align 2
112 // LENUMLOADS-NEXT: ret void
114 // BENUMLOADS-LABEL: @st0_check_store(
115 // BENUMLOADS-NEXT: entry:
116 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
117 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 1
118 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 2
119 // BENUMLOADS-NEXT: store i8 [[BF_SET]], ptr [[M]], align 2
120 // BENUMLOADS-NEXT: ret void
122 // LEWIDTH-LABEL: @st0_check_store(
123 // LEWIDTH-NEXT: entry:
124 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
125 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -128
126 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 1
127 // LEWIDTH-NEXT: store i8 [[BF_SET]], ptr [[M]], align 2
128 // LEWIDTH-NEXT: ret void
130 // BEWIDTH-LABEL: @st0_check_store(
131 // BEWIDTH-NEXT: entry:
132 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
133 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 1
134 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 2
135 // BEWIDTH-NEXT: store i8 [[BF_SET]], ptr [[M]], align 2
136 // BEWIDTH-NEXT: ret void
138 // LEWIDTHNUM-LABEL: @st0_check_store(
139 // LEWIDTHNUM-NEXT: entry:
140 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
141 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -128
142 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 1
143 // LEWIDTHNUM-NEXT: store i8 [[BF_SET]], ptr [[M]], align 2
144 // LEWIDTHNUM-NEXT: ret void
146 // BEWIDTHNUM-LABEL: @st0_check_store(
147 // BEWIDTHNUM-NEXT: entry:
148 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i8, ptr [[M:%.*]], align 2
149 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 1
150 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 2
151 // BEWIDTHNUM-NEXT: store i8 [[BF_SET]], ptr [[M]], align 2
152 // BEWIDTHNUM-NEXT: ret void
154 void st0_check_store(struct st0 *m) {
155 m->c = 1;
158 struct st1 {
159 int a : 10;
160 short c : 6;
163 // LE-LABEL: @st1_check_load(
164 // LE-NEXT: entry:
165 // LE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
166 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 10
167 // LE-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
168 // LE-NEXT: ret i32 [[CONV]]
170 // BE-LABEL: @st1_check_load(
171 // BE-NEXT: entry:
172 // BE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
173 // BE-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 10
174 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 10
175 // BE-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
176 // BE-NEXT: ret i32 [[CONV]]
178 // LENUMLOADS-LABEL: @st1_check_load(
179 // LENUMLOADS-NEXT: entry:
180 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
181 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 10
182 // LENUMLOADS-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
183 // LENUMLOADS-NEXT: ret i32 [[CONV]]
185 // BENUMLOADS-LABEL: @st1_check_load(
186 // BENUMLOADS-NEXT: entry:
187 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
188 // BENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 10
189 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 10
190 // BENUMLOADS-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
191 // BENUMLOADS-NEXT: ret i32 [[CONV]]
193 // LEWIDTH-LABEL: @st1_check_load(
194 // LEWIDTH-NEXT: entry:
195 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
196 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 10
197 // LEWIDTH-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
198 // LEWIDTH-NEXT: ret i32 [[CONV]]
200 // BEWIDTH-LABEL: @st1_check_load(
201 // BEWIDTH-NEXT: entry:
202 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
203 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 10
204 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 10
205 // BEWIDTH-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
206 // BEWIDTH-NEXT: ret i32 [[CONV]]
208 // LEWIDTHNUM-LABEL: @st1_check_load(
209 // LEWIDTHNUM-NEXT: entry:
210 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
211 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 10
212 // LEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
213 // LEWIDTHNUM-NEXT: ret i32 [[CONV]]
215 // BEWIDTHNUM-LABEL: @st1_check_load(
216 // BEWIDTHNUM-NEXT: entry:
217 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
218 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 10
219 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 10
220 // BEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
221 // BEWIDTHNUM-NEXT: ret i32 [[CONV]]
223 int st1_check_load(struct st1 *m) {
224 return m->c;
227 // LE-LABEL: @st1_check_store(
228 // LE-NEXT: entry:
229 // LE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
230 // LE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 1023
231 // LE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1024
232 // LE-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
233 // LE-NEXT: ret void
235 // BE-LABEL: @st1_check_store(
236 // BE-NEXT: entry:
237 // BE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
238 // BE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -64
239 // BE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
240 // BE-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
241 // BE-NEXT: ret void
243 // LENUMLOADS-LABEL: @st1_check_store(
244 // LENUMLOADS-NEXT: entry:
245 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
246 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 1023
247 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1024
248 // LENUMLOADS-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
249 // LENUMLOADS-NEXT: ret void
251 // BENUMLOADS-LABEL: @st1_check_store(
252 // BENUMLOADS-NEXT: entry:
253 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
254 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -64
255 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
256 // BENUMLOADS-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
257 // BENUMLOADS-NEXT: ret void
259 // LEWIDTH-LABEL: @st1_check_store(
260 // LEWIDTH-NEXT: entry:
261 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
262 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 1023
263 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1024
264 // LEWIDTH-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
265 // LEWIDTH-NEXT: ret void
267 // BEWIDTH-LABEL: @st1_check_store(
268 // BEWIDTH-NEXT: entry:
269 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
270 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -64
271 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
272 // BEWIDTH-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
273 // BEWIDTH-NEXT: ret void
275 // LEWIDTHNUM-LABEL: @st1_check_store(
276 // LEWIDTHNUM-NEXT: entry:
277 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
278 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 1023
279 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1024
280 // LEWIDTHNUM-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
281 // LEWIDTHNUM-NEXT: ret void
283 // BEWIDTHNUM-LABEL: @st1_check_store(
284 // BEWIDTHNUM-NEXT: entry:
285 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
286 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -64
287 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
288 // BEWIDTHNUM-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
289 // BEWIDTHNUM-NEXT: ret void
291 void st1_check_store(struct st1 *m) {
292 m->c = 1;
295 struct st2 {
296 int a : 10;
297 short c : 7;
300 // LE-LABEL: @st2_check_load(
301 // LE-NEXT: entry:
302 // LE-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
303 // LE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 9
304 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 25
305 // LE-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i16
306 // LE-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
307 // LE-NEXT: ret i32 [[CONV]]
309 // BE-LABEL: @st2_check_load(
310 // BE-NEXT: entry:
311 // BE-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
312 // BE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 16
313 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 25
314 // BE-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i16
315 // BE-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
316 // BE-NEXT: ret i32 [[CONV]]
318 // LENUMLOADS-LABEL: @st2_check_load(
319 // LENUMLOADS-NEXT: entry:
320 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
321 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 9
322 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 25
323 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i16
324 // LENUMLOADS-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
325 // LENUMLOADS-NEXT: ret i32 [[CONV]]
327 // BENUMLOADS-LABEL: @st2_check_load(
328 // BENUMLOADS-NEXT: entry:
329 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
330 // BENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 16
331 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 25
332 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i16
333 // BENUMLOADS-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
334 // BENUMLOADS-NEXT: ret i32 [[CONV]]
336 // LEWIDTH-LABEL: @st2_check_load(
337 // LEWIDTH-NEXT: entry:
338 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
339 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 9
340 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 25
341 // LEWIDTH-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i16
342 // LEWIDTH-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
343 // LEWIDTH-NEXT: ret i32 [[CONV]]
345 // BEWIDTH-LABEL: @st2_check_load(
346 // BEWIDTH-NEXT: entry:
347 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
348 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 16
349 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 25
350 // BEWIDTH-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i16
351 // BEWIDTH-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
352 // BEWIDTH-NEXT: ret i32 [[CONV]]
354 // LEWIDTHNUM-LABEL: @st2_check_load(
355 // LEWIDTHNUM-NEXT: entry:
356 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
357 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 9
358 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 25
359 // LEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i16
360 // LEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
361 // LEWIDTHNUM-NEXT: ret i32 [[CONV]]
363 // BEWIDTHNUM-LABEL: @st2_check_load(
364 // BEWIDTHNUM-NEXT: entry:
365 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
366 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 16
367 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 25
368 // BEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i16
369 // BEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
370 // BEWIDTHNUM-NEXT: ret i32 [[CONV]]
372 int st2_check_load(struct st2 *m) {
373 return m->c;
376 // LE-LABEL: @st2_check_store(
377 // LE-NEXT: entry:
378 // LE-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
379 // LE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -8323073
380 // LE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 65536
381 // LE-NEXT: store i32 [[BF_SET]], ptr [[M]], align 4
382 // LE-NEXT: ret void
384 // BE-LABEL: @st2_check_store(
385 // BE-NEXT: entry:
386 // BE-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
387 // BE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -65025
388 // BE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 512
389 // BE-NEXT: store i32 [[BF_SET]], ptr [[M]], align 4
390 // BE-NEXT: ret void
392 // LENUMLOADS-LABEL: @st2_check_store(
393 // LENUMLOADS-NEXT: entry:
394 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
395 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -8323073
396 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 65536
397 // LENUMLOADS-NEXT: store i32 [[BF_SET]], ptr [[M]], align 4
398 // LENUMLOADS-NEXT: ret void
400 // BENUMLOADS-LABEL: @st2_check_store(
401 // BENUMLOADS-NEXT: entry:
402 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
403 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -65025
404 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 512
405 // BENUMLOADS-NEXT: store i32 [[BF_SET]], ptr [[M]], align 4
406 // BENUMLOADS-NEXT: ret void
408 // LEWIDTH-LABEL: @st2_check_store(
409 // LEWIDTH-NEXT: entry:
410 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
411 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -8323073
412 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 65536
413 // LEWIDTH-NEXT: store i32 [[BF_SET]], ptr [[M]], align 4
414 // LEWIDTH-NEXT: ret void
416 // BEWIDTH-LABEL: @st2_check_store(
417 // BEWIDTH-NEXT: entry:
418 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
419 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -65025
420 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 512
421 // BEWIDTH-NEXT: store i32 [[BF_SET]], ptr [[M]], align 4
422 // BEWIDTH-NEXT: ret void
424 // LEWIDTHNUM-LABEL: @st2_check_store(
425 // LEWIDTHNUM-NEXT: entry:
426 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
427 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -8323073
428 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 65536
429 // LEWIDTHNUM-NEXT: store i32 [[BF_SET]], ptr [[M]], align 4
430 // LEWIDTHNUM-NEXT: ret void
432 // BEWIDTHNUM-LABEL: @st2_check_store(
433 // BEWIDTHNUM-NEXT: entry:
434 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[M:%.*]], align 4
435 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -65025
436 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 512
437 // BEWIDTHNUM-NEXT: store i32 [[BF_SET]], ptr [[M]], align 4
438 // BEWIDTHNUM-NEXT: ret void
440 void st2_check_store(struct st2 *m) {
441 m->c = 1;
443 // Volatile access is allowed to use 16 bits
444 struct st3 {
445 volatile short c : 7;
448 // LE-LABEL: @st3_check_load(
449 // LE-NEXT: entry:
450 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 2
451 // LE-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 1
452 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 1
453 // LE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
454 // LE-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
455 // LE-NEXT: ret i32 [[CONV]]
457 // BE-LABEL: @st3_check_load(
458 // BE-NEXT: entry:
459 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 2
460 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 1
461 // BE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
462 // BE-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
463 // BE-NEXT: ret i32 [[CONV]]
465 // LENUMLOADS-LABEL: @st3_check_load(
466 // LENUMLOADS-NEXT: entry:
467 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 2
468 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 1
469 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 1
470 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
471 // LENUMLOADS-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
472 // LENUMLOADS-NEXT: ret i32 [[CONV]]
474 // BENUMLOADS-LABEL: @st3_check_load(
475 // BENUMLOADS-NEXT: entry:
476 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 2
477 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 1
478 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i16
479 // BENUMLOADS-NEXT: [[CONV:%.*]] = sext i16 [[BF_CAST]] to i32
480 // BENUMLOADS-NEXT: ret i32 [[CONV]]
482 // LEWIDTH-LABEL: @st3_check_load(
483 // LEWIDTH-NEXT: entry:
484 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 2
485 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 9
486 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 9
487 // LEWIDTH-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
488 // LEWIDTH-NEXT: ret i32 [[CONV]]
490 // BEWIDTH-LABEL: @st3_check_load(
491 // BEWIDTH-NEXT: entry:
492 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 2
493 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 9
494 // BEWIDTH-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
495 // BEWIDTH-NEXT: ret i32 [[CONV]]
497 // LEWIDTHNUM-LABEL: @st3_check_load(
498 // LEWIDTHNUM-NEXT: entry:
499 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 2
500 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 9
501 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 9
502 // LEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
503 // LEWIDTHNUM-NEXT: ret i32 [[CONV]]
505 // BEWIDTHNUM-LABEL: @st3_check_load(
506 // BEWIDTHNUM-NEXT: entry:
507 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 2
508 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 9
509 // BEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
510 // BEWIDTHNUM-NEXT: ret i32 [[CONV]]
512 int st3_check_load(struct st3 *m) {
513 return m->c;
516 // LE-LABEL: @st3_check_store(
517 // LE-NEXT: entry:
518 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 2
519 // LE-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -128
520 // LE-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 1
521 // LE-NEXT: store volatile i8 [[BF_SET]], ptr [[M]], align 2
522 // LE-NEXT: ret void
524 // BE-LABEL: @st3_check_store(
525 // BE-NEXT: entry:
526 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 2
527 // BE-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 1
528 // BE-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 2
529 // BE-NEXT: store volatile i8 [[BF_SET]], ptr [[M]], align 2
530 // BE-NEXT: ret void
532 // LENUMLOADS-LABEL: @st3_check_store(
533 // LENUMLOADS-NEXT: entry:
534 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 2
535 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -128
536 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 1
537 // LENUMLOADS-NEXT: store volatile i8 [[BF_SET]], ptr [[M]], align 2
538 // LENUMLOADS-NEXT: ret void
540 // BENUMLOADS-LABEL: @st3_check_store(
541 // BENUMLOADS-NEXT: entry:
542 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 2
543 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 1
544 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 2
545 // BENUMLOADS-NEXT: store volatile i8 [[BF_SET]], ptr [[M]], align 2
546 // BENUMLOADS-NEXT: ret void
548 // LEWIDTH-LABEL: @st3_check_store(
549 // LEWIDTH-NEXT: entry:
550 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 2
551 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -128
552 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
553 // LEWIDTH-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 2
554 // LEWIDTH-NEXT: ret void
556 // BEWIDTH-LABEL: @st3_check_store(
557 // BEWIDTH-NEXT: entry:
558 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 2
559 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 511
560 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 512
561 // BEWIDTH-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 2
562 // BEWIDTH-NEXT: ret void
564 // LEWIDTHNUM-LABEL: @st3_check_store(
565 // LEWIDTHNUM-NEXT: entry:
566 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 2
567 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -128
568 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
569 // LEWIDTHNUM-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 2
570 // LEWIDTHNUM-NEXT: ret void
572 // BEWIDTHNUM-LABEL: @st3_check_store(
573 // BEWIDTHNUM-NEXT: entry:
574 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 2
575 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 511
576 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 512
577 // BEWIDTHNUM-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 2
578 // BEWIDTHNUM-NEXT: ret void
580 void st3_check_store(struct st3 *m) {
581 m->c = 1;
583 // Volatile access to st4.c should use a char ld/st
584 struct st4 {
585 int b : 9;
586 volatile char c : 5;
589 // LE-LABEL: @st4_check_load(
590 // LE-NEXT: entry:
591 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
592 // LE-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 2
593 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 11
594 // LE-NEXT: [[BF_CAST:%.*]] = trunc i16 [[BF_ASHR]] to i8
595 // LE-NEXT: [[CONV:%.*]] = sext i8 [[BF_CAST]] to i32
596 // LE-NEXT: ret i32 [[CONV]]
598 // BE-LABEL: @st4_check_load(
599 // BE-NEXT: entry:
600 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
601 // BE-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 9
602 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 11
603 // BE-NEXT: [[BF_CAST:%.*]] = trunc i16 [[BF_ASHR]] to i8
604 // BE-NEXT: [[CONV:%.*]] = sext i8 [[BF_CAST]] to i32
605 // BE-NEXT: ret i32 [[CONV]]
607 // LENUMLOADS-LABEL: @st4_check_load(
608 // LENUMLOADS-NEXT: entry:
609 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
610 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 2
611 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 11
612 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = trunc i16 [[BF_ASHR]] to i8
613 // LENUMLOADS-NEXT: [[CONV:%.*]] = sext i8 [[BF_CAST]] to i32
614 // LENUMLOADS-NEXT: ret i32 [[CONV]]
616 // BENUMLOADS-LABEL: @st4_check_load(
617 // BENUMLOADS-NEXT: entry:
618 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
619 // BENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 9
620 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 11
621 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = trunc i16 [[BF_ASHR]] to i8
622 // BENUMLOADS-NEXT: [[CONV:%.*]] = sext i8 [[BF_CAST]] to i32
623 // BENUMLOADS-NEXT: ret i32 [[CONV]]
625 // LEWIDTH-LABEL: @st4_check_load(
626 // LEWIDTH-NEXT: entry:
627 // LEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 1
628 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 1
629 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 2
630 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 3
631 // LEWIDTH-NEXT: [[CONV:%.*]] = sext i8 [[BF_ASHR]] to i32
632 // LEWIDTH-NEXT: ret i32 [[CONV]]
634 // BEWIDTH-LABEL: @st4_check_load(
635 // BEWIDTH-NEXT: entry:
636 // BEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 1
637 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 1
638 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 1
639 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 3
640 // BEWIDTH-NEXT: [[CONV:%.*]] = sext i8 [[BF_ASHR]] to i32
641 // BEWIDTH-NEXT: ret i32 [[CONV]]
643 // LEWIDTHNUM-LABEL: @st4_check_load(
644 // LEWIDTHNUM-NEXT: entry:
645 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 1
646 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 1
647 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 2
648 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 3
649 // LEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i8 [[BF_ASHR]] to i32
650 // LEWIDTHNUM-NEXT: ret i32 [[CONV]]
652 // BEWIDTHNUM-LABEL: @st4_check_load(
653 // BEWIDTHNUM-NEXT: entry:
654 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 1
655 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 1
656 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 1
657 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 3
658 // BEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i8 [[BF_ASHR]] to i32
659 // BEWIDTHNUM-NEXT: ret i32 [[CONV]]
661 int st4_check_load(struct st4 *m) {
662 return m->c;
665 // LE-LABEL: @st4_check_store(
666 // LE-NEXT: entry:
667 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
668 // LE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -15873
669 // LE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 512
670 // LE-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
671 // LE-NEXT: ret void
673 // BE-LABEL: @st4_check_store(
674 // BE-NEXT: entry:
675 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
676 // BE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -125
677 // BE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 4
678 // BE-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
679 // BE-NEXT: ret void
681 // LENUMLOADS-LABEL: @st4_check_store(
682 // LENUMLOADS-NEXT: entry:
683 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
684 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -15873
685 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 512
686 // LENUMLOADS-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
687 // LENUMLOADS-NEXT: ret void
689 // BENUMLOADS-LABEL: @st4_check_store(
690 // BENUMLOADS-NEXT: entry:
691 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
692 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -125
693 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 4
694 // BENUMLOADS-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
695 // BENUMLOADS-NEXT: ret void
697 // LEWIDTH-LABEL: @st4_check_store(
698 // LEWIDTH-NEXT: entry:
699 // LEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 1
700 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 1
701 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -63
702 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 2
703 // LEWIDTH-NEXT: store volatile i8 [[BF_SET]], ptr [[TMP0]], align 1
704 // LEWIDTH-NEXT: ret void
706 // BEWIDTH-LABEL: @st4_check_store(
707 // BEWIDTH-NEXT: entry:
708 // BEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 1
709 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 1
710 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -125
711 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 4
712 // BEWIDTH-NEXT: store volatile i8 [[BF_SET]], ptr [[TMP0]], align 1
713 // BEWIDTH-NEXT: ret void
715 // LEWIDTHNUM-LABEL: @st4_check_store(
716 // LEWIDTHNUM-NEXT: entry:
717 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 1
718 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 1
719 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -63
720 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 2
721 // LEWIDTHNUM-NEXT: store volatile i8 [[BF_SET]], ptr [[TMP0]], align 1
722 // LEWIDTHNUM-NEXT: ret void
724 // BEWIDTHNUM-LABEL: @st4_check_store(
725 // BEWIDTHNUM-NEXT: entry:
726 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 1
727 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 1
728 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -125
729 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 4
730 // BEWIDTHNUM-NEXT: store volatile i8 [[BF_SET]], ptr [[TMP0]], align 1
731 // BEWIDTHNUM-NEXT: ret void
733 void st4_check_store(struct st4 *m) {
734 m->c = 1;
737 // LE-LABEL: @st4_check_nonv_store(
738 // LE-NEXT: entry:
739 // LE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
740 // LE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -512
741 // LE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
742 // LE-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
743 // LE-NEXT: ret void
745 // BE-LABEL: @st4_check_nonv_store(
746 // BE-NEXT: entry:
747 // BE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
748 // BE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 127
749 // BE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 128
750 // BE-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
751 // BE-NEXT: ret void
753 // LENUMLOADS-LABEL: @st4_check_nonv_store(
754 // LENUMLOADS-NEXT: entry:
755 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
756 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -512
757 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
758 // LENUMLOADS-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
759 // LENUMLOADS-NEXT: ret void
761 // BENUMLOADS-LABEL: @st4_check_nonv_store(
762 // BENUMLOADS-NEXT: entry:
763 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
764 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 127
765 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 128
766 // BENUMLOADS-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
767 // BENUMLOADS-NEXT: ret void
769 // LEWIDTH-LABEL: @st4_check_nonv_store(
770 // LEWIDTH-NEXT: entry:
771 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
772 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -512
773 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
774 // LEWIDTH-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
775 // LEWIDTH-NEXT: ret void
777 // BEWIDTH-LABEL: @st4_check_nonv_store(
778 // BEWIDTH-NEXT: entry:
779 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
780 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 127
781 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 128
782 // BEWIDTH-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
783 // BEWIDTH-NEXT: ret void
785 // LEWIDTHNUM-LABEL: @st4_check_nonv_store(
786 // LEWIDTHNUM-NEXT: entry:
787 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
788 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -512
789 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
790 // LEWIDTHNUM-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
791 // LEWIDTHNUM-NEXT: ret void
793 // BEWIDTHNUM-LABEL: @st4_check_nonv_store(
794 // BEWIDTHNUM-NEXT: entry:
795 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
796 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 127
797 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 128
798 // BEWIDTHNUM-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
799 // BEWIDTHNUM-NEXT: ret void
801 void st4_check_nonv_store(struct st4 *m) {
802 m->b = 1;
805 struct st5 {
806 int a : 12;
807 volatile char c : 5;
810 // LE-LABEL: @st5_check_load(
811 // LE-NEXT: entry:
812 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
813 // LE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 11
814 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 27
815 // LE-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i8
816 // LE-NEXT: [[CONV:%.*]] = sext i8 [[BF_CAST]] to i32
817 // LE-NEXT: ret i32 [[CONV]]
819 // BE-LABEL: @st5_check_load(
820 // BE-NEXT: entry:
821 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
822 // BE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 16
823 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 27
824 // BE-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i8
825 // BE-NEXT: [[CONV:%.*]] = sext i8 [[BF_CAST]] to i32
826 // BE-NEXT: ret i32 [[CONV]]
828 // LENUMLOADS-LABEL: @st5_check_load(
829 // LENUMLOADS-NEXT: entry:
830 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
831 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 11
832 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 27
833 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i8
834 // LENUMLOADS-NEXT: [[CONV:%.*]] = sext i8 [[BF_CAST]] to i32
835 // LENUMLOADS-NEXT: ret i32 [[CONV]]
837 // BENUMLOADS-LABEL: @st5_check_load(
838 // BENUMLOADS-NEXT: entry:
839 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
840 // BENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 16
841 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 27
842 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = trunc i32 [[BF_ASHR]] to i8
843 // BENUMLOADS-NEXT: [[CONV:%.*]] = sext i8 [[BF_CAST]] to i32
844 // BENUMLOADS-NEXT: ret i32 [[CONV]]
846 // LEWIDTH-LABEL: @st5_check_load(
847 // LEWIDTH-NEXT: entry:
848 // LEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 2
849 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 2
850 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 3
851 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 3
852 // LEWIDTH-NEXT: [[CONV:%.*]] = sext i8 [[BF_ASHR]] to i32
853 // LEWIDTH-NEXT: ret i32 [[CONV]]
855 // BEWIDTH-LABEL: @st5_check_load(
856 // BEWIDTH-NEXT: entry:
857 // BEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 2
858 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 2
859 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 3
860 // BEWIDTH-NEXT: [[CONV:%.*]] = sext i8 [[BF_ASHR]] to i32
861 // BEWIDTH-NEXT: ret i32 [[CONV]]
863 // LEWIDTHNUM-LABEL: @st5_check_load(
864 // LEWIDTHNUM-NEXT: entry:
865 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 2
866 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 2
867 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 3
868 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 3
869 // LEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i8 [[BF_ASHR]] to i32
870 // LEWIDTHNUM-NEXT: ret i32 [[CONV]]
872 // BEWIDTHNUM-LABEL: @st5_check_load(
873 // BEWIDTHNUM-NEXT: entry:
874 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 2
875 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 2
876 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 3
877 // BEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i8 [[BF_ASHR]] to i32
878 // BEWIDTHNUM-NEXT: ret i32 [[CONV]]
880 int st5_check_load(struct st5 *m) {
881 return m->c;
884 // LE-LABEL: @st5_check_store(
885 // LE-NEXT: entry:
886 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
887 // LE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -2031617
888 // LE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 65536
889 // LE-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
890 // LE-NEXT: ret void
892 // BE-LABEL: @st5_check_store(
893 // BE-NEXT: entry:
894 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
895 // BE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -63489
896 // BE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 2048
897 // BE-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
898 // BE-NEXT: ret void
900 // LENUMLOADS-LABEL: @st5_check_store(
901 // LENUMLOADS-NEXT: entry:
902 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
903 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -2031617
904 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 65536
905 // LENUMLOADS-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
906 // LENUMLOADS-NEXT: ret void
908 // BENUMLOADS-LABEL: @st5_check_store(
909 // BENUMLOADS-NEXT: entry:
910 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
911 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -63489
912 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 2048
913 // BENUMLOADS-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
914 // BENUMLOADS-NEXT: ret void
916 // LEWIDTH-LABEL: @st5_check_store(
917 // LEWIDTH-NEXT: entry:
918 // LEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 2
919 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 2
920 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -32
921 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 1
922 // LEWIDTH-NEXT: store volatile i8 [[BF_SET]], ptr [[TMP0]], align 2
923 // LEWIDTH-NEXT: ret void
925 // BEWIDTH-LABEL: @st5_check_store(
926 // BEWIDTH-NEXT: entry:
927 // BEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 2
928 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 2
929 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 7
930 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 8
931 // BEWIDTH-NEXT: store volatile i8 [[BF_SET]], ptr [[TMP0]], align 2
932 // BEWIDTH-NEXT: ret void
934 // LEWIDTHNUM-LABEL: @st5_check_store(
935 // LEWIDTHNUM-NEXT: entry:
936 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 2
937 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 2
938 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -32
939 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 1
940 // LEWIDTHNUM-NEXT: store volatile i8 [[BF_SET]], ptr [[TMP0]], align 2
941 // LEWIDTHNUM-NEXT: ret void
943 // BEWIDTHNUM-LABEL: @st5_check_store(
944 // BEWIDTHNUM-NEXT: entry:
945 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[M:%.*]], i32 2
946 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[TMP0]], align 2
947 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 7
948 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 8
949 // BEWIDTHNUM-NEXT: store volatile i8 [[BF_SET]], ptr [[TMP0]], align 2
950 // BEWIDTHNUM-NEXT: ret void
952 void st5_check_store(struct st5 *m) {
953 m->c = 1;
956 struct st6 {
957 int a : 12;
958 char b;
959 int c : 5;
962 // LE-LABEL: @st6_check_load(
963 // LE-NEXT: entry:
964 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
965 // LE-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 4
966 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 4
967 // LE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
968 // LE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
969 // LE-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[B]], align 2
970 // LE-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
971 // LE-NEXT: [[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
972 // LE-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
973 // LE-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
974 // LE-NEXT: [[BF_SHL2:%.*]] = shl i8 [[BF_LOAD1]], 3
975 // LE-NEXT: [[BF_ASHR3:%.*]] = ashr i8 [[BF_SHL2]], 3
976 // LE-NEXT: [[BF_CAST4:%.*]] = sext i8 [[BF_ASHR3]] to i32
977 // LE-NEXT: [[ADD5:%.*]] = add nsw i32 [[ADD]], [[BF_CAST4]]
978 // LE-NEXT: ret i32 [[ADD5]]
980 // BE-LABEL: @st6_check_load(
981 // BE-NEXT: entry:
982 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
983 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 4
984 // BE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
985 // BE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
986 // BE-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[B]], align 2
987 // BE-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
988 // BE-NEXT: [[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
989 // BE-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
990 // BE-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
991 // BE-NEXT: [[BF_ASHR2:%.*]] = ashr i8 [[BF_LOAD1]], 3
992 // BE-NEXT: [[BF_CAST3:%.*]] = sext i8 [[BF_ASHR2]] to i32
993 // BE-NEXT: [[ADD4:%.*]] = add nsw i32 [[ADD]], [[BF_CAST3]]
994 // BE-NEXT: ret i32 [[ADD4]]
996 // LENUMLOADS-LABEL: @st6_check_load(
997 // LENUMLOADS-NEXT: entry:
998 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
999 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 4
1000 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 4
1001 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1002 // LENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1003 // LENUMLOADS-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[B]], align 2
1004 // LENUMLOADS-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1005 // LENUMLOADS-NEXT: [[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
1006 // LENUMLOADS-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1007 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
1008 // LENUMLOADS-NEXT: [[BF_SHL2:%.*]] = shl i8 [[BF_LOAD1]], 3
1009 // LENUMLOADS-NEXT: [[BF_ASHR3:%.*]] = ashr i8 [[BF_SHL2]], 3
1010 // LENUMLOADS-NEXT: [[BF_CAST4:%.*]] = sext i8 [[BF_ASHR3]] to i32
1011 // LENUMLOADS-NEXT: [[ADD5:%.*]] = add nsw i32 [[ADD]], [[BF_CAST4]]
1012 // LENUMLOADS-NEXT: ret i32 [[ADD5]]
1014 // BENUMLOADS-LABEL: @st6_check_load(
1015 // BENUMLOADS-NEXT: entry:
1016 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1017 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 4
1018 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1019 // BENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1020 // BENUMLOADS-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[B]], align 2
1021 // BENUMLOADS-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1022 // BENUMLOADS-NEXT: [[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
1023 // BENUMLOADS-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1024 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
1025 // BENUMLOADS-NEXT: [[BF_ASHR2:%.*]] = ashr i8 [[BF_LOAD1]], 3
1026 // BENUMLOADS-NEXT: [[BF_CAST3:%.*]] = sext i8 [[BF_ASHR2]] to i32
1027 // BENUMLOADS-NEXT: [[ADD4:%.*]] = add nsw i32 [[ADD]], [[BF_CAST3]]
1028 // BENUMLOADS-NEXT: ret i32 [[ADD4]]
1030 // LEWIDTH-LABEL: @st6_check_load(
1031 // LEWIDTH-NEXT: entry:
1032 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1033 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 4
1034 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 4
1035 // LEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1036 // LEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1037 // LEWIDTH-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[B]], align 2
1038 // LEWIDTH-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1039 // LEWIDTH-NEXT: [[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
1040 // LEWIDTH-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1041 // LEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
1042 // LEWIDTH-NEXT: [[BF_SHL2:%.*]] = shl i8 [[BF_LOAD1]], 3
1043 // LEWIDTH-NEXT: [[BF_ASHR3:%.*]] = ashr i8 [[BF_SHL2]], 3
1044 // LEWIDTH-NEXT: [[BF_CAST4:%.*]] = sext i8 [[BF_ASHR3]] to i32
1045 // LEWIDTH-NEXT: [[ADD5:%.*]] = add nsw i32 [[ADD]], [[BF_CAST4]]
1046 // LEWIDTH-NEXT: ret i32 [[ADD5]]
1048 // BEWIDTH-LABEL: @st6_check_load(
1049 // BEWIDTH-NEXT: entry:
1050 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1051 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 4
1052 // BEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1053 // BEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1054 // BEWIDTH-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[B]], align 2
1055 // BEWIDTH-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1056 // BEWIDTH-NEXT: [[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
1057 // BEWIDTH-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1058 // BEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
1059 // BEWIDTH-NEXT: [[BF_ASHR2:%.*]] = ashr i8 [[BF_LOAD1]], 3
1060 // BEWIDTH-NEXT: [[BF_CAST3:%.*]] = sext i8 [[BF_ASHR2]] to i32
1061 // BEWIDTH-NEXT: [[ADD4:%.*]] = add nsw i32 [[ADD]], [[BF_CAST3]]
1062 // BEWIDTH-NEXT: ret i32 [[ADD4]]
1064 // LEWIDTHNUM-LABEL: @st6_check_load(
1065 // LEWIDTHNUM-NEXT: entry:
1066 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1067 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 4
1068 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 4
1069 // LEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1070 // LEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1071 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[B]], align 2
1072 // LEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1073 // LEWIDTHNUM-NEXT: [[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
1074 // LEWIDTHNUM-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1075 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
1076 // LEWIDTHNUM-NEXT: [[BF_SHL2:%.*]] = shl i8 [[BF_LOAD1]], 3
1077 // LEWIDTHNUM-NEXT: [[BF_ASHR3:%.*]] = ashr i8 [[BF_SHL2]], 3
1078 // LEWIDTHNUM-NEXT: [[BF_CAST4:%.*]] = sext i8 [[BF_ASHR3]] to i32
1079 // LEWIDTHNUM-NEXT: [[ADD5:%.*]] = add nsw i32 [[ADD]], [[BF_CAST4]]
1080 // LEWIDTHNUM-NEXT: ret i32 [[ADD5]]
1082 // BEWIDTHNUM-LABEL: @st6_check_load(
1083 // BEWIDTHNUM-NEXT: entry:
1084 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1085 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 4
1086 // BEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1087 // BEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1088 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[B]], align 2
1089 // BEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1090 // BEWIDTHNUM-NEXT: [[ADD:%.*]] = add nsw i32 [[BF_CAST]], [[CONV]]
1091 // BEWIDTHNUM-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1092 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
1093 // BEWIDTHNUM-NEXT: [[BF_ASHR2:%.*]] = ashr i8 [[BF_LOAD1]], 3
1094 // BEWIDTHNUM-NEXT: [[BF_CAST3:%.*]] = sext i8 [[BF_ASHR2]] to i32
1095 // BEWIDTHNUM-NEXT: [[ADD4:%.*]] = add nsw i32 [[ADD]], [[BF_CAST3]]
1096 // BEWIDTHNUM-NEXT: ret i32 [[ADD4]]
1098 int st6_check_load(volatile struct st6 *m) {
1099 int x = m->a;
1100 x += m->b;
1101 x += m->c;
1102 return x;
1105 // LE-LABEL: @st6_check_store(
1106 // LE-NEXT: entry:
1107 // LE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
1108 // LE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -4096
1109 // LE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
1110 // LE-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
1111 // LE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1112 // LE-NEXT: store i8 2, ptr [[B]], align 2
1113 // LE-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1114 // LE-NEXT: [[BF_LOAD1:%.*]] = load i8, ptr [[C]], align 1
1115 // LE-NEXT: [[BF_CLEAR2:%.*]] = and i8 [[BF_LOAD1]], -32
1116 // LE-NEXT: [[BF_SET3:%.*]] = or i8 [[BF_CLEAR2]], 3
1117 // LE-NEXT: store i8 [[BF_SET3]], ptr [[C]], align 1
1118 // LE-NEXT: ret void
1120 // BE-LABEL: @st6_check_store(
1121 // BE-NEXT: entry:
1122 // BE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
1123 // BE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 15
1124 // BE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 16
1125 // BE-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
1126 // BE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1127 // BE-NEXT: store i8 2, ptr [[B]], align 2
1128 // BE-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1129 // BE-NEXT: [[BF_LOAD1:%.*]] = load i8, ptr [[C]], align 1
1130 // BE-NEXT: [[BF_CLEAR2:%.*]] = and i8 [[BF_LOAD1]], 7
1131 // BE-NEXT: [[BF_SET3:%.*]] = or i8 [[BF_CLEAR2]], 24
1132 // BE-NEXT: store i8 [[BF_SET3]], ptr [[C]], align 1
1133 // BE-NEXT: ret void
1135 // LENUMLOADS-LABEL: @st6_check_store(
1136 // LENUMLOADS-NEXT: entry:
1137 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
1138 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -4096
1139 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
1140 // LENUMLOADS-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
1141 // LENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1142 // LENUMLOADS-NEXT: store i8 2, ptr [[B]], align 2
1143 // LENUMLOADS-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1144 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load i8, ptr [[C]], align 1
1145 // LENUMLOADS-NEXT: [[BF_CLEAR2:%.*]] = and i8 [[BF_LOAD1]], -32
1146 // LENUMLOADS-NEXT: [[BF_SET3:%.*]] = or i8 [[BF_CLEAR2]], 3
1147 // LENUMLOADS-NEXT: store i8 [[BF_SET3]], ptr [[C]], align 1
1148 // LENUMLOADS-NEXT: ret void
1150 // BENUMLOADS-LABEL: @st6_check_store(
1151 // BENUMLOADS-NEXT: entry:
1152 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
1153 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 15
1154 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 16
1155 // BENUMLOADS-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
1156 // BENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1157 // BENUMLOADS-NEXT: store i8 2, ptr [[B]], align 2
1158 // BENUMLOADS-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1159 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load i8, ptr [[C]], align 1
1160 // BENUMLOADS-NEXT: [[BF_CLEAR2:%.*]] = and i8 [[BF_LOAD1]], 7
1161 // BENUMLOADS-NEXT: [[BF_SET3:%.*]] = or i8 [[BF_CLEAR2]], 24
1162 // BENUMLOADS-NEXT: store i8 [[BF_SET3]], ptr [[C]], align 1
1163 // BENUMLOADS-NEXT: ret void
1165 // LEWIDTH-LABEL: @st6_check_store(
1166 // LEWIDTH-NEXT: entry:
1167 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
1168 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -4096
1169 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
1170 // LEWIDTH-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
1171 // LEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1172 // LEWIDTH-NEXT: store i8 2, ptr [[B]], align 2
1173 // LEWIDTH-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1174 // LEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load i8, ptr [[C]], align 1
1175 // LEWIDTH-NEXT: [[BF_CLEAR2:%.*]] = and i8 [[BF_LOAD1]], -32
1176 // LEWIDTH-NEXT: [[BF_SET3:%.*]] = or i8 [[BF_CLEAR2]], 3
1177 // LEWIDTH-NEXT: store i8 [[BF_SET3]], ptr [[C]], align 1
1178 // LEWIDTH-NEXT: ret void
1180 // BEWIDTH-LABEL: @st6_check_store(
1181 // BEWIDTH-NEXT: entry:
1182 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
1183 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 15
1184 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 16
1185 // BEWIDTH-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
1186 // BEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1187 // BEWIDTH-NEXT: store i8 2, ptr [[B]], align 2
1188 // BEWIDTH-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1189 // BEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load i8, ptr [[C]], align 1
1190 // BEWIDTH-NEXT: [[BF_CLEAR2:%.*]] = and i8 [[BF_LOAD1]], 7
1191 // BEWIDTH-NEXT: [[BF_SET3:%.*]] = or i8 [[BF_CLEAR2]], 24
1192 // BEWIDTH-NEXT: store i8 [[BF_SET3]], ptr [[C]], align 1
1193 // BEWIDTH-NEXT: ret void
1195 // LEWIDTHNUM-LABEL: @st6_check_store(
1196 // LEWIDTHNUM-NEXT: entry:
1197 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
1198 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -4096
1199 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
1200 // LEWIDTHNUM-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
1201 // LEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1202 // LEWIDTHNUM-NEXT: store i8 2, ptr [[B]], align 2
1203 // LEWIDTHNUM-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1204 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load i8, ptr [[C]], align 1
1205 // LEWIDTHNUM-NEXT: [[BF_CLEAR2:%.*]] = and i8 [[BF_LOAD1]], -32
1206 // LEWIDTHNUM-NEXT: [[BF_SET3:%.*]] = or i8 [[BF_CLEAR2]], 3
1207 // LEWIDTHNUM-NEXT: store i8 [[BF_SET3]], ptr [[C]], align 1
1208 // LEWIDTHNUM-NEXT: ret void
1210 // BEWIDTHNUM-LABEL: @st6_check_store(
1211 // BEWIDTHNUM-NEXT: entry:
1212 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[M:%.*]], align 4
1213 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], 15
1214 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 16
1215 // BEWIDTHNUM-NEXT: store i16 [[BF_SET]], ptr [[M]], align 4
1216 // BEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6:%.*]], ptr [[M]], i32 0, i32 1
1217 // BEWIDTHNUM-NEXT: store i8 2, ptr [[B]], align 2
1218 // BEWIDTHNUM-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST6]], ptr [[M]], i32 0, i32 2
1219 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load i8, ptr [[C]], align 1
1220 // BEWIDTHNUM-NEXT: [[BF_CLEAR2:%.*]] = and i8 [[BF_LOAD1]], 7
1221 // BEWIDTHNUM-NEXT: [[BF_SET3:%.*]] = or i8 [[BF_CLEAR2]], 24
1222 // BEWIDTHNUM-NEXT: store i8 [[BF_SET3]], ptr [[C]], align 1
1223 // BEWIDTHNUM-NEXT: ret void
1225 void st6_check_store(struct st6 *m) {
1226 m->a = 1;
1227 m->b = 2;
1228 m->c = 3;
1231 // Nested structs and bitfields.
1232 struct st7a {
1233 char a;
1234 int b : 5;
1237 struct st7b {
1238 char x;
1239 volatile struct st7a y;
1242 // LE-LABEL: @st7_check_load(
1243 // LE-NEXT: entry:
1244 // LE-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1245 // LE-NEXT: [[TMP0:%.*]] = load i8, ptr [[X]], align 4
1246 // LE-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1247 // LE-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1248 // LE-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1249 // LE-NEXT: [[TMP1:%.*]] = load volatile i8, ptr [[A]], align 4
1250 // LE-NEXT: [[CONV1:%.*]] = sext i8 [[TMP1]] to i32
1251 // LE-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], [[CONV1]]
1252 // LE-NEXT: [[Y2:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1253 // LE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y2]], i32 0, i32 1
1254 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1255 // LE-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 3
1256 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 3
1257 // LE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i32
1258 // LE-NEXT: [[ADD3:%.*]] = add nsw i32 [[ADD]], [[BF_CAST]]
1259 // LE-NEXT: ret i32 [[ADD3]]
1261 // BE-LABEL: @st7_check_load(
1262 // BE-NEXT: entry:
1263 // BE-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1264 // BE-NEXT: [[TMP0:%.*]] = load i8, ptr [[X]], align 4
1265 // BE-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1266 // BE-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1267 // BE-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1268 // BE-NEXT: [[TMP1:%.*]] = load volatile i8, ptr [[A]], align 4
1269 // BE-NEXT: [[CONV1:%.*]] = sext i8 [[TMP1]] to i32
1270 // BE-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], [[CONV1]]
1271 // BE-NEXT: [[Y2:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1272 // BE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y2]], i32 0, i32 1
1273 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1274 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 3
1275 // BE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i32
1276 // BE-NEXT: [[ADD3:%.*]] = add nsw i32 [[ADD]], [[BF_CAST]]
1277 // BE-NEXT: ret i32 [[ADD3]]
1279 // LENUMLOADS-LABEL: @st7_check_load(
1280 // LENUMLOADS-NEXT: entry:
1281 // LENUMLOADS-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1282 // LENUMLOADS-NEXT: [[TMP0:%.*]] = load i8, ptr [[X]], align 4
1283 // LENUMLOADS-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1284 // LENUMLOADS-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1285 // LENUMLOADS-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1286 // LENUMLOADS-NEXT: [[TMP1:%.*]] = load volatile i8, ptr [[A]], align 4
1287 // LENUMLOADS-NEXT: [[CONV1:%.*]] = sext i8 [[TMP1]] to i32
1288 // LENUMLOADS-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], [[CONV1]]
1289 // LENUMLOADS-NEXT: [[Y2:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1290 // LENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y2]], i32 0, i32 1
1291 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1292 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 3
1293 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 3
1294 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i32
1295 // LENUMLOADS-NEXT: [[ADD3:%.*]] = add nsw i32 [[ADD]], [[BF_CAST]]
1296 // LENUMLOADS-NEXT: ret i32 [[ADD3]]
1298 // BENUMLOADS-LABEL: @st7_check_load(
1299 // BENUMLOADS-NEXT: entry:
1300 // BENUMLOADS-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1301 // BENUMLOADS-NEXT: [[TMP0:%.*]] = load i8, ptr [[X]], align 4
1302 // BENUMLOADS-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1303 // BENUMLOADS-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1304 // BENUMLOADS-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1305 // BENUMLOADS-NEXT: [[TMP1:%.*]] = load volatile i8, ptr [[A]], align 4
1306 // BENUMLOADS-NEXT: [[CONV1:%.*]] = sext i8 [[TMP1]] to i32
1307 // BENUMLOADS-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], [[CONV1]]
1308 // BENUMLOADS-NEXT: [[Y2:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1309 // BENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y2]], i32 0, i32 1
1310 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1311 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 3
1312 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i32
1313 // BENUMLOADS-NEXT: [[ADD3:%.*]] = add nsw i32 [[ADD]], [[BF_CAST]]
1314 // BENUMLOADS-NEXT: ret i32 [[ADD3]]
1316 // LEWIDTH-LABEL: @st7_check_load(
1317 // LEWIDTH-NEXT: entry:
1318 // LEWIDTH-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1319 // LEWIDTH-NEXT: [[TMP0:%.*]] = load i8, ptr [[X]], align 4
1320 // LEWIDTH-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1321 // LEWIDTH-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1322 // LEWIDTH-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1323 // LEWIDTH-NEXT: [[TMP1:%.*]] = load volatile i8, ptr [[A]], align 4
1324 // LEWIDTH-NEXT: [[CONV1:%.*]] = sext i8 [[TMP1]] to i32
1325 // LEWIDTH-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], [[CONV1]]
1326 // LEWIDTH-NEXT: [[Y2:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1327 // LEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y2]], i32 0, i32 1
1328 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1329 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 3
1330 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 3
1331 // LEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i32
1332 // LEWIDTH-NEXT: [[ADD3:%.*]] = add nsw i32 [[ADD]], [[BF_CAST]]
1333 // LEWIDTH-NEXT: ret i32 [[ADD3]]
1335 // BEWIDTH-LABEL: @st7_check_load(
1336 // BEWIDTH-NEXT: entry:
1337 // BEWIDTH-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1338 // BEWIDTH-NEXT: [[TMP0:%.*]] = load i8, ptr [[X]], align 4
1339 // BEWIDTH-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1340 // BEWIDTH-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1341 // BEWIDTH-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1342 // BEWIDTH-NEXT: [[TMP1:%.*]] = load volatile i8, ptr [[A]], align 4
1343 // BEWIDTH-NEXT: [[CONV1:%.*]] = sext i8 [[TMP1]] to i32
1344 // BEWIDTH-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], [[CONV1]]
1345 // BEWIDTH-NEXT: [[Y2:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1346 // BEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y2]], i32 0, i32 1
1347 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1348 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 3
1349 // BEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i32
1350 // BEWIDTH-NEXT: [[ADD3:%.*]] = add nsw i32 [[ADD]], [[BF_CAST]]
1351 // BEWIDTH-NEXT: ret i32 [[ADD3]]
1353 // LEWIDTHNUM-LABEL: @st7_check_load(
1354 // LEWIDTHNUM-NEXT: entry:
1355 // LEWIDTHNUM-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1356 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = load i8, ptr [[X]], align 4
1357 // LEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1358 // LEWIDTHNUM-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1359 // LEWIDTHNUM-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1360 // LEWIDTHNUM-NEXT: [[TMP1:%.*]] = load volatile i8, ptr [[A]], align 4
1361 // LEWIDTHNUM-NEXT: [[CONV1:%.*]] = sext i8 [[TMP1]] to i32
1362 // LEWIDTHNUM-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], [[CONV1]]
1363 // LEWIDTHNUM-NEXT: [[Y2:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1364 // LEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y2]], i32 0, i32 1
1365 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1366 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 3
1367 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_SHL]], 3
1368 // LEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i32
1369 // LEWIDTHNUM-NEXT: [[ADD3:%.*]] = add nsw i32 [[ADD]], [[BF_CAST]]
1370 // LEWIDTHNUM-NEXT: ret i32 [[ADD3]]
1372 // BEWIDTHNUM-LABEL: @st7_check_load(
1373 // BEWIDTHNUM-NEXT: entry:
1374 // BEWIDTHNUM-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1375 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = load i8, ptr [[X]], align 4
1376 // BEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i8 [[TMP0]] to i32
1377 // BEWIDTHNUM-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1378 // BEWIDTHNUM-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1379 // BEWIDTHNUM-NEXT: [[TMP1:%.*]] = load volatile i8, ptr [[A]], align 4
1380 // BEWIDTHNUM-NEXT: [[CONV1:%.*]] = sext i8 [[TMP1]] to i32
1381 // BEWIDTHNUM-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], [[CONV1]]
1382 // BEWIDTHNUM-NEXT: [[Y2:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1383 // BEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y2]], i32 0, i32 1
1384 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1385 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 3
1386 // BEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_ASHR]] to i32
1387 // BEWIDTHNUM-NEXT: [[ADD3:%.*]] = add nsw i32 [[ADD]], [[BF_CAST]]
1388 // BEWIDTHNUM-NEXT: ret i32 [[ADD3]]
1390 int st7_check_load(struct st7b *m) {
1391 int r = m->x;
1392 r += m->y.a;
1393 r += m->y.b;
1394 return r;
1397 // LE-LABEL: @st7_check_store(
1398 // LE-NEXT: entry:
1399 // LE-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1400 // LE-NEXT: store i8 1, ptr [[X]], align 4
1401 // LE-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1402 // LE-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1403 // LE-NEXT: store volatile i8 2, ptr [[A]], align 4
1404 // LE-NEXT: [[Y1:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1405 // LE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y1]], i32 0, i32 1
1406 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1407 // LE-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -32
1408 // LE-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 3
1409 // LE-NEXT: store volatile i8 [[BF_SET]], ptr [[B]], align 1
1410 // LE-NEXT: ret void
1412 // BE-LABEL: @st7_check_store(
1413 // BE-NEXT: entry:
1414 // BE-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1415 // BE-NEXT: store i8 1, ptr [[X]], align 4
1416 // BE-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1417 // BE-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1418 // BE-NEXT: store volatile i8 2, ptr [[A]], align 4
1419 // BE-NEXT: [[Y1:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1420 // BE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y1]], i32 0, i32 1
1421 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1422 // BE-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 7
1423 // BE-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 24
1424 // BE-NEXT: store volatile i8 [[BF_SET]], ptr [[B]], align 1
1425 // BE-NEXT: ret void
1427 // LENUMLOADS-LABEL: @st7_check_store(
1428 // LENUMLOADS-NEXT: entry:
1429 // LENUMLOADS-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1430 // LENUMLOADS-NEXT: store i8 1, ptr [[X]], align 4
1431 // LENUMLOADS-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1432 // LENUMLOADS-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1433 // LENUMLOADS-NEXT: store volatile i8 2, ptr [[A]], align 4
1434 // LENUMLOADS-NEXT: [[Y1:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1435 // LENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y1]], i32 0, i32 1
1436 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1437 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -32
1438 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 3
1439 // LENUMLOADS-NEXT: store volatile i8 [[BF_SET]], ptr [[B]], align 1
1440 // LENUMLOADS-NEXT: ret void
1442 // BENUMLOADS-LABEL: @st7_check_store(
1443 // BENUMLOADS-NEXT: entry:
1444 // BENUMLOADS-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1445 // BENUMLOADS-NEXT: store i8 1, ptr [[X]], align 4
1446 // BENUMLOADS-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1447 // BENUMLOADS-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1448 // BENUMLOADS-NEXT: store volatile i8 2, ptr [[A]], align 4
1449 // BENUMLOADS-NEXT: [[Y1:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1450 // BENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y1]], i32 0, i32 1
1451 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1452 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 7
1453 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 24
1454 // BENUMLOADS-NEXT: store volatile i8 [[BF_SET]], ptr [[B]], align 1
1455 // BENUMLOADS-NEXT: ret void
1457 // LEWIDTH-LABEL: @st7_check_store(
1458 // LEWIDTH-NEXT: entry:
1459 // LEWIDTH-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1460 // LEWIDTH-NEXT: store i8 1, ptr [[X]], align 4
1461 // LEWIDTH-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1462 // LEWIDTH-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1463 // LEWIDTH-NEXT: store volatile i8 2, ptr [[A]], align 4
1464 // LEWIDTH-NEXT: [[Y1:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1465 // LEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y1]], i32 0, i32 1
1466 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1467 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -32
1468 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 3
1469 // LEWIDTH-NEXT: store volatile i8 [[BF_SET]], ptr [[B]], align 1
1470 // LEWIDTH-NEXT: ret void
1472 // BEWIDTH-LABEL: @st7_check_store(
1473 // BEWIDTH-NEXT: entry:
1474 // BEWIDTH-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1475 // BEWIDTH-NEXT: store i8 1, ptr [[X]], align 4
1476 // BEWIDTH-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1477 // BEWIDTH-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1478 // BEWIDTH-NEXT: store volatile i8 2, ptr [[A]], align 4
1479 // BEWIDTH-NEXT: [[Y1:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1480 // BEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y1]], i32 0, i32 1
1481 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1482 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 7
1483 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 24
1484 // BEWIDTH-NEXT: store volatile i8 [[BF_SET]], ptr [[B]], align 1
1485 // BEWIDTH-NEXT: ret void
1487 // LEWIDTHNUM-LABEL: @st7_check_store(
1488 // LEWIDTHNUM-NEXT: entry:
1489 // LEWIDTHNUM-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1490 // LEWIDTHNUM-NEXT: store i8 1, ptr [[X]], align 4
1491 // LEWIDTHNUM-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1492 // LEWIDTHNUM-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1493 // LEWIDTHNUM-NEXT: store volatile i8 2, ptr [[A]], align 4
1494 // LEWIDTHNUM-NEXT: [[Y1:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1495 // LEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y1]], i32 0, i32 1
1496 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1497 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -32
1498 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 3
1499 // LEWIDTHNUM-NEXT: store volatile i8 [[BF_SET]], ptr [[B]], align 1
1500 // LEWIDTHNUM-NEXT: ret void
1502 // BEWIDTHNUM-LABEL: @st7_check_store(
1503 // BEWIDTHNUM-NEXT: entry:
1504 // BEWIDTHNUM-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B:%.*]], ptr [[M:%.*]], i32 0, i32 0
1505 // BEWIDTHNUM-NEXT: store i8 1, ptr [[X]], align 4
1506 // BEWIDTHNUM-NEXT: [[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1507 // BEWIDTHNUM-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A:%.*]], ptr [[Y]], i32 0, i32 0
1508 // BEWIDTHNUM-NEXT: store volatile i8 2, ptr [[A]], align 4
1509 // BEWIDTHNUM-NEXT: [[Y1:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7B]], ptr [[M]], i32 0, i32 2
1510 // BEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST7A]], ptr [[Y1]], i32 0, i32 1
1511 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
1512 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 7
1513 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 24
1514 // BEWIDTHNUM-NEXT: store volatile i8 [[BF_SET]], ptr [[B]], align 1
1515 // BEWIDTHNUM-NEXT: ret void
1517 void st7_check_store(struct st7b *m) {
1518 m->x = 1;
1519 m->y.a = 2;
1520 m->y.b = 3;
1523 // Check overflowing assignments to bitfields.
1524 struct st8 {
1525 unsigned f : 16;
1528 // LE-LABEL: @st8_check_assignment(
1529 // LE-NEXT: entry:
1530 // LE-NEXT: store i16 -1, ptr [[M:%.*]], align 4
1531 // LE-NEXT: ret i32 65535
1533 // BE-LABEL: @st8_check_assignment(
1534 // BE-NEXT: entry:
1535 // BE-NEXT: store i16 -1, ptr [[M:%.*]], align 4
1536 // BE-NEXT: ret i32 65535
1538 // LENUMLOADS-LABEL: @st8_check_assignment(
1539 // LENUMLOADS-NEXT: entry:
1540 // LENUMLOADS-NEXT: store i16 -1, ptr [[M:%.*]], align 4
1541 // LENUMLOADS-NEXT: ret i32 65535
1543 // BENUMLOADS-LABEL: @st8_check_assignment(
1544 // BENUMLOADS-NEXT: entry:
1545 // BENUMLOADS-NEXT: store i16 -1, ptr [[M:%.*]], align 4
1546 // BENUMLOADS-NEXT: ret i32 65535
1548 // LEWIDTH-LABEL: @st8_check_assignment(
1549 // LEWIDTH-NEXT: entry:
1550 // LEWIDTH-NEXT: store i16 -1, ptr [[M:%.*]], align 4
1551 // LEWIDTH-NEXT: ret i32 65535
1553 // BEWIDTH-LABEL: @st8_check_assignment(
1554 // BEWIDTH-NEXT: entry:
1555 // BEWIDTH-NEXT: store i16 -1, ptr [[M:%.*]], align 4
1556 // BEWIDTH-NEXT: ret i32 65535
1558 // LEWIDTHNUM-LABEL: @st8_check_assignment(
1559 // LEWIDTHNUM-NEXT: entry:
1560 // LEWIDTHNUM-NEXT: store i16 -1, ptr [[M:%.*]], align 4
1561 // LEWIDTHNUM-NEXT: ret i32 65535
1563 // BEWIDTHNUM-LABEL: @st8_check_assignment(
1564 // BEWIDTHNUM-NEXT: entry:
1565 // BEWIDTHNUM-NEXT: store i16 -1, ptr [[M:%.*]], align 4
1566 // BEWIDTHNUM-NEXT: ret i32 65535
1568 int st8_check_assignment(struct st8 *m) {
1569 return m->f = 0xffff;
1572 struct st9{
1573 int f : 8;
1576 // LE-LABEL: @read_st9(
1577 // LE-NEXT: entry:
1578 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 4
1579 // LE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
1580 // LE-NEXT: ret i32 [[BF_CAST]]
1582 // BE-LABEL: @read_st9(
1583 // BE-NEXT: entry:
1584 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 4
1585 // BE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
1586 // BE-NEXT: ret i32 [[BF_CAST]]
1588 // LENUMLOADS-LABEL: @read_st9(
1589 // LENUMLOADS-NEXT: entry:
1590 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 4
1591 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
1592 // LENUMLOADS-NEXT: ret i32 [[BF_CAST]]
1594 // BENUMLOADS-LABEL: @read_st9(
1595 // BENUMLOADS-NEXT: entry:
1596 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 4
1597 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
1598 // BENUMLOADS-NEXT: ret i32 [[BF_CAST]]
1600 // LEWIDTH-LABEL: @read_st9(
1601 // LEWIDTH-NEXT: entry:
1602 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1603 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 24
1604 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
1605 // LEWIDTH-NEXT: ret i32 [[BF_ASHR]]
1607 // BEWIDTH-LABEL: @read_st9(
1608 // BEWIDTH-NEXT: entry:
1609 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1610 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 24
1611 // BEWIDTH-NEXT: ret i32 [[BF_ASHR]]
1613 // LEWIDTHNUM-LABEL: @read_st9(
1614 // LEWIDTHNUM-NEXT: entry:
1615 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1616 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 24
1617 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
1618 // LEWIDTHNUM-NEXT: ret i32 [[BF_ASHR]]
1620 // BEWIDTHNUM-LABEL: @read_st9(
1621 // BEWIDTHNUM-NEXT: entry:
1622 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1623 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 24
1624 // BEWIDTHNUM-NEXT: ret i32 [[BF_ASHR]]
1626 int read_st9(volatile struct st9 *m) {
1627 return m->f;
1630 // LE-LABEL: @store_st9(
1631 // LE-NEXT: entry:
1632 // LE-NEXT: store volatile i8 1, ptr [[M:%.*]], align 4
1633 // LE-NEXT: ret void
1635 // BE-LABEL: @store_st9(
1636 // BE-NEXT: entry:
1637 // BE-NEXT: store volatile i8 1, ptr [[M:%.*]], align 4
1638 // BE-NEXT: ret void
1640 // LENUMLOADS-LABEL: @store_st9(
1641 // LENUMLOADS-NEXT: entry:
1642 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 4
1643 // LENUMLOADS-NEXT: store volatile i8 1, ptr [[M]], align 4
1644 // LENUMLOADS-NEXT: ret void
1646 // BENUMLOADS-LABEL: @store_st9(
1647 // BENUMLOADS-NEXT: entry:
1648 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 4
1649 // BENUMLOADS-NEXT: store volatile i8 1, ptr [[M]], align 4
1650 // BENUMLOADS-NEXT: ret void
1652 // LEWIDTH-LABEL: @store_st9(
1653 // LEWIDTH-NEXT: entry:
1654 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1655 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -256
1656 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 1
1657 // LEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1658 // LEWIDTH-NEXT: ret void
1660 // BEWIDTH-LABEL: @store_st9(
1661 // BEWIDTH-NEXT: entry:
1662 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1663 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], 16777215
1664 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 16777216
1665 // BEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1666 // BEWIDTH-NEXT: ret void
1668 // LEWIDTHNUM-LABEL: @store_st9(
1669 // LEWIDTHNUM-NEXT: entry:
1670 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1671 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -256
1672 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 1
1673 // LEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1674 // LEWIDTHNUM-NEXT: ret void
1676 // BEWIDTHNUM-LABEL: @store_st9(
1677 // BEWIDTHNUM-NEXT: entry:
1678 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1679 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], 16777215
1680 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 16777216
1681 // BEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1682 // BEWIDTHNUM-NEXT: ret void
1684 void store_st9(volatile struct st9 *m) {
1685 m->f = 1;
1688 // LE-LABEL: @increment_st9(
1689 // LE-NEXT: entry:
1690 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 4
1691 // LE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
1692 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
1693 // LE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
1694 // LE-NEXT: store volatile i8 [[TMP0]], ptr [[M]], align 4
1695 // LE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
1696 // LE-NEXT: ret void
1698 // BE-LABEL: @increment_st9(
1699 // BE-NEXT: entry:
1700 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 4
1701 // BE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
1702 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
1703 // BE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
1704 // BE-NEXT: store volatile i8 [[TMP0]], ptr [[M]], align 4
1705 // BE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
1706 // BE-NEXT: ret void
1708 // LENUMLOADS-LABEL: @increment_st9(
1709 // LENUMLOADS-NEXT: entry:
1710 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 4
1711 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
1712 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
1713 // LENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
1714 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[M]], align 4
1715 // LENUMLOADS-NEXT: store volatile i8 [[TMP0]], ptr [[M]], align 4
1716 // LENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
1717 // LENUMLOADS-NEXT: ret void
1719 // BENUMLOADS-LABEL: @increment_st9(
1720 // BENUMLOADS-NEXT: entry:
1721 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[M:%.*]], align 4
1722 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
1723 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
1724 // BENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
1725 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[M]], align 4
1726 // BENUMLOADS-NEXT: store volatile i8 [[TMP0]], ptr [[M]], align 4
1727 // BENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
1728 // BENUMLOADS-NEXT: ret void
1730 // LEWIDTH-LABEL: @increment_st9(
1731 // LEWIDTH-NEXT: entry:
1732 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1733 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 24
1734 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
1735 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
1736 // LEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
1737 // LEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
1738 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -256
1739 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
1740 // LEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1741 // LEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
1742 // LEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
1743 // LEWIDTH-NEXT: ret void
1745 // BEWIDTH-LABEL: @increment_st9(
1746 // BEWIDTH-NEXT: entry:
1747 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1748 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 24
1749 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
1750 // BEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
1751 // BEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
1752 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
1753 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 16777215
1754 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
1755 // BEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1756 // BEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
1757 // BEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
1758 // BEWIDTH-NEXT: ret void
1760 // LEWIDTHNUM-LABEL: @increment_st9(
1761 // LEWIDTHNUM-NEXT: entry:
1762 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1763 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 24
1764 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
1765 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
1766 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
1767 // LEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
1768 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -256
1769 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
1770 // LEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1771 // LEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
1772 // LEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
1773 // LEWIDTHNUM-NEXT: ret void
1775 // BEWIDTHNUM-LABEL: @increment_st9(
1776 // BEWIDTHNUM-NEXT: entry:
1777 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1778 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 24
1779 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
1780 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
1781 // BEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
1782 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
1783 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 16777215
1784 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
1785 // BEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1786 // BEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
1787 // BEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
1788 // BEWIDTHNUM-NEXT: ret void
1790 void increment_st9(volatile struct st9 *m) {
1791 ++m->f;
1794 struct st10{
1795 int e : 1;
1796 int f : 8;
1799 // LE-LABEL: @read_st10(
1800 // LE-NEXT: entry:
1801 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1802 // LE-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 7
1803 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
1804 // LE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1805 // LE-NEXT: ret i32 [[BF_CAST]]
1807 // BE-LABEL: @read_st10(
1808 // BE-NEXT: entry:
1809 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1810 // BE-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 1
1811 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
1812 // BE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1813 // BE-NEXT: ret i32 [[BF_CAST]]
1815 // LENUMLOADS-LABEL: @read_st10(
1816 // LENUMLOADS-NEXT: entry:
1817 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1818 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 7
1819 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
1820 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1821 // LENUMLOADS-NEXT: ret i32 [[BF_CAST]]
1823 // BENUMLOADS-LABEL: @read_st10(
1824 // BENUMLOADS-NEXT: entry:
1825 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1826 // BENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 1
1827 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
1828 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1829 // BENUMLOADS-NEXT: ret i32 [[BF_CAST]]
1831 // LEWIDTH-LABEL: @read_st10(
1832 // LEWIDTH-NEXT: entry:
1833 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1834 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 23
1835 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
1836 // LEWIDTH-NEXT: ret i32 [[BF_ASHR]]
1838 // BEWIDTH-LABEL: @read_st10(
1839 // BEWIDTH-NEXT: entry:
1840 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1841 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 1
1842 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
1843 // BEWIDTH-NEXT: ret i32 [[BF_ASHR]]
1845 // LEWIDTHNUM-LABEL: @read_st10(
1846 // LEWIDTHNUM-NEXT: entry:
1847 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1848 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 23
1849 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
1850 // LEWIDTHNUM-NEXT: ret i32 [[BF_ASHR]]
1852 // BEWIDTHNUM-LABEL: @read_st10(
1853 // BEWIDTHNUM-NEXT: entry:
1854 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1855 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 1
1856 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
1857 // BEWIDTHNUM-NEXT: ret i32 [[BF_ASHR]]
1859 int read_st10(volatile struct st10 *m) {
1860 return m->f;
1863 // LE-LABEL: @store_st10(
1864 // LE-NEXT: entry:
1865 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1866 // LE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -511
1867 // LE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 2
1868 // LE-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
1869 // LE-NEXT: ret void
1871 // BE-LABEL: @store_st10(
1872 // BE-NEXT: entry:
1873 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1874 // BE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -32641
1875 // BE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 128
1876 // BE-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
1877 // BE-NEXT: ret void
1879 // LENUMLOADS-LABEL: @store_st10(
1880 // LENUMLOADS-NEXT: entry:
1881 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1882 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -511
1883 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 2
1884 // LENUMLOADS-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
1885 // LENUMLOADS-NEXT: ret void
1887 // BENUMLOADS-LABEL: @store_st10(
1888 // BENUMLOADS-NEXT: entry:
1889 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1890 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -32641
1891 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 128
1892 // BENUMLOADS-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
1893 // BENUMLOADS-NEXT: ret void
1895 // LEWIDTH-LABEL: @store_st10(
1896 // LEWIDTH-NEXT: entry:
1897 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1898 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -511
1899 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 2
1900 // LEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1901 // LEWIDTH-NEXT: ret void
1903 // BEWIDTH-LABEL: @store_st10(
1904 // BEWIDTH-NEXT: entry:
1905 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1906 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -2139095041
1907 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 8388608
1908 // BEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1909 // BEWIDTH-NEXT: ret void
1911 // LEWIDTHNUM-LABEL: @store_st10(
1912 // LEWIDTHNUM-NEXT: entry:
1913 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1914 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -511
1915 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 2
1916 // LEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1917 // LEWIDTHNUM-NEXT: ret void
1919 // BEWIDTHNUM-LABEL: @store_st10(
1920 // BEWIDTHNUM-NEXT: entry:
1921 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
1922 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -2139095041
1923 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 8388608
1924 // BEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
1925 // BEWIDTHNUM-NEXT: ret void
1927 void store_st10(volatile struct st10 *m) {
1928 m->f = 1;
1931 // LE-LABEL: @increment_st10(
1932 // LE-NEXT: entry:
1933 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1934 // LE-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 7
1935 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
1936 // LE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1937 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
1938 // LE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
1939 // LE-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[M]], align 4
1940 // LE-NEXT: [[BF_VALUE:%.*]] = and i16 [[TMP0]], 255
1941 // LE-NEXT: [[BF_SHL2:%.*]] = shl i16 [[BF_VALUE]], 1
1942 // LE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD1]], -511
1943 // LE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], [[BF_SHL2]]
1944 // LE-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
1945 // LE-NEXT: [[BF_RESULT_SHL:%.*]] = shl i16 [[BF_VALUE]], 8
1946 // LE-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i16 [[BF_RESULT_SHL]], 8
1947 // LE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[BF_RESULT_ASHR]] to i32
1948 // LE-NEXT: ret void
1950 // BE-LABEL: @increment_st10(
1951 // BE-NEXT: entry:
1952 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1953 // BE-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 1
1954 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
1955 // BE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1956 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
1957 // BE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
1958 // BE-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[M]], align 4
1959 // BE-NEXT: [[BF_VALUE:%.*]] = and i16 [[TMP0]], 255
1960 // BE-NEXT: [[BF_SHL2:%.*]] = shl i16 [[BF_VALUE]], 7
1961 // BE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD1]], -32641
1962 // BE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], [[BF_SHL2]]
1963 // BE-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
1964 // BE-NEXT: [[BF_RESULT_SHL:%.*]] = shl i16 [[BF_VALUE]], 8
1965 // BE-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i16 [[BF_RESULT_SHL]], 8
1966 // BE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[BF_RESULT_ASHR]] to i32
1967 // BE-NEXT: ret void
1969 // LENUMLOADS-LABEL: @increment_st10(
1970 // LENUMLOADS-NEXT: entry:
1971 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1972 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 7
1973 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
1974 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1975 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
1976 // LENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
1977 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[M]], align 4
1978 // LENUMLOADS-NEXT: [[BF_VALUE:%.*]] = and i16 [[TMP0]], 255
1979 // LENUMLOADS-NEXT: [[BF_SHL2:%.*]] = shl i16 [[BF_VALUE]], 1
1980 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD1]], -511
1981 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], [[BF_SHL2]]
1982 // LENUMLOADS-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
1983 // LENUMLOADS-NEXT: [[BF_RESULT_SHL:%.*]] = shl i16 [[BF_VALUE]], 8
1984 // LENUMLOADS-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i16 [[BF_RESULT_SHL]], 8
1985 // LENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[BF_RESULT_ASHR]] to i32
1986 // LENUMLOADS-NEXT: ret void
1988 // BENUMLOADS-LABEL: @increment_st10(
1989 // BENUMLOADS-NEXT: entry:
1990 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[M:%.*]], align 4
1991 // BENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 1
1992 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
1993 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_ASHR]] to i32
1994 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
1995 // BENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
1996 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[M]], align 4
1997 // BENUMLOADS-NEXT: [[BF_VALUE:%.*]] = and i16 [[TMP0]], 255
1998 // BENUMLOADS-NEXT: [[BF_SHL2:%.*]] = shl i16 [[BF_VALUE]], 7
1999 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD1]], -32641
2000 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], [[BF_SHL2]]
2001 // BENUMLOADS-NEXT: store volatile i16 [[BF_SET]], ptr [[M]], align 4
2002 // BENUMLOADS-NEXT: [[BF_RESULT_SHL:%.*]] = shl i16 [[BF_VALUE]], 8
2003 // BENUMLOADS-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i16 [[BF_RESULT_SHL]], 8
2004 // BENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[BF_RESULT_ASHR]] to i32
2005 // BENUMLOADS-NEXT: ret void
2007 // LEWIDTH-LABEL: @increment_st10(
2008 // LEWIDTH-NEXT: entry:
2009 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2010 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 23
2011 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
2012 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2013 // LEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2014 // LEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2015 // LEWIDTH-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 1
2016 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -511
2017 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2018 // LEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2019 // LEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2020 // LEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2021 // LEWIDTH-NEXT: ret void
2023 // BEWIDTH-LABEL: @increment_st10(
2024 // BEWIDTH-NEXT: entry:
2025 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2026 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 1
2027 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
2028 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2029 // BEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2030 // BEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2031 // BEWIDTH-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 23
2032 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -2139095041
2033 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2034 // BEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2035 // BEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2036 // BEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2037 // BEWIDTH-NEXT: ret void
2039 // LEWIDTHNUM-LABEL: @increment_st10(
2040 // LEWIDTHNUM-NEXT: entry:
2041 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2042 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 23
2043 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
2044 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2045 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2046 // LEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2047 // LEWIDTHNUM-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 1
2048 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -511
2049 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2050 // LEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2051 // LEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2052 // LEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2053 // LEWIDTHNUM-NEXT: ret void
2055 // BEWIDTHNUM-LABEL: @increment_st10(
2056 // BEWIDTHNUM-NEXT: entry:
2057 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2058 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 1
2059 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
2060 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2061 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2062 // BEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2063 // BEWIDTHNUM-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 23
2064 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -2139095041
2065 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2066 // BEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2067 // BEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2068 // BEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2069 // BEWIDTHNUM-NEXT: ret void
2071 void increment_st10(volatile struct st10 *m) {
2072 ++m->f;
2075 struct st11{
2076 char e;
2077 int f : 16;
2080 // LE-LABEL: @read_st11(
2081 // LE-NEXT: entry:
2082 // LE-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2083 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2084 // LE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2085 // LE-NEXT: ret i32 [[BF_CAST]]
2087 // BE-LABEL: @read_st11(
2088 // BE-NEXT: entry:
2089 // BE-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2090 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2091 // BE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2092 // BE-NEXT: ret i32 [[BF_CAST]]
2094 // LENUMLOADS-LABEL: @read_st11(
2095 // LENUMLOADS-NEXT: entry:
2096 // LENUMLOADS-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2097 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2098 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2099 // LENUMLOADS-NEXT: ret i32 [[BF_CAST]]
2101 // BENUMLOADS-LABEL: @read_st11(
2102 // BENUMLOADS-NEXT: entry:
2103 // BENUMLOADS-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2104 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2105 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2106 // BENUMLOADS-NEXT: ret i32 [[BF_CAST]]
2108 // LEWIDTH-LABEL: @read_st11(
2109 // LEWIDTH-NEXT: entry:
2110 // LEWIDTH-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2111 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2112 // LEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2113 // LEWIDTH-NEXT: ret i32 [[BF_CAST]]
2115 // BEWIDTH-LABEL: @read_st11(
2116 // BEWIDTH-NEXT: entry:
2117 // BEWIDTH-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2118 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2119 // BEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2120 // BEWIDTH-NEXT: ret i32 [[BF_CAST]]
2122 // LEWIDTHNUM-LABEL: @read_st11(
2123 // LEWIDTHNUM-NEXT: entry:
2124 // LEWIDTHNUM-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2125 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2126 // LEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2127 // LEWIDTHNUM-NEXT: ret i32 [[BF_CAST]]
2129 // BEWIDTHNUM-LABEL: @read_st11(
2130 // BEWIDTHNUM-NEXT: entry:
2131 // BEWIDTHNUM-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2132 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2133 // BEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2134 // BEWIDTHNUM-NEXT: ret i32 [[BF_CAST]]
2136 int read_st11(volatile struct st11 *m) {
2137 return m->f;
2140 // LE-LABEL: @store_st11(
2141 // LE-NEXT: entry:
2142 // LE-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2143 // LE-NEXT: store volatile i16 1, ptr [[F]], align 1
2144 // LE-NEXT: ret void
2146 // BE-LABEL: @store_st11(
2147 // BE-NEXT: entry:
2148 // BE-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2149 // BE-NEXT: store volatile i16 1, ptr [[F]], align 1
2150 // BE-NEXT: ret void
2152 // LENUMLOADS-LABEL: @store_st11(
2153 // LENUMLOADS-NEXT: entry:
2154 // LENUMLOADS-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2155 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2156 // LENUMLOADS-NEXT: store volatile i16 1, ptr [[F]], align 1
2157 // LENUMLOADS-NEXT: ret void
2159 // BENUMLOADS-LABEL: @store_st11(
2160 // BENUMLOADS-NEXT: entry:
2161 // BENUMLOADS-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2162 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2163 // BENUMLOADS-NEXT: store volatile i16 1, ptr [[F]], align 1
2164 // BENUMLOADS-NEXT: ret void
2166 // LEWIDTH-LABEL: @store_st11(
2167 // LEWIDTH-NEXT: entry:
2168 // LEWIDTH-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2169 // LEWIDTH-NEXT: store volatile i16 1, ptr [[F]], align 1
2170 // LEWIDTH-NEXT: ret void
2172 // BEWIDTH-LABEL: @store_st11(
2173 // BEWIDTH-NEXT: entry:
2174 // BEWIDTH-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2175 // BEWIDTH-NEXT: store volatile i16 1, ptr [[F]], align 1
2176 // BEWIDTH-NEXT: ret void
2178 // LEWIDTHNUM-LABEL: @store_st11(
2179 // LEWIDTHNUM-NEXT: entry:
2180 // LEWIDTHNUM-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2181 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2182 // LEWIDTHNUM-NEXT: store volatile i16 1, ptr [[F]], align 1
2183 // LEWIDTHNUM-NEXT: ret void
2185 // BEWIDTHNUM-LABEL: @store_st11(
2186 // BEWIDTHNUM-NEXT: entry:
2187 // BEWIDTHNUM-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2188 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2189 // BEWIDTHNUM-NEXT: store volatile i16 1, ptr [[F]], align 1
2190 // BEWIDTHNUM-NEXT: ret void
2192 void store_st11(volatile struct st11 *m) {
2193 m->f = 1;
2196 // LE-LABEL: @increment_st11(
2197 // LE-NEXT: entry:
2198 // LE-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2199 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2200 // LE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2201 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
2202 // LE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
2203 // LE-NEXT: store volatile i16 [[TMP0]], ptr [[F]], align 1
2204 // LE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
2205 // LE-NEXT: ret void
2207 // BE-LABEL: @increment_st11(
2208 // BE-NEXT: entry:
2209 // BE-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2210 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2211 // BE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2212 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
2213 // BE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
2214 // BE-NEXT: store volatile i16 [[TMP0]], ptr [[F]], align 1
2215 // BE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
2216 // BE-NEXT: ret void
2218 // LENUMLOADS-LABEL: @increment_st11(
2219 // LENUMLOADS-NEXT: entry:
2220 // LENUMLOADS-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2221 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2222 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2223 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
2224 // LENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
2225 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[F]], align 1
2226 // LENUMLOADS-NEXT: store volatile i16 [[TMP0]], ptr [[F]], align 1
2227 // LENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
2228 // LENUMLOADS-NEXT: ret void
2230 // BENUMLOADS-LABEL: @increment_st11(
2231 // BENUMLOADS-NEXT: entry:
2232 // BENUMLOADS-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2233 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2234 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2235 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
2236 // BENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
2237 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[F]], align 1
2238 // BENUMLOADS-NEXT: store volatile i16 [[TMP0]], ptr [[F]], align 1
2239 // BENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
2240 // BENUMLOADS-NEXT: ret void
2242 // LEWIDTH-LABEL: @increment_st11(
2243 // LEWIDTH-NEXT: entry:
2244 // LEWIDTH-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2245 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2246 // LEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2247 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
2248 // LEWIDTH-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
2249 // LEWIDTH-NEXT: store volatile i16 [[TMP0]], ptr [[F]], align 1
2250 // LEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
2251 // LEWIDTH-NEXT: ret void
2253 // BEWIDTH-LABEL: @increment_st11(
2254 // BEWIDTH-NEXT: entry:
2255 // BEWIDTH-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2256 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2257 // BEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2258 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
2259 // BEWIDTH-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
2260 // BEWIDTH-NEXT: store volatile i16 [[TMP0]], ptr [[F]], align 1
2261 // BEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
2262 // BEWIDTH-NEXT: ret void
2264 // LEWIDTHNUM-LABEL: @increment_st11(
2265 // LEWIDTHNUM-NEXT: entry:
2266 // LEWIDTHNUM-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2267 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2268 // LEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2269 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
2270 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
2271 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[F]], align 1
2272 // LEWIDTHNUM-NEXT: store volatile i16 [[TMP0]], ptr [[F]], align 1
2273 // LEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
2274 // LEWIDTHNUM-NEXT: ret void
2276 // BEWIDTHNUM-LABEL: @increment_st11(
2277 // BEWIDTHNUM-NEXT: entry:
2278 // BEWIDTHNUM-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 1
2279 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[F]], align 1
2280 // BEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
2281 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
2282 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
2283 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[F]], align 1
2284 // BEWIDTHNUM-NEXT: store volatile i16 [[TMP0]], ptr [[F]], align 1
2285 // BEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
2286 // BEWIDTHNUM-NEXT: ret void
2288 void increment_st11(volatile struct st11 *m) {
2289 ++m->f;
2292 // LE-LABEL: @increment_e_st11(
2293 // LE-NEXT: entry:
2294 // LE-NEXT: [[E:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 0
2295 // LE-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[E]], align 4
2296 // LE-NEXT: [[INC:%.*]] = add i8 [[TMP0]], 1
2297 // LE-NEXT: store volatile i8 [[INC]], ptr [[E]], align 4
2298 // LE-NEXT: ret void
2300 // BE-LABEL: @increment_e_st11(
2301 // BE-NEXT: entry:
2302 // BE-NEXT: [[E:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 0
2303 // BE-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[E]], align 4
2304 // BE-NEXT: [[INC:%.*]] = add i8 [[TMP0]], 1
2305 // BE-NEXT: store volatile i8 [[INC]], ptr [[E]], align 4
2306 // BE-NEXT: ret void
2308 // LENUMLOADS-LABEL: @increment_e_st11(
2309 // LENUMLOADS-NEXT: entry:
2310 // LENUMLOADS-NEXT: [[E:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 0
2311 // LENUMLOADS-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[E]], align 4
2312 // LENUMLOADS-NEXT: [[INC:%.*]] = add i8 [[TMP0]], 1
2313 // LENUMLOADS-NEXT: store volatile i8 [[INC]], ptr [[E]], align 4
2314 // LENUMLOADS-NEXT: ret void
2316 // BENUMLOADS-LABEL: @increment_e_st11(
2317 // BENUMLOADS-NEXT: entry:
2318 // BENUMLOADS-NEXT: [[E:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 0
2319 // BENUMLOADS-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[E]], align 4
2320 // BENUMLOADS-NEXT: [[INC:%.*]] = add i8 [[TMP0]], 1
2321 // BENUMLOADS-NEXT: store volatile i8 [[INC]], ptr [[E]], align 4
2322 // BENUMLOADS-NEXT: ret void
2324 // LEWIDTH-LABEL: @increment_e_st11(
2325 // LEWIDTH-NEXT: entry:
2326 // LEWIDTH-NEXT: [[E:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 0
2327 // LEWIDTH-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[E]], align 4
2328 // LEWIDTH-NEXT: [[INC:%.*]] = add i8 [[TMP0]], 1
2329 // LEWIDTH-NEXT: store volatile i8 [[INC]], ptr [[E]], align 4
2330 // LEWIDTH-NEXT: ret void
2332 // BEWIDTH-LABEL: @increment_e_st11(
2333 // BEWIDTH-NEXT: entry:
2334 // BEWIDTH-NEXT: [[E:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 0
2335 // BEWIDTH-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[E]], align 4
2336 // BEWIDTH-NEXT: [[INC:%.*]] = add i8 [[TMP0]], 1
2337 // BEWIDTH-NEXT: store volatile i8 [[INC]], ptr [[E]], align 4
2338 // BEWIDTH-NEXT: ret void
2340 // LEWIDTHNUM-LABEL: @increment_e_st11(
2341 // LEWIDTHNUM-NEXT: entry:
2342 // LEWIDTHNUM-NEXT: [[E:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 0
2343 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[E]], align 4
2344 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add i8 [[TMP0]], 1
2345 // LEWIDTHNUM-NEXT: store volatile i8 [[INC]], ptr [[E]], align 4
2346 // LEWIDTHNUM-NEXT: ret void
2348 // BEWIDTHNUM-LABEL: @increment_e_st11(
2349 // BEWIDTHNUM-NEXT: entry:
2350 // BEWIDTHNUM-NEXT: [[E:%.*]] = getelementptr inbounds nuw [[STRUCT_ST11:%.*]], ptr [[M:%.*]], i32 0, i32 0
2351 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[E]], align 4
2352 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add i8 [[TMP0]], 1
2353 // BEWIDTHNUM-NEXT: store volatile i8 [[INC]], ptr [[E]], align 4
2354 // BEWIDTHNUM-NEXT: ret void
2356 void increment_e_st11(volatile struct st11 *m) {
2357 ++m->e;
2360 struct st12{
2361 int e : 8;
2362 int f : 16;
2365 // LE-LABEL: @read_st12(
2366 // LE-NEXT: entry:
2367 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2368 // LE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2369 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2370 // LE-NEXT: ret i32 [[BF_ASHR]]
2372 // BE-LABEL: @read_st12(
2373 // BE-NEXT: entry:
2374 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2375 // BE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2376 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2377 // BE-NEXT: ret i32 [[BF_ASHR]]
2379 // LENUMLOADS-LABEL: @read_st12(
2380 // LENUMLOADS-NEXT: entry:
2381 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2382 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2383 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2384 // LENUMLOADS-NEXT: ret i32 [[BF_ASHR]]
2386 // BENUMLOADS-LABEL: @read_st12(
2387 // BENUMLOADS-NEXT: entry:
2388 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2389 // BENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2390 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2391 // BENUMLOADS-NEXT: ret i32 [[BF_ASHR]]
2393 // LEWIDTH-LABEL: @read_st12(
2394 // LEWIDTH-NEXT: entry:
2395 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2396 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2397 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2398 // LEWIDTH-NEXT: ret i32 [[BF_ASHR]]
2400 // BEWIDTH-LABEL: @read_st12(
2401 // BEWIDTH-NEXT: entry:
2402 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2403 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2404 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2405 // BEWIDTH-NEXT: ret i32 [[BF_ASHR]]
2407 // LEWIDTHNUM-LABEL: @read_st12(
2408 // LEWIDTHNUM-NEXT: entry:
2409 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2410 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2411 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2412 // LEWIDTHNUM-NEXT: ret i32 [[BF_ASHR]]
2414 // BEWIDTHNUM-LABEL: @read_st12(
2415 // BEWIDTHNUM-NEXT: entry:
2416 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2417 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2418 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2419 // BEWIDTHNUM-NEXT: ret i32 [[BF_ASHR]]
2421 int read_st12(volatile struct st12 *m) {
2422 return m->f;
2425 // LE-LABEL: @store_st12(
2426 // LE-NEXT: entry:
2427 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2428 // LE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -16776961
2429 // LE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 256
2430 // LE-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2431 // LE-NEXT: ret void
2433 // BE-LABEL: @store_st12(
2434 // BE-NEXT: entry:
2435 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2436 // BE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -16776961
2437 // BE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 256
2438 // BE-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2439 // BE-NEXT: ret void
2441 // LENUMLOADS-LABEL: @store_st12(
2442 // LENUMLOADS-NEXT: entry:
2443 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2444 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -16776961
2445 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 256
2446 // LENUMLOADS-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2447 // LENUMLOADS-NEXT: ret void
2449 // BENUMLOADS-LABEL: @store_st12(
2450 // BENUMLOADS-NEXT: entry:
2451 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2452 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -16776961
2453 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 256
2454 // BENUMLOADS-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2455 // BENUMLOADS-NEXT: ret void
2457 // LEWIDTH-LABEL: @store_st12(
2458 // LEWIDTH-NEXT: entry:
2459 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2460 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -16776961
2461 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 256
2462 // LEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2463 // LEWIDTH-NEXT: ret void
2465 // BEWIDTH-LABEL: @store_st12(
2466 // BEWIDTH-NEXT: entry:
2467 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2468 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -16776961
2469 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 256
2470 // BEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2471 // BEWIDTH-NEXT: ret void
2473 // LEWIDTHNUM-LABEL: @store_st12(
2474 // LEWIDTHNUM-NEXT: entry:
2475 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2476 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -16776961
2477 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 256
2478 // LEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2479 // LEWIDTHNUM-NEXT: ret void
2481 // BEWIDTHNUM-LABEL: @store_st12(
2482 // BEWIDTHNUM-NEXT: entry:
2483 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2484 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD]], -16776961
2485 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], 256
2486 // BEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2487 // BEWIDTHNUM-NEXT: ret void
2489 void store_st12(volatile struct st12 *m) {
2490 m->f = 1;
2493 // LE-LABEL: @increment_st12(
2494 // LE-NEXT: entry:
2495 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2496 // LE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2497 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2498 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2499 // LE-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2500 // LE-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
2501 // LE-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 8
2502 // LE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16776961
2503 // LE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2504 // LE-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2505 // LE-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
2506 // LE-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
2507 // LE-NEXT: ret void
2509 // BE-LABEL: @increment_st12(
2510 // BE-NEXT: entry:
2511 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2512 // BE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2513 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2514 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2515 // BE-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2516 // BE-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
2517 // BE-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 8
2518 // BE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16776961
2519 // BE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2520 // BE-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2521 // BE-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
2522 // BE-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
2523 // BE-NEXT: ret void
2525 // LENUMLOADS-LABEL: @increment_st12(
2526 // LENUMLOADS-NEXT: entry:
2527 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2528 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2529 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2530 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2531 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2532 // LENUMLOADS-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
2533 // LENUMLOADS-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 8
2534 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16776961
2535 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2536 // LENUMLOADS-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2537 // LENUMLOADS-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
2538 // LENUMLOADS-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
2539 // LENUMLOADS-NEXT: ret void
2541 // BENUMLOADS-LABEL: @increment_st12(
2542 // BENUMLOADS-NEXT: entry:
2543 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2544 // BENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2545 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2546 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2547 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2548 // BENUMLOADS-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
2549 // BENUMLOADS-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 8
2550 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16776961
2551 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2552 // BENUMLOADS-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2553 // BENUMLOADS-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
2554 // BENUMLOADS-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
2555 // BENUMLOADS-NEXT: ret void
2557 // LEWIDTH-LABEL: @increment_st12(
2558 // LEWIDTH-NEXT: entry:
2559 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2560 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2561 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2562 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2563 // LEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2564 // LEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
2565 // LEWIDTH-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 8
2566 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16776961
2567 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2568 // LEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2569 // LEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
2570 // LEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
2571 // LEWIDTH-NEXT: ret void
2573 // BEWIDTH-LABEL: @increment_st12(
2574 // BEWIDTH-NEXT: entry:
2575 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2576 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2577 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2578 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2579 // BEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2580 // BEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
2581 // BEWIDTH-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 8
2582 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16776961
2583 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2584 // BEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2585 // BEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
2586 // BEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
2587 // BEWIDTH-NEXT: ret void
2589 // LEWIDTHNUM-LABEL: @increment_st12(
2590 // LEWIDTHNUM-NEXT: entry:
2591 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2592 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2593 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2594 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2595 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2596 // LEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
2597 // LEWIDTHNUM-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 8
2598 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16776961
2599 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2600 // LEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2601 // LEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
2602 // LEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
2603 // LEWIDTHNUM-NEXT: ret void
2605 // BEWIDTHNUM-LABEL: @increment_st12(
2606 // BEWIDTHNUM-NEXT: entry:
2607 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2608 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
2609 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
2610 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2611 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2612 // BEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
2613 // BEWIDTHNUM-NEXT: [[BF_SHL2:%.*]] = shl i32 [[BF_VALUE]], 8
2614 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16776961
2615 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL2]]
2616 // BEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2617 // BEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
2618 // BEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
2619 // BEWIDTHNUM-NEXT: ret void
2621 void increment_st12(volatile struct st12 *m) {
2622 ++m->f;
2625 // LE-LABEL: @increment_e_st12(
2626 // LE-NEXT: entry:
2627 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2628 // LE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 24
2629 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
2630 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2631 // LE-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2632 // LE-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2633 // LE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -256
2634 // LE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
2635 // LE-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2636 // LE-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2637 // LE-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2638 // LE-NEXT: ret void
2640 // BE-LABEL: @increment_e_st12(
2641 // BE-NEXT: entry:
2642 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2643 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 24
2644 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2645 // BE-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2646 // BE-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2647 // BE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2648 // BE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 16777215
2649 // BE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
2650 // BE-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2651 // BE-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2652 // BE-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2653 // BE-NEXT: ret void
2655 // LENUMLOADS-LABEL: @increment_e_st12(
2656 // LENUMLOADS-NEXT: entry:
2657 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2658 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 24
2659 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
2660 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2661 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2662 // LENUMLOADS-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2663 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -256
2664 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
2665 // LENUMLOADS-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2666 // LENUMLOADS-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2667 // LENUMLOADS-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2668 // LENUMLOADS-NEXT: ret void
2670 // BENUMLOADS-LABEL: @increment_e_st12(
2671 // BENUMLOADS-NEXT: entry:
2672 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2673 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 24
2674 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2675 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2676 // BENUMLOADS-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2677 // BENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2678 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 16777215
2679 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
2680 // BENUMLOADS-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2681 // BENUMLOADS-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2682 // BENUMLOADS-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2683 // BENUMLOADS-NEXT: ret void
2685 // LEWIDTH-LABEL: @increment_e_st12(
2686 // LEWIDTH-NEXT: entry:
2687 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2688 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 24
2689 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
2690 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2691 // LEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2692 // LEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2693 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -256
2694 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
2695 // LEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2696 // LEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2697 // LEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2698 // LEWIDTH-NEXT: ret void
2700 // BEWIDTH-LABEL: @increment_e_st12(
2701 // BEWIDTH-NEXT: entry:
2702 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2703 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 24
2704 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2705 // BEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2706 // BEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2707 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2708 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 16777215
2709 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
2710 // BEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2711 // BEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2712 // BEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2713 // BEWIDTH-NEXT: ret void
2715 // LEWIDTHNUM-LABEL: @increment_e_st12(
2716 // LEWIDTHNUM-NEXT: entry:
2717 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2718 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 24
2719 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 24
2720 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2721 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2722 // LEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2723 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -256
2724 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
2725 // LEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2726 // LEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2727 // LEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2728 // LEWIDTHNUM-NEXT: ret void
2730 // BEWIDTHNUM-LABEL: @increment_e_st12(
2731 // BEWIDTHNUM-NEXT: entry:
2732 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[M:%.*]], align 4
2733 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 24
2734 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
2735 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[M]], align 4
2736 // BEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 255
2737 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2738 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 16777215
2739 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
2740 // BEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[M]], align 4
2741 // BEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 24
2742 // BEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 24
2743 // BEWIDTHNUM-NEXT: ret void
2745 void increment_e_st12(volatile struct st12 *m) {
2746 ++m->e;
2749 struct st13 {
2750 char a : 8;
2751 int b : 32;
2752 } __attribute__((packed));
2754 // LE-LABEL: @increment_b_st13(
2755 // LE-NEXT: entry:
2756 // LE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST13:%.*]], ptr [[S:%.*]], i32 0, i32 1
2757 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 1
2758 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
2759 // LE-NEXT: store volatile i32 [[INC]], ptr [[B]], align 1
2760 // LE-NEXT: ret void
2762 // BE-LABEL: @increment_b_st13(
2763 // BE-NEXT: entry:
2764 // BE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST13:%.*]], ptr [[S:%.*]], i32 0, i32 1
2765 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 1
2766 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
2767 // BE-NEXT: store volatile i32 [[INC]], ptr [[B]], align 1
2768 // BE-NEXT: ret void
2770 // LENUMLOADS-LABEL: @increment_b_st13(
2771 // LENUMLOADS-NEXT: entry:
2772 // LENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST13:%.*]], ptr [[S:%.*]], i32 0, i32 1
2773 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 1
2774 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
2775 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 1
2776 // LENUMLOADS-NEXT: store volatile i32 [[INC]], ptr [[B]], align 1
2777 // LENUMLOADS-NEXT: ret void
2779 // BENUMLOADS-LABEL: @increment_b_st13(
2780 // BENUMLOADS-NEXT: entry:
2781 // BENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST13:%.*]], ptr [[S:%.*]], i32 0, i32 1
2782 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 1
2783 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
2784 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 1
2785 // BENUMLOADS-NEXT: store volatile i32 [[INC]], ptr [[B]], align 1
2786 // BENUMLOADS-NEXT: ret void
2788 // LEWIDTH-LABEL: @increment_b_st13(
2789 // LEWIDTH-NEXT: entry:
2790 // LEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST13:%.*]], ptr [[S:%.*]], i32 0, i32 1
2791 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 1
2792 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
2793 // LEWIDTH-NEXT: store volatile i32 [[INC]], ptr [[B]], align 1
2794 // LEWIDTH-NEXT: ret void
2796 // BEWIDTH-LABEL: @increment_b_st13(
2797 // BEWIDTH-NEXT: entry:
2798 // BEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST13:%.*]], ptr [[S:%.*]], i32 0, i32 1
2799 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 1
2800 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
2801 // BEWIDTH-NEXT: store volatile i32 [[INC]], ptr [[B]], align 1
2802 // BEWIDTH-NEXT: ret void
2804 // LEWIDTHNUM-LABEL: @increment_b_st13(
2805 // LEWIDTHNUM-NEXT: entry:
2806 // LEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST13:%.*]], ptr [[S:%.*]], i32 0, i32 1
2807 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 1
2808 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
2809 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 1
2810 // LEWIDTHNUM-NEXT: store volatile i32 [[INC]], ptr [[B]], align 1
2811 // LEWIDTHNUM-NEXT: ret void
2813 // BEWIDTHNUM-LABEL: @increment_b_st13(
2814 // BEWIDTHNUM-NEXT: entry:
2815 // BEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST13:%.*]], ptr [[S:%.*]], i32 0, i32 1
2816 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 1
2817 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
2818 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 1
2819 // BEWIDTHNUM-NEXT: store volatile i32 [[INC]], ptr [[B]], align 1
2820 // BEWIDTHNUM-NEXT: ret void
2822 void increment_b_st13(volatile struct st13 *s) {
2823 s->b++;
2826 struct st14 {
2827 char a : 8;
2828 } __attribute__((packed));
2830 // LE-LABEL: @increment_a_st14(
2831 // LE-NEXT: entry:
2832 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2833 // LE-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
2834 // LE-NEXT: store volatile i8 [[INC]], ptr [[S]], align 1
2835 // LE-NEXT: ret void
2837 // BE-LABEL: @increment_a_st14(
2838 // BE-NEXT: entry:
2839 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2840 // BE-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
2841 // BE-NEXT: store volatile i8 [[INC]], ptr [[S]], align 1
2842 // BE-NEXT: ret void
2844 // LENUMLOADS-LABEL: @increment_a_st14(
2845 // LENUMLOADS-NEXT: entry:
2846 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2847 // LENUMLOADS-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
2848 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 1
2849 // LENUMLOADS-NEXT: store volatile i8 [[INC]], ptr [[S]], align 1
2850 // LENUMLOADS-NEXT: ret void
2852 // BENUMLOADS-LABEL: @increment_a_st14(
2853 // BENUMLOADS-NEXT: entry:
2854 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2855 // BENUMLOADS-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
2856 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 1
2857 // BENUMLOADS-NEXT: store volatile i8 [[INC]], ptr [[S]], align 1
2858 // BENUMLOADS-NEXT: ret void
2860 // LEWIDTH-LABEL: @increment_a_st14(
2861 // LEWIDTH-NEXT: entry:
2862 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2863 // LEWIDTH-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
2864 // LEWIDTH-NEXT: store volatile i8 [[INC]], ptr [[S]], align 1
2865 // LEWIDTH-NEXT: ret void
2867 // BEWIDTH-LABEL: @increment_a_st14(
2868 // BEWIDTH-NEXT: entry:
2869 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2870 // BEWIDTH-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
2871 // BEWIDTH-NEXT: store volatile i8 [[INC]], ptr [[S]], align 1
2872 // BEWIDTH-NEXT: ret void
2874 // LEWIDTHNUM-LABEL: @increment_a_st14(
2875 // LEWIDTHNUM-NEXT: entry:
2876 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2877 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
2878 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 1
2879 // LEWIDTHNUM-NEXT: store volatile i8 [[INC]], ptr [[S]], align 1
2880 // LEWIDTHNUM-NEXT: ret void
2882 // BEWIDTHNUM-LABEL: @increment_a_st14(
2883 // BEWIDTHNUM-NEXT: entry:
2884 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2885 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
2886 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 1
2887 // BEWIDTHNUM-NEXT: store volatile i8 [[INC]], ptr [[S]], align 1
2888 // BEWIDTHNUM-NEXT: ret void
2890 void increment_a_st14(volatile struct st14 *s) {
2891 s->a++;
2894 struct st15 {
2895 short a : 8;
2896 } __attribute__((packed));
2898 // LE-LABEL: @increment_a_st15(
2899 // LE-NEXT: entry:
2900 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2901 // LE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i16
2902 // LE-NEXT: [[INC:%.*]] = add i16 [[BF_CAST]], 1
2903 // LE-NEXT: [[TMP0:%.*]] = trunc i16 [[INC]] to i8
2904 // LE-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 1
2905 // LE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i16
2906 // LE-NEXT: ret void
2908 // BE-LABEL: @increment_a_st15(
2909 // BE-NEXT: entry:
2910 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2911 // BE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i16
2912 // BE-NEXT: [[INC:%.*]] = add i16 [[BF_CAST]], 1
2913 // BE-NEXT: [[TMP0:%.*]] = trunc i16 [[INC]] to i8
2914 // BE-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 1
2915 // BE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i16
2916 // BE-NEXT: ret void
2918 // LENUMLOADS-LABEL: @increment_a_st15(
2919 // LENUMLOADS-NEXT: entry:
2920 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2921 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i16
2922 // LENUMLOADS-NEXT: [[INC:%.*]] = add i16 [[BF_CAST]], 1
2923 // LENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i16 [[INC]] to i8
2924 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 1
2925 // LENUMLOADS-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 1
2926 // LENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i16
2927 // LENUMLOADS-NEXT: ret void
2929 // BENUMLOADS-LABEL: @increment_a_st15(
2930 // BENUMLOADS-NEXT: entry:
2931 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2932 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i16
2933 // BENUMLOADS-NEXT: [[INC:%.*]] = add i16 [[BF_CAST]], 1
2934 // BENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i16 [[INC]] to i8
2935 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 1
2936 // BENUMLOADS-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 1
2937 // BENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i16
2938 // BENUMLOADS-NEXT: ret void
2940 // LEWIDTH-LABEL: @increment_a_st15(
2941 // LEWIDTH-NEXT: entry:
2942 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2943 // LEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i16
2944 // LEWIDTH-NEXT: [[INC:%.*]] = add i16 [[BF_CAST]], 1
2945 // LEWIDTH-NEXT: [[TMP0:%.*]] = trunc i16 [[INC]] to i8
2946 // LEWIDTH-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 1
2947 // LEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i16
2948 // LEWIDTH-NEXT: ret void
2950 // BEWIDTH-LABEL: @increment_a_st15(
2951 // BEWIDTH-NEXT: entry:
2952 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2953 // BEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i16
2954 // BEWIDTH-NEXT: [[INC:%.*]] = add i16 [[BF_CAST]], 1
2955 // BEWIDTH-NEXT: [[TMP0:%.*]] = trunc i16 [[INC]] to i8
2956 // BEWIDTH-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 1
2957 // BEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i16
2958 // BEWIDTH-NEXT: ret void
2960 // LEWIDTHNUM-LABEL: @increment_a_st15(
2961 // LEWIDTHNUM-NEXT: entry:
2962 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2963 // LEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i16
2964 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add i16 [[BF_CAST]], 1
2965 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i16 [[INC]] to i8
2966 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 1
2967 // LEWIDTHNUM-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 1
2968 // LEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i16
2969 // LEWIDTHNUM-NEXT: ret void
2971 // BEWIDTHNUM-LABEL: @increment_a_st15(
2972 // BEWIDTHNUM-NEXT: entry:
2973 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 1
2974 // BEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i16
2975 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add i16 [[BF_CAST]], 1
2976 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i16 [[INC]] to i8
2977 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 1
2978 // BEWIDTHNUM-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 1
2979 // BEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i16
2980 // BEWIDTHNUM-NEXT: ret void
2982 void increment_a_st15(volatile struct st15 *s) {
2983 s->a++;
2986 struct st16 {
2987 int a : 32;
2988 int b : 16;
2989 int c : 32;
2990 int d : 16;
2993 // LE-LABEL: @increment_a_st16(
2994 // LE-NEXT: entry:
2995 // LE-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[S:%.*]], align 4
2996 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
2997 // LE-NEXT: store i32 [[INC]], ptr [[S]], align 4
2998 // LE-NEXT: ret void
3000 // BE-LABEL: @increment_a_st16(
3001 // BE-NEXT: entry:
3002 // BE-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[S:%.*]], align 4
3003 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3004 // BE-NEXT: store i32 [[INC]], ptr [[S]], align 4
3005 // BE-NEXT: ret void
3007 // LENUMLOADS-LABEL: @increment_a_st16(
3008 // LENUMLOADS-NEXT: entry:
3009 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[S:%.*]], align 4
3010 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3011 // LENUMLOADS-NEXT: store i32 [[INC]], ptr [[S]], align 4
3012 // LENUMLOADS-NEXT: ret void
3014 // BENUMLOADS-LABEL: @increment_a_st16(
3015 // BENUMLOADS-NEXT: entry:
3016 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[S:%.*]], align 4
3017 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3018 // BENUMLOADS-NEXT: store i32 [[INC]], ptr [[S]], align 4
3019 // BENUMLOADS-NEXT: ret void
3021 // LEWIDTH-LABEL: @increment_a_st16(
3022 // LEWIDTH-NEXT: entry:
3023 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[S:%.*]], align 4
3024 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3025 // LEWIDTH-NEXT: store i32 [[INC]], ptr [[S]], align 4
3026 // LEWIDTH-NEXT: ret void
3028 // BEWIDTH-LABEL: @increment_a_st16(
3029 // BEWIDTH-NEXT: entry:
3030 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[S:%.*]], align 4
3031 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3032 // BEWIDTH-NEXT: store i32 [[INC]], ptr [[S]], align 4
3033 // BEWIDTH-NEXT: ret void
3035 // LEWIDTHNUM-LABEL: @increment_a_st16(
3036 // LEWIDTHNUM-NEXT: entry:
3037 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[S:%.*]], align 4
3038 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3039 // LEWIDTHNUM-NEXT: store i32 [[INC]], ptr [[S]], align 4
3040 // LEWIDTHNUM-NEXT: ret void
3042 // BEWIDTHNUM-LABEL: @increment_a_st16(
3043 // BEWIDTHNUM-NEXT: entry:
3044 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[S:%.*]], align 4
3045 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3046 // BEWIDTHNUM-NEXT: store i32 [[INC]], ptr [[S]], align 4
3047 // BEWIDTHNUM-NEXT: ret void
3049 void increment_a_st16(struct st16 *s) {
3050 s->a++;
3053 // LE-LABEL: @increment_b_st16(
3054 // LE-NEXT: entry:
3055 // LE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3056 // LE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[B]], align 4
3057 // LE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3058 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3059 // LE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3060 // LE-NEXT: store i16 [[TMP0]], ptr [[B]], align 4
3061 // LE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3062 // LE-NEXT: ret void
3064 // BE-LABEL: @increment_b_st16(
3065 // BE-NEXT: entry:
3066 // BE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3067 // BE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[B]], align 4
3068 // BE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3069 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3070 // BE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3071 // BE-NEXT: store i16 [[TMP0]], ptr [[B]], align 4
3072 // BE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3073 // BE-NEXT: ret void
3075 // LENUMLOADS-LABEL: @increment_b_st16(
3076 // LENUMLOADS-NEXT: entry:
3077 // LENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3078 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[B]], align 4
3079 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3080 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3081 // LENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3082 // LENUMLOADS-NEXT: store i16 [[TMP0]], ptr [[B]], align 4
3083 // LENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3084 // LENUMLOADS-NEXT: ret void
3086 // BENUMLOADS-LABEL: @increment_b_st16(
3087 // BENUMLOADS-NEXT: entry:
3088 // BENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3089 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[B]], align 4
3090 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3091 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3092 // BENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3093 // BENUMLOADS-NEXT: store i16 [[TMP0]], ptr [[B]], align 4
3094 // BENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3095 // BENUMLOADS-NEXT: ret void
3097 // LEWIDTH-LABEL: @increment_b_st16(
3098 // LEWIDTH-NEXT: entry:
3099 // LEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3100 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[B]], align 4
3101 // LEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3102 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3103 // LEWIDTH-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3104 // LEWIDTH-NEXT: store i16 [[TMP0]], ptr [[B]], align 4
3105 // LEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3106 // LEWIDTH-NEXT: ret void
3108 // BEWIDTH-LABEL: @increment_b_st16(
3109 // BEWIDTH-NEXT: entry:
3110 // BEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3111 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[B]], align 4
3112 // BEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3113 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3114 // BEWIDTH-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3115 // BEWIDTH-NEXT: store i16 [[TMP0]], ptr [[B]], align 4
3116 // BEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3117 // BEWIDTH-NEXT: ret void
3119 // LEWIDTHNUM-LABEL: @increment_b_st16(
3120 // LEWIDTHNUM-NEXT: entry:
3121 // LEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3122 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[B]], align 4
3123 // LEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3124 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3125 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3126 // LEWIDTHNUM-NEXT: store i16 [[TMP0]], ptr [[B]], align 4
3127 // LEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3128 // LEWIDTHNUM-NEXT: ret void
3130 // BEWIDTHNUM-LABEL: @increment_b_st16(
3131 // BEWIDTHNUM-NEXT: entry:
3132 // BEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3133 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[B]], align 4
3134 // BEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3135 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3136 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3137 // BEWIDTHNUM-NEXT: store i16 [[TMP0]], ptr [[B]], align 4
3138 // BEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3139 // BEWIDTHNUM-NEXT: ret void
3141 void increment_b_st16(struct st16 *s) {
3142 s->b++;
3145 // LE-LABEL: @increment_c_st16(
3146 // LE-NEXT: entry:
3147 // LE-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3148 // LE-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[C]], align 4
3149 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3150 // LE-NEXT: store i32 [[INC]], ptr [[C]], align 4
3151 // LE-NEXT: ret void
3153 // BE-LABEL: @increment_c_st16(
3154 // BE-NEXT: entry:
3155 // BE-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3156 // BE-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[C]], align 4
3157 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3158 // BE-NEXT: store i32 [[INC]], ptr [[C]], align 4
3159 // BE-NEXT: ret void
3161 // LENUMLOADS-LABEL: @increment_c_st16(
3162 // LENUMLOADS-NEXT: entry:
3163 // LENUMLOADS-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3164 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[C]], align 4
3165 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3166 // LENUMLOADS-NEXT: store i32 [[INC]], ptr [[C]], align 4
3167 // LENUMLOADS-NEXT: ret void
3169 // BENUMLOADS-LABEL: @increment_c_st16(
3170 // BENUMLOADS-NEXT: entry:
3171 // BENUMLOADS-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3172 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[C]], align 4
3173 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3174 // BENUMLOADS-NEXT: store i32 [[INC]], ptr [[C]], align 4
3175 // BENUMLOADS-NEXT: ret void
3177 // LEWIDTH-LABEL: @increment_c_st16(
3178 // LEWIDTH-NEXT: entry:
3179 // LEWIDTH-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3180 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[C]], align 4
3181 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3182 // LEWIDTH-NEXT: store i32 [[INC]], ptr [[C]], align 4
3183 // LEWIDTH-NEXT: ret void
3185 // BEWIDTH-LABEL: @increment_c_st16(
3186 // BEWIDTH-NEXT: entry:
3187 // BEWIDTH-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3188 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[C]], align 4
3189 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3190 // BEWIDTH-NEXT: store i32 [[INC]], ptr [[C]], align 4
3191 // BEWIDTH-NEXT: ret void
3193 // LEWIDTHNUM-LABEL: @increment_c_st16(
3194 // LEWIDTHNUM-NEXT: entry:
3195 // LEWIDTHNUM-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3196 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[C]], align 4
3197 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3198 // LEWIDTHNUM-NEXT: store i32 [[INC]], ptr [[C]], align 4
3199 // LEWIDTHNUM-NEXT: ret void
3201 // BEWIDTHNUM-LABEL: @increment_c_st16(
3202 // BEWIDTHNUM-NEXT: entry:
3203 // BEWIDTHNUM-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3204 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i32, ptr [[C]], align 4
3205 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3206 // BEWIDTHNUM-NEXT: store i32 [[INC]], ptr [[C]], align 4
3207 // BEWIDTHNUM-NEXT: ret void
3209 void increment_c_st16(struct st16 *s) {
3210 s->c++;
3213 // LE-LABEL: @increment_d_st16(
3214 // LE-NEXT: entry:
3215 // LE-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3216 // LE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[D]], align 4
3217 // LE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3218 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3219 // LE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3220 // LE-NEXT: store i16 [[TMP0]], ptr [[D]], align 4
3221 // LE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3222 // LE-NEXT: ret void
3224 // BE-LABEL: @increment_d_st16(
3225 // BE-NEXT: entry:
3226 // BE-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3227 // BE-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[D]], align 4
3228 // BE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3229 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3230 // BE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3231 // BE-NEXT: store i16 [[TMP0]], ptr [[D]], align 4
3232 // BE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3233 // BE-NEXT: ret void
3235 // LENUMLOADS-LABEL: @increment_d_st16(
3236 // LENUMLOADS-NEXT: entry:
3237 // LENUMLOADS-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3238 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[D]], align 4
3239 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3240 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3241 // LENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3242 // LENUMLOADS-NEXT: store i16 [[TMP0]], ptr [[D]], align 4
3243 // LENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3244 // LENUMLOADS-NEXT: ret void
3246 // BENUMLOADS-LABEL: @increment_d_st16(
3247 // BENUMLOADS-NEXT: entry:
3248 // BENUMLOADS-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3249 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[D]], align 4
3250 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3251 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3252 // BENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3253 // BENUMLOADS-NEXT: store i16 [[TMP0]], ptr [[D]], align 4
3254 // BENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3255 // BENUMLOADS-NEXT: ret void
3257 // LEWIDTH-LABEL: @increment_d_st16(
3258 // LEWIDTH-NEXT: entry:
3259 // LEWIDTH-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3260 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[D]], align 4
3261 // LEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3262 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3263 // LEWIDTH-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3264 // LEWIDTH-NEXT: store i16 [[TMP0]], ptr [[D]], align 4
3265 // LEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3266 // LEWIDTH-NEXT: ret void
3268 // BEWIDTH-LABEL: @increment_d_st16(
3269 // BEWIDTH-NEXT: entry:
3270 // BEWIDTH-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3271 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[D]], align 4
3272 // BEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3273 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3274 // BEWIDTH-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3275 // BEWIDTH-NEXT: store i16 [[TMP0]], ptr [[D]], align 4
3276 // BEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3277 // BEWIDTH-NEXT: ret void
3279 // LEWIDTHNUM-LABEL: @increment_d_st16(
3280 // LEWIDTHNUM-NEXT: entry:
3281 // LEWIDTHNUM-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3282 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[D]], align 4
3283 // LEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3284 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3285 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3286 // LEWIDTHNUM-NEXT: store i16 [[TMP0]], ptr [[D]], align 4
3287 // LEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3288 // LEWIDTHNUM-NEXT: ret void
3290 // BEWIDTHNUM-LABEL: @increment_d_st16(
3291 // BEWIDTHNUM-NEXT: entry:
3292 // BEWIDTHNUM-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3293 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[D]], align 4
3294 // BEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3295 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3296 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3297 // BEWIDTHNUM-NEXT: store i16 [[TMP0]], ptr [[D]], align 4
3298 // BEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3299 // BEWIDTHNUM-NEXT: ret void
3301 void increment_d_st16(struct st16 *s) {
3302 s->d++;
3305 // LE-LABEL: @increment_v_a_st16(
3306 // LE-NEXT: entry:
3307 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 4
3308 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3309 // LE-NEXT: store volatile i32 [[INC]], ptr [[S]], align 4
3310 // LE-NEXT: ret void
3312 // BE-LABEL: @increment_v_a_st16(
3313 // BE-NEXT: entry:
3314 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 4
3315 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3316 // BE-NEXT: store volatile i32 [[INC]], ptr [[S]], align 4
3317 // BE-NEXT: ret void
3319 // LENUMLOADS-LABEL: @increment_v_a_st16(
3320 // LENUMLOADS-NEXT: entry:
3321 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 4
3322 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3323 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[S]], align 4
3324 // LENUMLOADS-NEXT: store volatile i32 [[INC]], ptr [[S]], align 4
3325 // LENUMLOADS-NEXT: ret void
3327 // BENUMLOADS-LABEL: @increment_v_a_st16(
3328 // BENUMLOADS-NEXT: entry:
3329 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 4
3330 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3331 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[S]], align 4
3332 // BENUMLOADS-NEXT: store volatile i32 [[INC]], ptr [[S]], align 4
3333 // BENUMLOADS-NEXT: ret void
3335 // LEWIDTH-LABEL: @increment_v_a_st16(
3336 // LEWIDTH-NEXT: entry:
3337 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 4
3338 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3339 // LEWIDTH-NEXT: store volatile i32 [[INC]], ptr [[S]], align 4
3340 // LEWIDTH-NEXT: ret void
3342 // BEWIDTH-LABEL: @increment_v_a_st16(
3343 // BEWIDTH-NEXT: entry:
3344 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 4
3345 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3346 // BEWIDTH-NEXT: store volatile i32 [[INC]], ptr [[S]], align 4
3347 // BEWIDTH-NEXT: ret void
3349 // LEWIDTHNUM-LABEL: @increment_v_a_st16(
3350 // LEWIDTHNUM-NEXT: entry:
3351 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 4
3352 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3353 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[S]], align 4
3354 // LEWIDTHNUM-NEXT: store volatile i32 [[INC]], ptr [[S]], align 4
3355 // LEWIDTHNUM-NEXT: ret void
3357 // BEWIDTHNUM-LABEL: @increment_v_a_st16(
3358 // BEWIDTHNUM-NEXT: entry:
3359 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 4
3360 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3361 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[S]], align 4
3362 // BEWIDTHNUM-NEXT: store volatile i32 [[INC]], ptr [[S]], align 4
3363 // BEWIDTHNUM-NEXT: ret void
3365 void increment_v_a_st16(volatile struct st16 *s) {
3366 s->a++;
3369 // LE-LABEL: @increment_v_b_st16(
3370 // LE-NEXT: entry:
3371 // LE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3372 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[B]], align 4
3373 // LE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3374 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3375 // LE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3376 // LE-NEXT: store volatile i16 [[TMP0]], ptr [[B]], align 4
3377 // LE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3378 // LE-NEXT: ret void
3380 // BE-LABEL: @increment_v_b_st16(
3381 // BE-NEXT: entry:
3382 // BE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3383 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[B]], align 4
3384 // BE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3385 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3386 // BE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3387 // BE-NEXT: store volatile i16 [[TMP0]], ptr [[B]], align 4
3388 // BE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3389 // BE-NEXT: ret void
3391 // LENUMLOADS-LABEL: @increment_v_b_st16(
3392 // LENUMLOADS-NEXT: entry:
3393 // LENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3394 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[B]], align 4
3395 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3396 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3397 // LENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3398 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[B]], align 4
3399 // LENUMLOADS-NEXT: store volatile i16 [[TMP0]], ptr [[B]], align 4
3400 // LENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3401 // LENUMLOADS-NEXT: ret void
3403 // BENUMLOADS-LABEL: @increment_v_b_st16(
3404 // BENUMLOADS-NEXT: entry:
3405 // BENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 1
3406 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[B]], align 4
3407 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3408 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3409 // BENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3410 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[B]], align 4
3411 // BENUMLOADS-NEXT: store volatile i16 [[TMP0]], ptr [[B]], align 4
3412 // BENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3413 // BENUMLOADS-NEXT: ret void
3415 // LEWIDTH-LABEL: @increment_v_b_st16(
3416 // LEWIDTH-NEXT: entry:
3417 // LEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, ptr [[S:%.*]], i32 1
3418 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3419 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 16
3420 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
3421 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
3422 // LEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3423 // LEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
3424 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -65536
3425 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
3426 // LEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[TMP0]], align 4
3427 // LEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3428 // LEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
3429 // LEWIDTH-NEXT: ret void
3431 // BEWIDTH-LABEL: @increment_v_b_st16(
3432 // BEWIDTH-NEXT: entry:
3433 // BEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, ptr [[S:%.*]], i32 1
3434 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3435 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 16
3436 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
3437 // BEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3438 // BEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
3439 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3440 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 65535
3441 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
3442 // BEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[TMP0]], align 4
3443 // BEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3444 // BEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
3445 // BEWIDTH-NEXT: ret void
3447 // LEWIDTHNUM-LABEL: @increment_v_b_st16(
3448 // LEWIDTHNUM-NEXT: entry:
3449 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, ptr [[S:%.*]], i32 1
3450 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3451 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 16
3452 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
3453 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
3454 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3455 // LEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
3456 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -65536
3457 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
3458 // LEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[TMP0]], align 4
3459 // LEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3460 // LEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
3461 // LEWIDTHNUM-NEXT: ret void
3463 // BEWIDTHNUM-LABEL: @increment_v_b_st16(
3464 // BEWIDTHNUM-NEXT: entry:
3465 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, ptr [[S:%.*]], i32 1
3466 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3467 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 16
3468 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
3469 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3470 // BEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
3471 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3472 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 65535
3473 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
3474 // BEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[TMP0]], align 4
3475 // BEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3476 // BEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
3477 // BEWIDTHNUM-NEXT: ret void
3479 void increment_v_b_st16(volatile struct st16 *s) {
3480 s->b++;
3483 // LE-LABEL: @increment_v_c_st16(
3484 // LE-NEXT: entry:
3485 // LE-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3486 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[C]], align 4
3487 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3488 // LE-NEXT: store volatile i32 [[INC]], ptr [[C]], align 4
3489 // LE-NEXT: ret void
3491 // BE-LABEL: @increment_v_c_st16(
3492 // BE-NEXT: entry:
3493 // BE-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3494 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[C]], align 4
3495 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3496 // BE-NEXT: store volatile i32 [[INC]], ptr [[C]], align 4
3497 // BE-NEXT: ret void
3499 // LENUMLOADS-LABEL: @increment_v_c_st16(
3500 // LENUMLOADS-NEXT: entry:
3501 // LENUMLOADS-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3502 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[C]], align 4
3503 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3504 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[C]], align 4
3505 // LENUMLOADS-NEXT: store volatile i32 [[INC]], ptr [[C]], align 4
3506 // LENUMLOADS-NEXT: ret void
3508 // BENUMLOADS-LABEL: @increment_v_c_st16(
3509 // BENUMLOADS-NEXT: entry:
3510 // BENUMLOADS-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3511 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[C]], align 4
3512 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3513 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[C]], align 4
3514 // BENUMLOADS-NEXT: store volatile i32 [[INC]], ptr [[C]], align 4
3515 // BENUMLOADS-NEXT: ret void
3517 // LEWIDTH-LABEL: @increment_v_c_st16(
3518 // LEWIDTH-NEXT: entry:
3519 // LEWIDTH-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3520 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[C]], align 4
3521 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3522 // LEWIDTH-NEXT: store volatile i32 [[INC]], ptr [[C]], align 4
3523 // LEWIDTH-NEXT: ret void
3525 // BEWIDTH-LABEL: @increment_v_c_st16(
3526 // BEWIDTH-NEXT: entry:
3527 // BEWIDTH-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3528 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[C]], align 4
3529 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3530 // BEWIDTH-NEXT: store volatile i32 [[INC]], ptr [[C]], align 4
3531 // BEWIDTH-NEXT: ret void
3533 // LEWIDTHNUM-LABEL: @increment_v_c_st16(
3534 // LEWIDTHNUM-NEXT: entry:
3535 // LEWIDTHNUM-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3536 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[C]], align 4
3537 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3538 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[C]], align 4
3539 // LEWIDTHNUM-NEXT: store volatile i32 [[INC]], ptr [[C]], align 4
3540 // LEWIDTHNUM-NEXT: ret void
3542 // BEWIDTHNUM-LABEL: @increment_v_c_st16(
3543 // BEWIDTHNUM-NEXT: entry:
3544 // BEWIDTHNUM-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 2
3545 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[C]], align 4
3546 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3547 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[C]], align 4
3548 // BEWIDTHNUM-NEXT: store volatile i32 [[INC]], ptr [[C]], align 4
3549 // BEWIDTHNUM-NEXT: ret void
3551 void increment_v_c_st16(volatile struct st16 *s) {
3552 s->c++;
3555 // LE-LABEL: @increment_v_d_st16(
3556 // LE-NEXT: entry:
3557 // LE-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3558 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[D]], align 4
3559 // LE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3560 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3561 // LE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3562 // LE-NEXT: store volatile i16 [[TMP0]], ptr [[D]], align 4
3563 // LE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3564 // LE-NEXT: ret void
3566 // BE-LABEL: @increment_v_d_st16(
3567 // BE-NEXT: entry:
3568 // BE-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3569 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[D]], align 4
3570 // BE-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3571 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3572 // BE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3573 // BE-NEXT: store volatile i16 [[TMP0]], ptr [[D]], align 4
3574 // BE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3575 // BE-NEXT: ret void
3577 // LENUMLOADS-LABEL: @increment_v_d_st16(
3578 // LENUMLOADS-NEXT: entry:
3579 // LENUMLOADS-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3580 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[D]], align 4
3581 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3582 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3583 // LENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3584 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[D]], align 4
3585 // LENUMLOADS-NEXT: store volatile i16 [[TMP0]], ptr [[D]], align 4
3586 // LENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3587 // LENUMLOADS-NEXT: ret void
3589 // BENUMLOADS-LABEL: @increment_v_d_st16(
3590 // BENUMLOADS-NEXT: entry:
3591 // BENUMLOADS-NEXT: [[D:%.*]] = getelementptr inbounds nuw [[STRUCT_ST16:%.*]], ptr [[S:%.*]], i32 0, i32 3
3592 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[D]], align 4
3593 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i16 [[BF_LOAD]] to i32
3594 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3595 // BENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i16
3596 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[D]], align 4
3597 // BENUMLOADS-NEXT: store volatile i16 [[TMP0]], ptr [[D]], align 4
3598 // BENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i16 [[TMP0]] to i32
3599 // BENUMLOADS-NEXT: ret void
3601 // LEWIDTH-LABEL: @increment_v_d_st16(
3602 // LEWIDTH-NEXT: entry:
3603 // LEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, ptr [[S:%.*]], i32 3
3604 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3605 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 16
3606 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
3607 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
3608 // LEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3609 // LEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
3610 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -65536
3611 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
3612 // LEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[TMP0]], align 4
3613 // LEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3614 // LEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
3615 // LEWIDTH-NEXT: ret void
3617 // BEWIDTH-LABEL: @increment_v_d_st16(
3618 // BEWIDTH-NEXT: entry:
3619 // BEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, ptr [[S:%.*]], i32 3
3620 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3621 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 16
3622 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
3623 // BEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3624 // BEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
3625 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3626 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 65535
3627 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
3628 // BEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[TMP0]], align 4
3629 // BEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3630 // BEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
3631 // BEWIDTH-NEXT: ret void
3633 // LEWIDTHNUM-LABEL: @increment_v_d_st16(
3634 // LEWIDTHNUM-NEXT: entry:
3635 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, ptr [[S:%.*]], i32 3
3636 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3637 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 16
3638 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 16
3639 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
3640 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3641 // LEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
3642 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -65536
3643 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
3644 // LEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[TMP0]], align 4
3645 // LEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3646 // LEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
3647 // LEWIDTHNUM-NEXT: ret void
3649 // BEWIDTHNUM-LABEL: @increment_v_d_st16(
3650 // BEWIDTHNUM-NEXT: entry:
3651 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, ptr [[S:%.*]], i32 3
3652 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3653 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 16
3654 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
3655 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[TMP0]], align 4
3656 // BEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 65535
3657 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3658 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 65535
3659 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
3660 // BEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[TMP0]], align 4
3661 // BEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 16
3662 // BEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 16
3663 // BEWIDTHNUM-NEXT: ret void
3665 void increment_v_d_st16(volatile struct st16 *s) {
3666 s->d++;
3668 // st17 has alignment = 1, the AAPCS defines nothing for the
3669 // accessing of b, but accessing c should use char
3670 struct st17 {
3671 int b : 32;
3672 char c : 8;
3673 } __attribute__((packed));
3675 // LE-LABEL: @increment_v_b_st17(
3676 // LE-NEXT: entry:
3677 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 1
3678 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3679 // LE-NEXT: store volatile i32 [[INC]], ptr [[S]], align 1
3680 // LE-NEXT: ret void
3682 // BE-LABEL: @increment_v_b_st17(
3683 // BE-NEXT: entry:
3684 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 1
3685 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3686 // BE-NEXT: store volatile i32 [[INC]], ptr [[S]], align 1
3687 // BE-NEXT: ret void
3689 // LENUMLOADS-LABEL: @increment_v_b_st17(
3690 // LENUMLOADS-NEXT: entry:
3691 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 1
3692 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3693 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[S]], align 1
3694 // LENUMLOADS-NEXT: store volatile i32 [[INC]], ptr [[S]], align 1
3695 // LENUMLOADS-NEXT: ret void
3697 // BENUMLOADS-LABEL: @increment_v_b_st17(
3698 // BENUMLOADS-NEXT: entry:
3699 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 1
3700 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3701 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[S]], align 1
3702 // BENUMLOADS-NEXT: store volatile i32 [[INC]], ptr [[S]], align 1
3703 // BENUMLOADS-NEXT: ret void
3705 // LEWIDTH-LABEL: @increment_v_b_st17(
3706 // LEWIDTH-NEXT: entry:
3707 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 1
3708 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3709 // LEWIDTH-NEXT: store volatile i32 [[INC]], ptr [[S]], align 1
3710 // LEWIDTH-NEXT: ret void
3712 // BEWIDTH-LABEL: @increment_v_b_st17(
3713 // BEWIDTH-NEXT: entry:
3714 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 1
3715 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3716 // BEWIDTH-NEXT: store volatile i32 [[INC]], ptr [[S]], align 1
3717 // BEWIDTH-NEXT: ret void
3719 // LEWIDTHNUM-LABEL: @increment_v_b_st17(
3720 // LEWIDTHNUM-NEXT: entry:
3721 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 1
3722 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3723 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[S]], align 1
3724 // LEWIDTHNUM-NEXT: store volatile i32 [[INC]], ptr [[S]], align 1
3725 // LEWIDTHNUM-NEXT: ret void
3727 // BEWIDTHNUM-LABEL: @increment_v_b_st17(
3728 // BEWIDTHNUM-NEXT: entry:
3729 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[S:%.*]], align 1
3730 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_LOAD]], 1
3731 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[S]], align 1
3732 // BEWIDTHNUM-NEXT: store volatile i32 [[INC]], ptr [[S]], align 1
3733 // BEWIDTHNUM-NEXT: ret void
3735 void increment_v_b_st17(volatile struct st17 *s) {
3736 s->b++;
3739 // LE-LABEL: @increment_v_c_st17(
3740 // LE-NEXT: entry:
3741 // LE-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST17:%.*]], ptr [[S:%.*]], i32 0, i32 1
3742 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[C]], align 1
3743 // LE-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
3744 // LE-NEXT: store volatile i8 [[INC]], ptr [[C]], align 1
3745 // LE-NEXT: ret void
3747 // BE-LABEL: @increment_v_c_st17(
3748 // BE-NEXT: entry:
3749 // BE-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST17:%.*]], ptr [[S:%.*]], i32 0, i32 1
3750 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[C]], align 1
3751 // BE-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
3752 // BE-NEXT: store volatile i8 [[INC]], ptr [[C]], align 1
3753 // BE-NEXT: ret void
3755 // LENUMLOADS-LABEL: @increment_v_c_st17(
3756 // LENUMLOADS-NEXT: entry:
3757 // LENUMLOADS-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST17:%.*]], ptr [[S:%.*]], i32 0, i32 1
3758 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[C]], align 1
3759 // LENUMLOADS-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
3760 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
3761 // LENUMLOADS-NEXT: store volatile i8 [[INC]], ptr [[C]], align 1
3762 // LENUMLOADS-NEXT: ret void
3764 // BENUMLOADS-LABEL: @increment_v_c_st17(
3765 // BENUMLOADS-NEXT: entry:
3766 // BENUMLOADS-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST17:%.*]], ptr [[S:%.*]], i32 0, i32 1
3767 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[C]], align 1
3768 // BENUMLOADS-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
3769 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
3770 // BENUMLOADS-NEXT: store volatile i8 [[INC]], ptr [[C]], align 1
3771 // BENUMLOADS-NEXT: ret void
3773 // LEWIDTH-LABEL: @increment_v_c_st17(
3774 // LEWIDTH-NEXT: entry:
3775 // LEWIDTH-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST17:%.*]], ptr [[S:%.*]], i32 0, i32 1
3776 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[C]], align 1
3777 // LEWIDTH-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
3778 // LEWIDTH-NEXT: store volatile i8 [[INC]], ptr [[C]], align 1
3779 // LEWIDTH-NEXT: ret void
3781 // BEWIDTH-LABEL: @increment_v_c_st17(
3782 // BEWIDTH-NEXT: entry:
3783 // BEWIDTH-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST17:%.*]], ptr [[S:%.*]], i32 0, i32 1
3784 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[C]], align 1
3785 // BEWIDTH-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
3786 // BEWIDTH-NEXT: store volatile i8 [[INC]], ptr [[C]], align 1
3787 // BEWIDTH-NEXT: ret void
3789 // LEWIDTHNUM-LABEL: @increment_v_c_st17(
3790 // LEWIDTHNUM-NEXT: entry:
3791 // LEWIDTHNUM-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST17:%.*]], ptr [[S:%.*]], i32 0, i32 1
3792 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[C]], align 1
3793 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
3794 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
3795 // LEWIDTHNUM-NEXT: store volatile i8 [[INC]], ptr [[C]], align 1
3796 // LEWIDTHNUM-NEXT: ret void
3798 // BEWIDTHNUM-LABEL: @increment_v_c_st17(
3799 // BEWIDTHNUM-NEXT: entry:
3800 // BEWIDTHNUM-NEXT: [[C:%.*]] = getelementptr inbounds nuw [[STRUCT_ST17:%.*]], ptr [[S:%.*]], i32 0, i32 1
3801 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[C]], align 1
3802 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add i8 [[BF_LOAD]], 1
3803 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[C]], align 1
3804 // BEWIDTHNUM-NEXT: store volatile i8 [[INC]], ptr [[C]], align 1
3805 // BEWIDTHNUM-NEXT: ret void
3807 void increment_v_c_st17(volatile struct st17 *s) {
3808 s->c++;
3811 // A zero bitfield should block, as the C11 specification
3812 // requires a and b to be different memory positions
3813 struct zero_bitfield {
3814 int a : 8;
3815 char : 0;
3816 int b : 8;
3819 // LE-LABEL: @increment_a_zero_bitfield(
3820 // LE-NEXT: entry:
3821 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 4
3822 // LE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3823 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3824 // LE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3825 // LE-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 4
3826 // LE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3827 // LE-NEXT: ret void
3829 // BE-LABEL: @increment_a_zero_bitfield(
3830 // BE-NEXT: entry:
3831 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 4
3832 // BE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3833 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3834 // BE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3835 // BE-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 4
3836 // BE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3837 // BE-NEXT: ret void
3839 // LENUMLOADS-LABEL: @increment_a_zero_bitfield(
3840 // LENUMLOADS-NEXT: entry:
3841 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 4
3842 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3843 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3844 // LENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3845 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 4
3846 // LENUMLOADS-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 4
3847 // LENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3848 // LENUMLOADS-NEXT: ret void
3850 // BENUMLOADS-LABEL: @increment_a_zero_bitfield(
3851 // BENUMLOADS-NEXT: entry:
3852 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 4
3853 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3854 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3855 // BENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3856 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 4
3857 // BENUMLOADS-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 4
3858 // BENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3859 // BENUMLOADS-NEXT: ret void
3861 // LEWIDTH-LABEL: @increment_a_zero_bitfield(
3862 // LEWIDTH-NEXT: entry:
3863 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 4
3864 // LEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3865 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3866 // LEWIDTH-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3867 // LEWIDTH-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 4
3868 // LEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3869 // LEWIDTH-NEXT: ret void
3871 // BEWIDTH-LABEL: @increment_a_zero_bitfield(
3872 // BEWIDTH-NEXT: entry:
3873 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 4
3874 // BEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3875 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3876 // BEWIDTH-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3877 // BEWIDTH-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 4
3878 // BEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3879 // BEWIDTH-NEXT: ret void
3881 // LEWIDTHNUM-LABEL: @increment_a_zero_bitfield(
3882 // LEWIDTHNUM-NEXT: entry:
3883 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 4
3884 // LEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3885 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3886 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3887 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 4
3888 // LEWIDTHNUM-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 4
3889 // LEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3890 // LEWIDTHNUM-NEXT: ret void
3892 // BEWIDTHNUM-LABEL: @increment_a_zero_bitfield(
3893 // BEWIDTHNUM-NEXT: entry:
3894 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[S:%.*]], align 4
3895 // BEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3896 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3897 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3898 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[S]], align 4
3899 // BEWIDTHNUM-NEXT: store volatile i8 [[TMP0]], ptr [[S]], align 4
3900 // BEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3901 // BEWIDTHNUM-NEXT: ret void
3903 void increment_a_zero_bitfield(volatile struct zero_bitfield *s) {
3904 s->a++;
3907 // LE-LABEL: @increment_b_zero_bitfield(
3908 // LE-NEXT: entry:
3909 // LE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD:%.*]], ptr [[S:%.*]], i32 0, i32 1
3910 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
3911 // LE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3912 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3913 // LE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3914 // LE-NEXT: store volatile i8 [[TMP0]], ptr [[B]], align 1
3915 // LE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3916 // LE-NEXT: ret void
3918 // BE-LABEL: @increment_b_zero_bitfield(
3919 // BE-NEXT: entry:
3920 // BE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD:%.*]], ptr [[S:%.*]], i32 0, i32 1
3921 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
3922 // BE-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3923 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3924 // BE-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3925 // BE-NEXT: store volatile i8 [[TMP0]], ptr [[B]], align 1
3926 // BE-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3927 // BE-NEXT: ret void
3929 // LENUMLOADS-LABEL: @increment_b_zero_bitfield(
3930 // LENUMLOADS-NEXT: entry:
3931 // LENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD:%.*]], ptr [[S:%.*]], i32 0, i32 1
3932 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
3933 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3934 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3935 // LENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3936 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[B]], align 1
3937 // LENUMLOADS-NEXT: store volatile i8 [[TMP0]], ptr [[B]], align 1
3938 // LENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3939 // LENUMLOADS-NEXT: ret void
3941 // BENUMLOADS-LABEL: @increment_b_zero_bitfield(
3942 // BENUMLOADS-NEXT: entry:
3943 // BENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD:%.*]], ptr [[S:%.*]], i32 0, i32 1
3944 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
3945 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3946 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3947 // BENUMLOADS-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3948 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[B]], align 1
3949 // BENUMLOADS-NEXT: store volatile i8 [[TMP0]], ptr [[B]], align 1
3950 // BENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3951 // BENUMLOADS-NEXT: ret void
3953 // LEWIDTH-LABEL: @increment_b_zero_bitfield(
3954 // LEWIDTH-NEXT: entry:
3955 // LEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD:%.*]], ptr [[S:%.*]], i32 0, i32 1
3956 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
3957 // LEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3958 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3959 // LEWIDTH-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3960 // LEWIDTH-NEXT: store volatile i8 [[TMP0]], ptr [[B]], align 1
3961 // LEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3962 // LEWIDTH-NEXT: ret void
3964 // BEWIDTH-LABEL: @increment_b_zero_bitfield(
3965 // BEWIDTH-NEXT: entry:
3966 // BEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD:%.*]], ptr [[S:%.*]], i32 0, i32 1
3967 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
3968 // BEWIDTH-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3969 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3970 // BEWIDTH-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3971 // BEWIDTH-NEXT: store volatile i8 [[TMP0]], ptr [[B]], align 1
3972 // BEWIDTH-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3973 // BEWIDTH-NEXT: ret void
3975 // LEWIDTHNUM-LABEL: @increment_b_zero_bitfield(
3976 // LEWIDTHNUM-NEXT: entry:
3977 // LEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD:%.*]], ptr [[S:%.*]], i32 0, i32 1
3978 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
3979 // LEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3980 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3981 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3982 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[B]], align 1
3983 // LEWIDTHNUM-NEXT: store volatile i8 [[TMP0]], ptr [[B]], align 1
3984 // LEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3985 // LEWIDTHNUM-NEXT: ret void
3987 // BEWIDTHNUM-LABEL: @increment_b_zero_bitfield(
3988 // BEWIDTHNUM-NEXT: entry:
3989 // BEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD:%.*]], ptr [[S:%.*]], i32 0, i32 1
3990 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i8, ptr [[B]], align 1
3991 // BEWIDTHNUM-NEXT: [[BF_CAST:%.*]] = sext i8 [[BF_LOAD]] to i32
3992 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_CAST]], 1
3993 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = trunc i32 [[INC]] to i8
3994 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[B]], align 1
3995 // BEWIDTHNUM-NEXT: store volatile i8 [[TMP0]], ptr [[B]], align 1
3996 // BEWIDTHNUM-NEXT: [[BF_RESULT_CAST:%.*]] = sext i8 [[TMP0]] to i32
3997 // BEWIDTHNUM-NEXT: ret void
3999 void increment_b_zero_bitfield(volatile struct zero_bitfield *s) {
4000 s->b++;
4003 // The zero bitfield here does not affect
4004 struct zero_bitfield_ok {
4005 short a : 8;
4006 char a1 : 8;
4007 long : 0;
4008 int b : 24;
4011 // LE-LABEL: @increment_a_zero_bitfield_ok(
4012 // LE-NEXT: entry:
4013 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[S:%.*]], align 4
4014 // LE-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 8
4015 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
4016 // LE-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
4017 // LE-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[S]], align 4
4018 // LE-NEXT: [[BF_ASHR2:%.*]] = ashr i16 [[BF_LOAD1]], 8
4019 // LE-NEXT: [[BF_CAST:%.*]] = trunc i16 [[BF_ASHR2]] to i8
4020 // LE-NEXT: [[CONV3:%.*]] = sext i8 [[BF_CAST]] to i32
4021 // LE-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV3]], [[CONV]]
4022 // LE-NEXT: [[CONV4:%.*]] = trunc i32 [[ADD]] to i8
4023 // LE-NEXT: [[TMP0:%.*]] = zext i8 [[CONV4]] to i16
4024 // LE-NEXT: [[BF_LOAD5:%.*]] = load volatile i16, ptr [[S]], align 4
4025 // LE-NEXT: [[BF_VALUE:%.*]] = and i16 [[TMP0]], 255
4026 // LE-NEXT: [[BF_SHL6:%.*]] = shl i16 [[BF_VALUE]], 8
4027 // LE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD5]], 255
4028 // LE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], [[BF_SHL6]]
4029 // LE-NEXT: store volatile i16 [[BF_SET]], ptr [[S]], align 4
4030 // LE-NEXT: [[BF_RESULT_SHL:%.*]] = shl i16 [[BF_VALUE]], 8
4031 // LE-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i16 [[BF_RESULT_SHL]], 8
4032 // LE-NEXT: [[BF_RESULT_CAST:%.*]] = trunc i16 [[BF_RESULT_ASHR]] to i8
4033 // LE-NEXT: ret void
4035 // BE-LABEL: @increment_a_zero_bitfield_ok(
4036 // BE-NEXT: entry:
4037 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[S:%.*]], align 4
4038 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 8
4039 // BE-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
4040 // BE-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[S]], align 4
4041 // BE-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD1]], 8
4042 // BE-NEXT: [[BF_ASHR2:%.*]] = ashr i16 [[BF_SHL]], 8
4043 // BE-NEXT: [[BF_CAST:%.*]] = trunc i16 [[BF_ASHR2]] to i8
4044 // BE-NEXT: [[CONV3:%.*]] = sext i8 [[BF_CAST]] to i32
4045 // BE-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV3]], [[CONV]]
4046 // BE-NEXT: [[CONV4:%.*]] = trunc i32 [[ADD]] to i8
4047 // BE-NEXT: [[TMP0:%.*]] = zext i8 [[CONV4]] to i16
4048 // BE-NEXT: [[BF_LOAD5:%.*]] = load volatile i16, ptr [[S]], align 4
4049 // BE-NEXT: [[BF_VALUE:%.*]] = and i16 [[TMP0]], 255
4050 // BE-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD5]], -256
4051 // BE-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], [[BF_VALUE]]
4052 // BE-NEXT: store volatile i16 [[BF_SET]], ptr [[S]], align 4
4053 // BE-NEXT: [[BF_RESULT_SHL:%.*]] = shl i16 [[BF_VALUE]], 8
4054 // BE-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i16 [[BF_RESULT_SHL]], 8
4055 // BE-NEXT: [[BF_RESULT_CAST:%.*]] = trunc i16 [[BF_RESULT_ASHR]] to i8
4056 // BE-NEXT: ret void
4058 // LENUMLOADS-LABEL: @increment_a_zero_bitfield_ok(
4059 // LENUMLOADS-NEXT: entry:
4060 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[S:%.*]], align 4
4061 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 8
4062 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
4063 // LENUMLOADS-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
4064 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[S]], align 4
4065 // LENUMLOADS-NEXT: [[BF_ASHR2:%.*]] = ashr i16 [[BF_LOAD1]], 8
4066 // LENUMLOADS-NEXT: [[BF_CAST:%.*]] = trunc i16 [[BF_ASHR2]] to i8
4067 // LENUMLOADS-NEXT: [[CONV3:%.*]] = sext i8 [[BF_CAST]] to i32
4068 // LENUMLOADS-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV3]], [[CONV]]
4069 // LENUMLOADS-NEXT: [[CONV4:%.*]] = trunc i32 [[ADD]] to i8
4070 // LENUMLOADS-NEXT: [[TMP0:%.*]] = zext i8 [[CONV4]] to i16
4071 // LENUMLOADS-NEXT: [[BF_LOAD5:%.*]] = load volatile i16, ptr [[S]], align 4
4072 // LENUMLOADS-NEXT: [[BF_VALUE:%.*]] = and i16 [[TMP0]], 255
4073 // LENUMLOADS-NEXT: [[BF_SHL6:%.*]] = shl i16 [[BF_VALUE]], 8
4074 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD5]], 255
4075 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], [[BF_SHL6]]
4076 // LENUMLOADS-NEXT: store volatile i16 [[BF_SET]], ptr [[S]], align 4
4077 // LENUMLOADS-NEXT: [[BF_RESULT_SHL:%.*]] = shl i16 [[BF_VALUE]], 8
4078 // LENUMLOADS-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i16 [[BF_RESULT_SHL]], 8
4079 // LENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = trunc i16 [[BF_RESULT_ASHR]] to i8
4080 // LENUMLOADS-NEXT: ret void
4082 // BENUMLOADS-LABEL: @increment_a_zero_bitfield_ok(
4083 // BENUMLOADS-NEXT: entry:
4084 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[S:%.*]], align 4
4085 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 8
4086 // BENUMLOADS-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
4087 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i16, ptr [[S]], align 4
4088 // BENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD1]], 8
4089 // BENUMLOADS-NEXT: [[BF_ASHR2:%.*]] = ashr i16 [[BF_SHL]], 8
4090 // BENUMLOADS-NEXT: [[BF_CAST:%.*]] = trunc i16 [[BF_ASHR2]] to i8
4091 // BENUMLOADS-NEXT: [[CONV3:%.*]] = sext i8 [[BF_CAST]] to i32
4092 // BENUMLOADS-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV3]], [[CONV]]
4093 // BENUMLOADS-NEXT: [[CONV4:%.*]] = trunc i32 [[ADD]] to i8
4094 // BENUMLOADS-NEXT: [[TMP0:%.*]] = zext i8 [[CONV4]] to i16
4095 // BENUMLOADS-NEXT: [[BF_LOAD5:%.*]] = load volatile i16, ptr [[S]], align 4
4096 // BENUMLOADS-NEXT: [[BF_VALUE:%.*]] = and i16 [[TMP0]], 255
4097 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i16 [[BF_LOAD5]], -256
4098 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i16 [[BF_CLEAR]], [[BF_VALUE]]
4099 // BENUMLOADS-NEXT: store volatile i16 [[BF_SET]], ptr [[S]], align 4
4100 // BENUMLOADS-NEXT: [[BF_RESULT_SHL:%.*]] = shl i16 [[BF_VALUE]], 8
4101 // BENUMLOADS-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i16 [[BF_RESULT_SHL]], 8
4102 // BENUMLOADS-NEXT: [[BF_RESULT_CAST:%.*]] = trunc i16 [[BF_RESULT_ASHR]] to i8
4103 // BENUMLOADS-NEXT: ret void
4105 // LEWIDTH-LABEL: @increment_a_zero_bitfield_ok(
4106 // LEWIDTH-NEXT: entry:
4107 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[S:%.*]], align 4
4108 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 8
4109 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
4110 // LEWIDTH-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
4111 // LEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[S]], i32 1
4112 // LEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[TMP0]], align 1
4113 // LEWIDTH-NEXT: [[CONV2:%.*]] = sext i8 [[BF_LOAD1]] to i32
4114 // LEWIDTH-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV2]], [[CONV]]
4115 // LEWIDTH-NEXT: [[CONV3:%.*]] = trunc i32 [[ADD]] to i8
4116 // LEWIDTH-NEXT: store volatile i8 [[CONV3]], ptr [[TMP0]], align 1
4117 // LEWIDTH-NEXT: ret void
4119 // BEWIDTH-LABEL: @increment_a_zero_bitfield_ok(
4120 // BEWIDTH-NEXT: entry:
4121 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[S:%.*]], align 4
4122 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 8
4123 // BEWIDTH-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
4124 // BEWIDTH-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[S]], i32 1
4125 // BEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[TMP0]], align 1
4126 // BEWIDTH-NEXT: [[CONV2:%.*]] = sext i8 [[BF_LOAD1]] to i32
4127 // BEWIDTH-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV2]], [[CONV]]
4128 // BEWIDTH-NEXT: [[CONV3:%.*]] = trunc i32 [[ADD]] to i8
4129 // BEWIDTH-NEXT: store volatile i8 [[CONV3]], ptr [[TMP0]], align 1
4130 // BEWIDTH-NEXT: ret void
4132 // LEWIDTHNUM-LABEL: @increment_a_zero_bitfield_ok(
4133 // LEWIDTHNUM-NEXT: entry:
4134 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[S:%.*]], align 4
4135 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 8
4136 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_SHL]], 8
4137 // LEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
4138 // LEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[S]], i32 1
4139 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[TMP0]], align 1
4140 // LEWIDTHNUM-NEXT: [[CONV2:%.*]] = sext i8 [[BF_LOAD1]] to i32
4141 // LEWIDTHNUM-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV2]], [[CONV]]
4142 // LEWIDTHNUM-NEXT: [[CONV3:%.*]] = trunc i32 [[ADD]] to i8
4143 // LEWIDTHNUM-NEXT: [[BF_LOAD4:%.*]] = load volatile i8, ptr [[TMP0]], align 1
4144 // LEWIDTHNUM-NEXT: store volatile i8 [[CONV3]], ptr [[TMP0]], align 1
4145 // LEWIDTHNUM-NEXT: ret void
4147 // BEWIDTHNUM-LABEL: @increment_a_zero_bitfield_ok(
4148 // BEWIDTHNUM-NEXT: entry:
4149 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i16, ptr [[S:%.*]], align 4
4150 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 8
4151 // BEWIDTHNUM-NEXT: [[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
4152 // BEWIDTHNUM-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[S]], i32 1
4153 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i8, ptr [[TMP0]], align 1
4154 // BEWIDTHNUM-NEXT: [[CONV2:%.*]] = sext i8 [[BF_LOAD1]] to i32
4155 // BEWIDTHNUM-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV2]], [[CONV]]
4156 // BEWIDTHNUM-NEXT: [[CONV3:%.*]] = trunc i32 [[ADD]] to i8
4157 // BEWIDTHNUM-NEXT: [[BF_LOAD4:%.*]] = load volatile i8, ptr [[TMP0]], align 1
4158 // BEWIDTHNUM-NEXT: store volatile i8 [[CONV3]], ptr [[TMP0]], align 1
4159 // BEWIDTHNUM-NEXT: ret void
4161 void increment_a_zero_bitfield_ok(volatile struct zero_bitfield_ok *s) {
4162 s->a1 += s->a;
4165 // LE-LABEL: @increment_b_zero_bitfield_ok(
4166 // LE-NEXT: entry:
4167 // LE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD_OK:%.*]], ptr [[S:%.*]], i32 0, i32 1
4168 // LE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 4
4169 // LE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
4170 // LE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 8
4171 // LE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
4172 // LE-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 4
4173 // LE-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 16777215
4174 // LE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16777216
4175 // LE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
4176 // LE-NEXT: store volatile i32 [[BF_SET]], ptr [[B]], align 4
4177 // LE-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4178 // LE-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 8
4179 // LE-NEXT: ret void
4181 // BE-LABEL: @increment_b_zero_bitfield_ok(
4182 // BE-NEXT: entry:
4183 // BE-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD_OK:%.*]], ptr [[S:%.*]], i32 0, i32 1
4184 // BE-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 4
4185 // BE-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 8
4186 // BE-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
4187 // BE-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 4
4188 // BE-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 16777215
4189 // BE-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4190 // BE-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 255
4191 // BE-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
4192 // BE-NEXT: store volatile i32 [[BF_SET]], ptr [[B]], align 4
4193 // BE-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4194 // BE-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 8
4195 // BE-NEXT: ret void
4197 // LENUMLOADS-LABEL: @increment_b_zero_bitfield_ok(
4198 // LENUMLOADS-NEXT: entry:
4199 // LENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD_OK:%.*]], ptr [[S:%.*]], i32 0, i32 1
4200 // LENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 4
4201 // LENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
4202 // LENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 8
4203 // LENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
4204 // LENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 4
4205 // LENUMLOADS-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 16777215
4206 // LENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16777216
4207 // LENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
4208 // LENUMLOADS-NEXT: store volatile i32 [[BF_SET]], ptr [[B]], align 4
4209 // LENUMLOADS-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4210 // LENUMLOADS-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 8
4211 // LENUMLOADS-NEXT: ret void
4213 // BENUMLOADS-LABEL: @increment_b_zero_bitfield_ok(
4214 // BENUMLOADS-NEXT: entry:
4215 // BENUMLOADS-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD_OK:%.*]], ptr [[S:%.*]], i32 0, i32 1
4216 // BENUMLOADS-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 4
4217 // BENUMLOADS-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 8
4218 // BENUMLOADS-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
4219 // BENUMLOADS-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 4
4220 // BENUMLOADS-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 16777215
4221 // BENUMLOADS-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4222 // BENUMLOADS-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 255
4223 // BENUMLOADS-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
4224 // BENUMLOADS-NEXT: store volatile i32 [[BF_SET]], ptr [[B]], align 4
4225 // BENUMLOADS-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4226 // BENUMLOADS-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 8
4227 // BENUMLOADS-NEXT: ret void
4229 // LEWIDTH-LABEL: @increment_b_zero_bitfield_ok(
4230 // LEWIDTH-NEXT: entry:
4231 // LEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD_OK:%.*]], ptr [[S:%.*]], i32 0, i32 1
4232 // LEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 4
4233 // LEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
4234 // LEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 8
4235 // LEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
4236 // LEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 4
4237 // LEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 16777215
4238 // LEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16777216
4239 // LEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
4240 // LEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[B]], align 4
4241 // LEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4242 // LEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 8
4243 // LEWIDTH-NEXT: ret void
4245 // BEWIDTH-LABEL: @increment_b_zero_bitfield_ok(
4246 // BEWIDTH-NEXT: entry:
4247 // BEWIDTH-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD_OK:%.*]], ptr [[S:%.*]], i32 0, i32 1
4248 // BEWIDTH-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 4
4249 // BEWIDTH-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 8
4250 // BEWIDTH-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
4251 // BEWIDTH-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 4
4252 // BEWIDTH-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 16777215
4253 // BEWIDTH-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4254 // BEWIDTH-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 255
4255 // BEWIDTH-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
4256 // BEWIDTH-NEXT: store volatile i32 [[BF_SET]], ptr [[B]], align 4
4257 // BEWIDTH-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4258 // BEWIDTH-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 8
4259 // BEWIDTH-NEXT: ret void
4261 // LEWIDTHNUM-LABEL: @increment_b_zero_bitfield_ok(
4262 // LEWIDTHNUM-NEXT: entry:
4263 // LEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD_OK:%.*]], ptr [[S:%.*]], i32 0, i32 1
4264 // LEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 4
4265 // LEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_LOAD]], 8
4266 // LEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_SHL]], 8
4267 // LEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
4268 // LEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 4
4269 // LEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 16777215
4270 // LEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -16777216
4271 // LEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
4272 // LEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[B]], align 4
4273 // LEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4274 // LEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 8
4275 // LEWIDTHNUM-NEXT: ret void
4277 // BEWIDTHNUM-LABEL: @increment_b_zero_bitfield_ok(
4278 // BEWIDTHNUM-NEXT: entry:
4279 // BEWIDTHNUM-NEXT: [[B:%.*]] = getelementptr inbounds nuw [[STRUCT_ZERO_BITFIELD_OK:%.*]], ptr [[S:%.*]], i32 0, i32 1
4280 // BEWIDTHNUM-NEXT: [[BF_LOAD:%.*]] = load volatile i32, ptr [[B]], align 4
4281 // BEWIDTHNUM-NEXT: [[BF_ASHR:%.*]] = ashr i32 [[BF_LOAD]], 8
4282 // BEWIDTHNUM-NEXT: [[INC:%.*]] = add nsw i32 [[BF_ASHR]], 1
4283 // BEWIDTHNUM-NEXT: [[BF_LOAD1:%.*]] = load volatile i32, ptr [[B]], align 4
4284 // BEWIDTHNUM-NEXT: [[BF_VALUE:%.*]] = and i32 [[INC]], 16777215
4285 // BEWIDTHNUM-NEXT: [[BF_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4286 // BEWIDTHNUM-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], 255
4287 // BEWIDTHNUM-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_SHL]]
4288 // BEWIDTHNUM-NEXT: store volatile i32 [[BF_SET]], ptr [[B]], align 4
4289 // BEWIDTHNUM-NEXT: [[BF_RESULT_SHL:%.*]] = shl i32 [[BF_VALUE]], 8
4290 // BEWIDTHNUM-NEXT: [[BF_RESULT_ASHR:%.*]] = ashr i32 [[BF_RESULT_SHL]], 8
4291 // BEWIDTHNUM-NEXT: ret void
4293 void increment_b_zero_bitfield_ok(volatile struct zero_bitfield_ok *s) {
4294 s->b++;