1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64 -code-model=tiny -verify-machineinstrs | FileCheck %s
4 %struct.T = type <{ i32, i64, i8, i32 }>
6 @ptr = external dso_local local_unnamed_addr global ptr, align 8
7 @ch = external dso_local local_unnamed_addr global i32, align 4
8 @ch8 = external dso_local local_unnamed_addr global i8, align 4
9 @t = external dso_local local_unnamed_addr global %struct.T, align 4
10 @t2 = external dso_local local_unnamed_addr global %struct.T, align 2
11 @f = external dso_local local_unnamed_addr global float, align 4
15 ; CHECK: // %bb.0: // %entry
16 ; CHECK-NEXT: ldr x8, ptr
17 ; CHECK-NEXT: ldr w0, [x8]
20 %0 = load ptr, ptr @ptr, align 8
21 %1 = load i32, ptr %0, align 4
27 ; CHECK: // %bb.0: // %entry
28 ; CHECK-NEXT: ldr w0, ch
31 %0 = load i32, ptr @ch, align 4
37 ; CHECK: // %bb.0: // %entry
38 ; CHECK-NEXT: ldr w0, t
41 %0 = load i32, ptr @t, align 4
47 ; CHECK: // %bb.0: // %entry
48 ; CHECK-NEXT: ldr x0, t+4
51 %0 = load i64, ptr getelementptr inbounds (%struct.T, ptr @t, i64 0, i32 1), align 8
57 ; CHECK: // %bb.0: // %entry
58 ; CHECK-NEXT: adr x8, t+13
59 ; CHECK-NEXT: ldr w0, [x8]
62 %0 = load i32, ptr getelementptr inbounds (%struct.T, ptr @t, i64 0, i32 3), align 1
66 define i32 @bart2a() {
67 ; CHECK-LABEL: bart2a:
68 ; CHECK: // %bb.0: // %entry
69 ; CHECK-NEXT: adr x8, t2
70 ; CHECK-NEXT: ldr w0, [x8]
73 %0 = load i32, ptr @t2, align 2
77 define i64 @zextload() {
78 ; CHECK-LABEL: zextload:
79 ; CHECK: // %bb.0: // %entry
80 ; CHECK-NEXT: ldr w0, ch
83 %0 = load i32, ptr @ch, align 4
84 %1 = zext i32 %0 to i64
88 define i64 @zextload8() {
89 ; CHECK-LABEL: zextload8:
90 ; CHECK: // %bb.0: // %entry
91 ; CHECK-NEXT: adr x8, ch8
92 ; CHECK-NEXT: ldrb w0, [x8]
95 %0 = load i8, ptr @ch8, align 4
96 %1 = zext i8 %0 to i64
100 define i64 @sextload() {
101 ; CHECK-LABEL: sextload:
102 ; CHECK: // %bb.0: // %entry
103 ; CHECK-NEXT: ldrsw x0, ch
106 %0 = load i32, ptr @ch, align 4
107 %1 = sext i32 %0 to i64
111 define i64 @sextload8() {
112 ; CHECK-LABEL: sextload8:
113 ; CHECK: // %bb.0: // %entry
114 ; CHECK-NEXT: adr x8, ch8
115 ; CHECK-NEXT: ldrsb x0, [x8]
118 %0 = load i8, ptr @ch8, align 4
119 %1 = sext i8 %0 to i64
123 define float @floatload() {
124 ; CHECK-LABEL: floatload:
125 ; CHECK: // %bb.0: // %entry
126 ; CHECK-NEXT: ldr s0, f
129 %0 = load float, ptr @f, align 4