File: load.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (481 lines) | stat: -rw-r--r-- 11,965 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc -mtriple=aarch64-none-linux-gnu %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SD
; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-GI

; ===== Legal Scalars =====

define i8 @load_i8(ptr %ptr) {
; CHECK-LABEL: load_i8:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrb w0, [x0]
; CHECK-NEXT:    ret
  %a = load i8, ptr %ptr
  ret i8 %a
}

define i16 @load_i8_s16(ptr %ptr) {
; CHECK-LABEL: load_i8_s16:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrsb w0, [x0]
; CHECK-NEXT:    ret
  %a = load i8, ptr %ptr
  %s = sext i8 %a to i16
  ret i16 %s
}

define i16 @load_i8_u16(ptr %ptr) {
; CHECK-LABEL: load_i8_u16:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrb w0, [x0]
; CHECK-NEXT:    ret
  %a = load i8, ptr %ptr
  %s = zext i8 %a to i16
  ret i16 %s
}

define i32 @load_i8_s32(ptr %ptr) {
; CHECK-LABEL: load_i8_s32:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrsb w0, [x0]
; CHECK-NEXT:    ret
  %a = load i8, ptr %ptr
  %s = sext i8 %a to i32
  ret i32 %s
}

define i32 @load_i8_u32(ptr %ptr) {
; CHECK-LABEL: load_i8_u32:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrb w0, [x0]
; CHECK-NEXT:    ret
  %a = load i8, ptr %ptr
  %s = zext i8 %a to i32
  ret i32 %s
}

define i64 @load_i8_s64(ptr %ptr) {
; CHECK-LABEL: load_i8_s64:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrsb x0, [x0]
; CHECK-NEXT:    ret
  %a = load i8, ptr %ptr
  %s = sext i8 %a to i64
  ret i64 %s
}

define i64 @load_i8_u64(ptr %ptr) {
; CHECK-LABEL: load_i8_u64:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrb w0, [x0]
; CHECK-NEXT:    ret
  %a = load i8, ptr %ptr
  %s = zext i8 %a to i64
  ret i64 %s
}

define i16 @load_i16(ptr %ptr) {
; CHECK-LABEL: load_i16:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrh w0, [x0]
; CHECK-NEXT:    ret
  %a = load i16, ptr %ptr
  ret i16 %a
}

define i32 @load_i16_s32(ptr %ptr) {
; CHECK-LABEL: load_i16_s32:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrsh w0, [x0]
; CHECK-NEXT:    ret
  %a = load i16, ptr %ptr
  %s = sext i16 %a to i32
  ret i32 %s
}

define i32 @load_i16_u32(ptr %ptr) {
; CHECK-LABEL: load_i16_u32:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrh w0, [x0]
; CHECK-NEXT:    ret
  %a = load i16, ptr %ptr
  %s = zext i16 %a to i32
  ret i32 %s
}

define i64 @load_i16_s64(ptr %ptr) {
; CHECK-LABEL: load_i16_s64:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrsh x0, [x0]
; CHECK-NEXT:    ret
  %a = load i16, ptr %ptr
  %s = sext i16 %a to i64
  ret i64 %s
}

define i64 @load_i16_u64(ptr %ptr) {
; CHECK-LABEL: load_i16_u64:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrh w0, [x0]
; CHECK-NEXT:    ret
  %a = load i16, ptr %ptr
  %s = zext i16 %a to i64
  ret i64 %s
}

define i32 @load_i32(ptr %ptr) {
; CHECK-LABEL: load_i32:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr w0, [x0]
; CHECK-NEXT:    ret
  %a = load i32, ptr %ptr
  ret i32 %a
}

define i64 @load_i32_s64(ptr %ptr) {
; CHECK-LABEL: load_i32_s64:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldrsw x0, [x0]
; CHECK-NEXT:    ret
  %a = load i32, ptr %ptr
  %s = sext i32 %a to i64
  ret i64 %s
}

define i64 @load_i32_u64(ptr %ptr) {
; CHECK-LABEL: load_i32_u64:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr w0, [x0]
; CHECK-NEXT:    ret
  %a = load i32, ptr %ptr
  %s = zext i32 %a to i64
  ret i64 %s
}

define i64 @load_i64(ptr %ptr) {
; CHECK-LABEL: load_i64:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr x0, [x0]
; CHECK-NEXT:    ret
  %a = load i64, ptr %ptr
  ret i64 %a
}

; ===== Legal Vector Types =====

