1; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s
2
3; Function Attrs: norecurse nounwind readonly
4define fp128 @loadf128(fp128* nocapture readonly %0) {
5; CHECK-LABEL: loadf128:
6; CHECK:       # %bb.0:
7; CHECK-NEXT:    ld %s2, 8(, %s0)
8; CHECK-NEXT:    ld %s3, (, %s0)
9; CHECK-NEXT:    or %s0, 0, %s2
10; CHECK-NEXT:    or %s1, 0, %s3
11; CHECK-NEXT:    b.l.t (, %s10)
12  %2 = load fp128, fp128* %0, align 16
13  ret fp128 %2
14}
15
16; Function Attrs: norecurse nounwind readonly
17define double @loadf64(double* nocapture readonly %0) {
18; CHECK-LABEL: loadf64:
19; CHECK:       # %bb.0:
20; CHECK-NEXT:    ld %s0, (, %s0)
21; CHECK-NEXT:    b.l.t (, %s10)
22  %2 = load double, double* %0, align 16
23  ret double %2
24}
25
26; Function Attrs: norecurse nounwind readonly
27define float @loadf32(float* nocapture readonly %0) {
28; CHECK-LABEL: loadf32:
29; CHECK:       # %bb.0:
30; CHECK-NEXT:    ldu %s0, (, %s0)
31; CHECK-NEXT:    b.l.t (, %s10)
32  %2 = load float, float* %0, align 16
33  ret float %2
34}
35
36; Function Attrs: norecurse nounwind readonly
37define i128 @loadi128(i128* nocapture readonly %0) {
38; CHECK-LABEL: loadi128:
39; CHECK:       # %bb.0:
40; CHECK-NEXT:    ld %s2, (, %s0)
41; CHECK-NEXT:    ld %s1, 8(, %s0)
42; CHECK-NEXT:    or %s0, 0, %s2
43; CHECK-NEXT:    b.l.t (, %s10)
44  %2 = load i128, i128* %0, align 16
45  ret i128 %2
46}
47
48; Function Attrs: norecurse nounwind readonly
49define i64 @loadi64(i64* nocapture readonly %0) {
50; CHECK-LABEL: loadi64:
51; CHECK:       # %bb.0:
52; CHECK-NEXT:    ld %s0, (, %s0)
53; CHECK-NEXT:    b.l.t (, %s10)
54  %2 = load i64, i64* %0, align 16
55  ret i64 %2
56}
57
58; Function Attrs: norecurse nounwind readonly
59define i32 @loadi32(i32* nocapture readonly %0) {
60; CHECK-LABEL: loadi32:
61; CHECK:       # %bb.0:
62; CHECK-NEXT:    ldl.sx %s0, (, %s0)
63; CHECK-NEXT:    b.l.t (, %s10)
64  %2 = load i32, i32* %0, align 16
65  ret i32 %2
66}
67
68; Function Attrs: norecurse nounwind readonly
69define i64 @loadi32sext(i32* nocapture readonly %0) {
70; CHECK-LABEL: loadi32sext:
71; CHECK:       # %bb.0:
72; CHECK-NEXT:    ldl.sx %s0, (, %s0)
73; CHECK-NEXT:    b.l.t (, %s10)
74  %2 = load i32, i32* %0, align 16
75  %3 = sext i32 %2 to i64
76  ret i64 %3
77}
78
79; Function Attrs: norecurse nounwind readonly
80define i64 @loadi32zext(i32* nocapture readonly %0) {
81; CHECK-LABEL: loadi32zext:
82; CHECK:       # %bb.0:
83; CHECK-NEXT:    ldl.zx %s0, (, %s0)
84; CHECK-NEXT:    b.l.t (, %s10)
85  %2 = load i32, i32* %0, align 16
86  %3 = zext i32 %2 to i64
87  ret i64 %3
88}
89
90; Function Attrs: norecurse nounwind readonly
91define i16 @loadi16(i16* nocapture readonly %0) {
92; CHECK-LABEL: loadi16:
93; CHECK:       # %bb.0:
94; CHECK-NEXT:    ld2b.zx %s0, (, %s0)
95; CHECK-NEXT:    b.l.t (, %s10)
96  %2 = load i16, i16* %0, align 16
97  ret i16 %2
98}
99
100; Function Attrs: norecurse nounwind readonly
101define i64 @loadi16sext(i16* nocapture readonly %0) {
102; CHECK-LABEL: loadi16sext:
103; CHECK:       # %bb.0:
104; CHECK-NEXT:    ld2b.sx %s0, (, %s0)
105; CHECK-NEXT:    b.l.t (, %s10)
106  %2 = load i16, i16* %0, align 16
107  %3 = sext i16 %2 to i64
108  ret i64 %3
109}
110
111; Function Attrs: norecurse nounwind readonly
112define i64 @loadi16zext(i16* nocapture readonly %0) {
113; CHECK-LABEL: loadi16zext:
114; CHECK:       # %bb.0:
115; CHECK-NEXT:    ld2b.zx %s0, (, %s0)
116; CHECK-NEXT:    b.l.t (, %s10)
117  %2 = load i16, i16* %0, align 16
118  %3 = zext i16 %2 to i64
119  ret i64 %3
120}
121
122; Function Attrs: norecurse nounwind readonly
123define i8 @loadi8(i8* nocapture readonly %0) {
124; CHECK-LABEL: loadi8:
125; CHECK:       # %bb.0:
126; CHECK-NEXT:    ld1b.zx %s0, (, %s0)
127; CHECK-NEXT:    b.l.t (, %s10)
128  %2 = load i8, i8* %0, align 16
129  ret i8 %2
130}
131
132; Function Attrs: norecurse nounwind readonly
133define i64 @loadi8sext(i8* nocapture readonly %0) {
134; CHECK-LABEL: loadi8sext:
135; CHECK:       # %bb.0:
136; CHECK-NEXT:    ld1b.sx %s0, (, %s0)
137; CHECK-NEXT:    b.l.t (, %s10)
138  %2 = load i8, i8* %0, align 16
139  %3 = sext i8 %2 to i64
140  ret i64 %3
141}
142
143; Function Attrs: norecurse nounwind readonly
144define i64 @loadi8zext(i8* nocapture readonly %0) {
145; CHECK-LABEL: loadi8zext:
146; CHECK:       # %bb.0:
147; CHECK-NEXT:    ld1b.zx %s0, (, %s0)
148; CHECK-NEXT:    b.l.t (, %s10)
149  %2 = load i8, i8* %0, align 16
150  %3 = zext i8 %2 to i64
151  ret i64 %3
152}
153
154; Function Attrs: norecurse nounwind readonly
155define fp128 @loadf128stk() {
156; CHECK-LABEL: loadf128stk:
157; CHECK:       .LBB{{[0-9]+}}_2:
158; CHECK-NEXT:    ld %s1, (, %s11)
159; CHECK-NEXT:    ld %s0, 8(, %s11)
160; CHECK-NEXT:    adds.l %s11, 16, %s11
161; CHECK-NEXT:    b.l.t (, %s10)
162  %addr = alloca fp128, align 16
163  %1 = load fp128, fp128* %addr, align 16
164  ret fp128 %1
165}
166
167; Function Attrs: norecurse nounwind readonly
168define double @loadf64stk() {
169; CHECK-LABEL: loadf64stk:
170; CHECK:       .LBB{{[0-9]+}}_2:
171; CHECK-NEXT:    ld %s0, (, %s11)
172; CHECK-NEXT:    adds.l %s11, 16, %s11
173; CHECK-NEXT:    b.l.t (, %s10)
174  %addr = alloca double, align 16
175  %1 = load double, double* %addr, align 16
176  ret double %1
177}
178
179; Function Attrs: norecurse nounwind readonly
180define float @loadf32stk() {
181; CHECK-LABEL: loadf32stk:
182; CHECK:       .LBB{{[0-9]+}}_2:
183; CHECK-NEXT:    ldu %s0, (, %s11)
184; CHECK-NEXT:    adds.l %s11, 16, %s11
185; CHECK-NEXT:    b.l.t (, %s10)
186  %addr = alloca float, align 16
187  %1 = load float, float* %addr, align 16
188  ret float %1
189}
190
191; Function Attrs: norecurse nounwind readonly
192define i128 @loadi128stk() {
193; CHECK-LABEL: loadi128stk:
194; CHECK:       .LBB{{[0-9]+}}_2:
195; CHECK-NEXT:    ld %s0, (, %s11)
196; CHECK-NEXT:    ld %s1, 8(, %s11)
197; CHECK-NEXT:    adds.l %s11, 16, %s11
198; CHECK-NEXT:    b.l.t (, %s10)
199  %addr = alloca i128, align 16
200  %1 = load i128, i128* %addr, align 16
201  ret i128 %1
202}
203
204; Function Attrs: norecurse nounwind readonly
205define i64 @loadi64stk() {
206; CHECK-LABEL: loadi64stk:
207; CHECK:       .LBB{{[0-9]+}}_2:
208; CHECK-NEXT:    ld %s0, (, %s11)
209; CHECK-NEXT:    adds.l %s11, 16, %s11
210; CHECK-NEXT:    b.l.t (, %s10)
211  %addr = alloca i64, align 16
212  %1 = load i64, i64* %addr, align 16
213  ret i64 %1
214}
215
216; Function Attrs: norecurse nounwind readonly
217define i32 @loadi32stk() {
218; CHECK-LABEL: loadi32stk:
219; CHECK:       .LBB{{[0-9]+}}_2:
220; CHECK-NEXT:    ldl.sx %s0, (, %s11)
221; CHECK-NEXT:    adds.l %s11, 16, %s11
222; CHECK-NEXT:    b.l.t (, %s10)
223  %addr = alloca i32, align 16
224  %1 = load i32, i32* %addr, align 16
225  ret i32 %1
226}
227
228; Function Attrs: norecurse nounwind readonly
229define i16 @loadi16stk() {
230; CHECK-LABEL: loadi16stk:
231; CHECK:       .LBB{{[0-9]+}}_2:
232; CHECK-NEXT:    ld2b.zx %s0, (, %s11)
233; CHECK-NEXT:    adds.l %s11, 16, %s11
234; CHECK-NEXT:    b.l.t (, %s10)
235  %addr = alloca i16, align 16
236  %1 = load i16, i16* %addr, align 16
237  ret i16 %1
238}
239
240; Function Attrs: norecurse nounwind readonly
241define i8 @loadi8stk() {
242; CHECK-LABEL: loadi8stk:
243; CHECK:       .LBB{{[0-9]+}}_2:
244; CHECK-NEXT:    ld1b.zx %s0, (, %s11)
245; CHECK-NEXT:    adds.l %s11, 16, %s11
246; CHECK-NEXT:    b.l.t (, %s10)
247  %addr = alloca i8, align 16
248  %1 = load i8, i8* %addr, align 16
249  ret i8 %1
250}
251