define <8 x i8> @load_v8i8(ptr %ptr) {
; CHECK-LABEL: load_v8i8:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr d0, [x0]
; CHECK-NEXT:    ret
  %a = load <8 x i8>, ptr %ptr
  ret <8 x i8> %a
}

define <16 x i8> @load_v16i8(ptr %ptr) {
; CHECK-LABEL: load_v16i8:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr q0, [x0]
; CHECK-NEXT:    ret
  %a = load <16 x i8>, ptr %ptr
  ret <16 x i8> %a
}

define <4 x i16> @load_v4i16(ptr %ptr) {
; CHECK-LABEL: load_v4i16:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr d0, [x0]
; CHECK-NEXT:    ret
  %a = load <4 x i16>, ptr %ptr
  ret <4 x i16> %a
}

define <8 x i16> @load_v8i16(ptr %ptr) {
; CHECK-LABEL: load_v8i16:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr q0, [x0]
; CHECK-NEXT:    ret
  %a = load <8 x i16>, ptr %ptr
  ret <8 x i16> %a
}

define <2 x i32> @load_v2i32(ptr %ptr) {
; CHECK-LABEL: load_v2i32:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr d0, [x0]
; CHECK-NEXT:    ret
  %a = load <2 x i32>, ptr %ptr
  ret <2 x i32> %a
}

define <4 x i32> @load_v4i32(ptr %ptr) {
; CHECK-LABEL: load_v4i32:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr q0, [x0]
; CHECK-NEXT:    ret
  %a = load <4 x i32>, ptr %ptr
  ret <4 x i32> %a
}

define <2 x i64> @load_v2i64(ptr %ptr) {
; CHECK-LABEL: load_v2i64:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr q0, [x0]
; CHECK-NEXT:    ret
  %a = load <2 x i64>, ptr %ptr
  ret <2 x i64> %a
}

; ===== Smaller/Larger Width Vectors with Legal Element Sizes =====

define <2 x i8> @load_v2i8(ptr %ptr, <2 x i8> %b) {
; CHECK-SD-LABEL: load_v2i8:
; CHECK-SD:       // %bb.0:
; CHECK-SD-NEXT:    ld1 { v0.b }[0], [x0]
; CHECK-SD-NEXT:    add x8, x0, #1
; CHECK-SD-NEXT:    ld1 { v0.b }[4], [x8]
; CHECK-SD-NEXT:    // kill: def $d0 killed $d0 killed $q0
; CHECK-SD-NEXT:    ret
;
; CHECK-GI-LABEL: load_v2i8:
; CHECK-GI:       // %bb.0:
; CHECK-GI-NEXT:    ld1 { v0.b }[0], [x0]
; CHECK-GI-NEXT:    ldr b1, [x0, #1]
; CHECK-GI-NEXT:    mov v0.s[1], v1.s[0]
; CHECK-GI-NEXT:    // kill: def $d0 killed $d0 killed $q0
; CHECK-GI-NEXT:    ret
  %a = load <2 x i8>, ptr %ptr
  ret <2 x i8> %a
}

define i32 @load_v4i8(ptr %ptr, <4 x i8> %b) {
; CHECK-LABEL: load_v4i8:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr w0, [x0]
; CHECK-NEXT:    ret
  %a = load <4 x i8>, ptr %ptr
  %c = bitcast <4 x i8> %a to i32
  ret i32 %c
}

define <32 x i8> @load_v32i8(ptr %ptr) {
; CHECK-LABEL: load_v32i8:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldp q0, q1, [x0]
; CHECK-NEXT:    ret
  %a = load <32 x i8>, ptr %ptr
  ret <32 x i8> %a
}

define <2 x i16> @load_v2i16(ptr %ptr) {
; CHECK-SD-LABEL: load_v2i16:
; CHECK-SD:       // %bb.0:
; CHECK-SD-NEXT:    ld1 { v0.h }[0], [x0]
; CHECK-SD-NEXT:    add x8, x0, #2
; CHECK-SD-NEXT:    ld1 { v0.h }[2], [x8]
; CHECK-SD-NEXT:    // kill: def $d0 killed $d0 killed $q0
; CHECK-SD-NEXT:    ret
;
; CHECK-GI-LABEL: load_v2i16:
; CHECK-GI:       // %bb.0:
; CHECK-GI-NEXT:    ld1 { v0.h }[0], [x0]
; CHECK-GI-NEXT:    ldr h1, [x0, #2]
; CHECK-GI-NEXT:    mov v0.s[1], v1.s[0]
; CHECK-GI-NEXT:    // kill: def $d0 killed $d0 killed $q0
; CHECK-GI-NEXT:    ret
  %a = load <2 x i16>, ptr %ptr
  ret <2 x i16> %a
}

define <16 x i16> @load_v16i16(ptr %ptr) {
; CHECK-LABEL: load_v16i16:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldp q0, q1, [x0]
; CHECK-NEXT:    ret
  %a = load <16 x i16>, ptr %ptr
  ret <16 x i16> %a
}

define <1 x i32> @load_v1i32(ptr %ptr) {
; CHECK-LABEL: load_v1i32:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr s0, [x0]
; CHECK-NEXT:    ret
  %a = load <1 x i32>, ptr %ptr
  ret <1 x i32> %a
}

define <8 x i32> @load_v8i32(ptr %ptr) {
; CHECK-LABEL: load_v8i32:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldp q0, q1, [x0]
; CHECK-NEXT:    ret
  %a = load <8 x i32>, ptr %ptr
  ret <8 x i32> %a
}

define <4 x i64> @load_v4i64(ptr %ptr) {
; CHECK-LABEL: load_v4i64:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldp q0, q1, [x0]
; CHECK-NEXT:    ret
  %a = load <4 x i64>, ptr %ptr
  ret <4 x i64> %a
}

; ===== Vectors with Non-Pow 2 Widths =====

define <3 x i8> @load_v3i8(ptr %ptr) {
; CHECK-SD-LABEL: load_v3i8:
; CHECK-SD:       // %bb.0:
; CHECK-SD-NEXT:    ldr s0, [x0]
; CHECK-SD-NEXT:    umov w0, v0.b[0]
; CHECK-SD-NEXT:    umov w1, v0.b[1]
; CHECK-SD-NEXT:    umov w2, v0.b[2]
; CHECK-SD-NEXT:    ret
;
; CHECK-GI-LABEL: load_v3i8:
; CHECK-GI:       // %bb.0:
; CHECK-GI-NEXT:    ldrb w8, [x0]
; CHECK-GI-NEXT:    ldrb w1, [x0, #1]
; CHECK-GI-NEXT:    ldrb w2, [x0, #2]
; CHECK-GI-NEXT:    mov w0, w8
; CHECK-GI-NEXT:    ret
  %a = load <3 x i8>, ptr %ptr
  ret <3 x i8> %a
}

define <7 x i8> @load_v7i8(ptr %ptr) {
; CHECK-SD-LABEL: load_v7i8:
; CHECK-SD:       // %bb.0:
; CHECK-SD-NEXT:    ldr d0, [x0]
; CHECK-SD-NEXT:    ret
;
; CHECK-GI-LABEL: load_v7i8:
; CHECK-GI:       // %bb.0:
; CHECK-GI-NEXT:    ldr b0, [x0]
; CHECK-GI-NEXT:    ldr b1, [x0, #1]
; CHECK-GI-NEXT:    mov v0.b[0], v0.b[0]
; CHECK-GI-NEXT:    mov v0.b[1], v1.b[0]
; CHECK-GI-NEXT:    ldr b1, [x0, #2]
; CHECK-GI-NEXT:    mov v0.b[2], v1.b[0]
; CHECK-GI-NEXT:    ldr b1, [x0, #3]
; CHECK-GI-NEXT:    mov v0.b[3], v1.b[0]
; CHECK-GI-NEXT:    ldr b1, [x0, #4]
; CHECK-GI-NEXT:    mov v0.b[4], v1.b[0]
; CHECK-GI-NEXT:    ldr b1, [x0, #5]
; CHECK-GI-NEXT:    mov v0.b[5], v1.b[0]
; CHECK-GI-NEXT:    ldr b1, [x0, #6]
; CHECK-GI-NEXT:    mov v0.b[6], v1.b[0]
; CHECK-GI-NEXT:    // kill: def $d0 killed $d0 killed $q0
; CHECK-GI-NEXT:    ret
  %a = load <7 x i8>, ptr %ptr
  ret <7 x i8> %a
}

define <3 x i16> @load_v3i16(ptr %ptr) {
; CHECK-SD-LABEL: load_v3i16:
; CHECK-SD:       // %bb.0:
; CHECK-SD-NEXT:    ldr d0, [x0]
; CHECK-SD-NEXT:    ret
;
; CHECK-GI-LABEL: load_v3i16:
; CHECK-GI:       // %bb.0:
; CHECK-GI-NEXT:    ldr h0, [x0]
; CHECK-GI-NEXT:    add x8, x0, #2
; CHECK-GI-NEXT:    ld1 { v0.h }[1], [x8]
; CHECK-GI-NEXT:    add x8, x0, #4
; CHECK-GI-NEXT:    ld1 { v0.h }[2], [x8]
; CHECK-GI-NEXT:    // kill: def $d0 killed $d0 killed $q0
; CHECK-GI-NEXT:    ret
  %a = load <3 x i16>, ptr %ptr
  ret <3 x i16> %a
}

define <7 x i16> @load_v7i16(ptr %ptr) {
; CHECK-SD-LABEL: load_v7i16:
; CHECK-SD:       // %bb.0:
; CHECK-SD-NEXT:    ldr q0, [x0]
; CHECK-SD-NEXT:    ret
;
; CHECK-GI-LABEL: load_v7i16:
; CHECK-GI:       // %bb.0:
; CHECK-GI-NEXT:    ldr h0, [x0]
; CHECK-GI-NEXT:    add x8, x0, #2
; CHECK-GI-NEXT:    ld1 { v0.h }[1], [x8]
; CHECK-GI-NEXT:    add x8, x0, #4
; CHECK-GI-NEXT:    ld1 { v0.h }[2], [x8]
; CHECK-GI-NEXT:    add x8, x0, #6
; CHECK-GI-NEXT:    ld1 { v0.h }[3], [x8]
; CHECK-GI-NEXT:    add x8, x0, #8
; CHECK-GI-NEXT:    ld1 { v0.h }[4], [x8]
; CHECK-GI-NEXT:    add x8, x0, #10
; CHECK-GI-NEXT:    ld1 { v0.h }[5], [x8]
; CHECK-GI-NEXT:    add x8, x0, #12
; CHECK-GI-NEXT:    ld1 { v0.h }[6], [x8]
; CHECK-GI-NEXT:    ret
  %a = load <7 x i16>, ptr %ptr
  ret <7 x i16> %a
}

define <3 x i32> @load_v3i32(ptr %ptr) {
; CHECK-SD-LABEL: load_v3i32:
; CHECK-SD:       // %bb.0:
; CHECK-SD-NEXT:    ldr q0, [x0]
; CHECK-SD-NEXT:    ret
;
; CHECK-GI-LABEL: load_v3i32:
; CHECK-GI:       // %bb.0:
; CHECK-GI-NEXT:    ldr s0, [x0]
; CHECK-GI-NEXT:    add x8, x0, #4
; CHECK-GI-NEXT:    ld1 { v0.s }[1], [x8]
; CHECK-GI-NEXT:    add x8, x0, #8
; CHECK-GI-NEXT:    ld1 { v0.s }[2], [x8]
; CHECK-GI-NEXT:    ret
  %a = load <3 x i32>, ptr %ptr
  ret <3 x i32> %a
}

define <2 x i128> @load_v2i128(ptr %p) {
; CHECK-SD-LABEL: load_v2i128:
; CHECK-SD:       // %bb.0:
; CHECK-SD-NEXT:    ldp x8, x1, [x0]
; CHECK-SD-NEXT:    ldp x2, x3, [x0, #16]
; CHECK-SD-NEXT:    mov x0, x8
; CHECK-SD-NEXT:    ret
;
; CHECK-GI-LABEL: load_v2i128:
; CHECK-GI:       // %bb.0:
; CHECK-GI-NEXT:    ldp q0, q1, [x0]
; CHECK-GI-NEXT:    mov d2, v0.d[1]
; CHECK-GI-NEXT:    mov d3, v1.d[1]
; CHECK-GI-NEXT:    fmov x0, d0
; CHECK-GI-NEXT:    fmov x2, d1
; CHECK-GI-NEXT:    fmov x1, d2
; CHECK-GI-NEXT:    fmov x3, d3
; CHECK-GI-NEXT:    ret
  %a = load <2 x i128>, ptr %p
  ret <2 x i128> %a
}

define <2 x fp128> @load_v2f128(ptr %p) {
; CHECK-LABEL: load_v2f128:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldp q0, q1, [x0]
; CHECK-NEXT:    ret
  %a = load <2 x fp128>, ptr %p
  ret <2 x fp128> %a
}

define i32 @load_i8_s16_extrasuse(ptr %ptr, ptr %ptr2) {
; CHECK-LABEL: load_i8_s16_extrasuse:
; CHECK:       // %bb.0:
; CHECK-NEXT:    ldr w8, [x0]
; CHECK-NEXT:    sxtb w0, w8
; CHECK-NEXT:    str w8, [x1]
; CHECK-NEXT:    ret
  %a = load i32, ptr %ptr
  %s = shl i32 %a, 24
  %b = ashr i32 %s, 24
  store i32 %a, ptr %ptr2
  ret i32 %b
}