1; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s
2
3@vi8 = common dso_local local_unnamed_addr global i8 0, align 1
4@vi16 = common dso_local local_unnamed_addr global i16 0, align 1
5@vi32 = common dso_local local_unnamed_addr global i32 0, align 1
6@vi64 = common dso_local local_unnamed_addr global i64 0, align 1
7@vf32 = common dso_local local_unnamed_addr global float 0.000000e+00, align 1
8@vf64 = common dso_local local_unnamed_addr global double 0.000000e+00, align 1
9
10; Function Attrs: norecurse nounwind readonly
11define double @loadf64stk() {
12; CHECK-LABEL: loadf64stk:
13; CHECK:       .LBB{{[0-9]+}}_2:
14; CHECK-NEXT:    ld %s0, 8(, %s11)
15; CHECK-NEXT:    adds.l %s11, 16, %s11
16; CHECK-NEXT:    b.l.t (, %s10)
17  %addr = alloca double, align 1
18  %1 = load double, double* %addr, align 1
19  ret double %1
20}
21
22; Function Attrs: norecurse nounwind readonly
23define float @loadf32stk() {
24; CHECK-LABEL: loadf32stk:
25; CHECK:       .LBB{{[0-9]+}}_2:
26; CHECK-NEXT:    ldu %s0, 12(, %s11)
27; CHECK-NEXT:    adds.l %s11, 16, %s11
28; CHECK-NEXT:    b.l.t (, %s10)
29  %addr = alloca float, align 1
30  %1 = load float, float* %addr, align 1
31  ret float %1
32}
33
34; Function Attrs: norecurse nounwind readonly
35define i64 @loadi64stk() {
36; CHECK-LABEL: loadi64stk:
37; CHECK:       .LBB{{[0-9]+}}_2:
38; CHECK-NEXT:    ld %s0, 8(, %s11)
39; CHECK-NEXT:    adds.l %s11, 16, %s11
40; CHECK-NEXT:    b.l.t (, %s10)
41  %addr = alloca i64, align 1
42  %1 = load i64, i64* %addr, align 1
43  ret i64 %1
44}
45
46; Function Attrs: norecurse nounwind readonly
47define i32 @loadi32stk() {
48; CHECK-LABEL: loadi32stk:
49; CHECK:       .LBB{{[0-9]+}}_2:
50; CHECK-NEXT:    ldl.sx %s0, 12(, %s11)
51; CHECK-NEXT:    adds.l %s11, 16, %s11
52; CHECK-NEXT:    b.l.t (, %s10)
53  %addr = alloca i32, align 1
54  %1 = load i32, i32* %addr, align 1
55  ret i32 %1
56}
57
58; Function Attrs: norecurse nounwind readonly
59define i16 @loadi16stk() {
60; CHECK-LABEL: loadi16stk:
61; CHECK:       .LBB{{[0-9]+}}_2:
62; CHECK-NEXT:    ld2b.zx %s0, 14(, %s11)
63; CHECK-NEXT:    adds.l %s11, 16, %s11
64; CHECK-NEXT:    b.l.t (, %s10)
65  %addr = alloca i16, align 1
66  %1 = load i16, i16* %addr, align 1
67  ret i16 %1
68}
69
70; Function Attrs: norecurse nounwind readonly
71define i8 @loadi8stk() {
72; CHECK-LABEL: loadi8stk:
73; CHECK:       .LBB{{[0-9]+}}_2:
74; CHECK-NEXT:    ld1b.zx %s0, 15(, %s11)
75; CHECK-NEXT:    adds.l %s11, 16, %s11
76; CHECK-NEXT:    b.l.t (, %s10)
77  %addr = alloca i8, align 1
78  %1 = load i8, i8* %addr, align 1
79  ret i8 %1
80}
81
82; Function Attrs: norecurse nounwind readonly
83define double @loadf64com() {
84; CHECK-LABEL: loadf64com:
85; CHECK:       # %bb.0:
86; CHECK-NEXT:    lea %s0, vf64@lo
87; CHECK-NEXT:    and %s0, %s0, (32)0
88; CHECK-NEXT:    lea.sl %s0, vf64@hi(, %s0)
89; CHECK-NEXT:    ld %s0, (, %s0)
90; CHECK-NEXT:    b.l.t (, %s10)
91  %1 = load double, double* @vf64, align 1
92  ret double %1
93}
94
95; Function Attrs: norecurse nounwind readonly
96define float @loadf32com() {
97; CHECK-LABEL: loadf32com:
98; CHECK:       # %bb.0:
99; CHECK-NEXT:    lea %s0, vf32@lo
100; CHECK-NEXT:    and %s0, %s0, (32)0
101; CHECK-NEXT:    lea.sl %s0, vf32@hi(, %s0)
102; CHECK-NEXT:    ldu %s0, (, %s0)
103; CHECK-NEXT:    b.l.t (, %s10)
104  %1 = load float, float* @vf32, align 1
105  ret float %1
106}
107
108; Function Attrs: norecurse nounwind readonly
109define i64 @loadi64com() {
110; CHECK-LABEL: loadi64com:
111; CHECK:       # %bb.0:
112; CHECK-NEXT:    lea %s0, vi64@lo
113; CHECK-NEXT:    and %s0, %s0, (32)0
114; CHECK-NEXT:    lea.sl %s0, vi64@hi(, %s0)
115; CHECK-NEXT:    ld %s0, (, %s0)
116; CHECK-NEXT:    b.l.t (, %s10)
117  %1 = load i64, i64* @vi64, align 1
118  ret i64 %1
119}
120
121; Function Attrs: norecurse nounwind readonly
122define i32 @loadi32com() {
123; CHECK-LABEL: loadi32com:
124; CHECK:       # %bb.0:
125; CHECK-NEXT:    lea %s0, vi32@lo
126; CHECK-NEXT:    and %s0, %s0, (32)0
127; CHECK-NEXT:    lea.sl %s0, vi32@hi(, %s0)
128; CHECK-NEXT:    ldl.sx %s0, (, %s0)
129; CHECK-NEXT:    b.l.t (, %s10)
130  %1 = load i32, i32* @vi32, align 1
131  ret i32 %1
132}
133
134; Function Attrs: norecurse nounwind readonly
135define i16 @loadi16com() {
136; CHECK-LABEL: loadi16com:
137; CHECK:       # %bb.0:
138; CHECK-NEXT:    lea %s0, vi16@lo
139; CHECK-NEXT:    and %s0, %s0, (32)0
140; CHECK-NEXT:    lea.sl %s0, vi16@hi(, %s0)
141; CHECK-NEXT:    ld2b.zx %s0, (, %s0)
142; CHECK-NEXT:    b.l.t (, %s10)
143  %1 = load i16, i16* @vi16, align 1
144  ret i16 %1
145}
146
147; Function Attrs: norecurse nounwind readonly
148define i8 @loadi8com() {
149; CHECK-LABEL: loadi8com:
150; CHECK:       # %bb.0:
151; CHECK-NEXT:    lea %s0, vi8@lo
152; CHECK-NEXT:    and %s0, %s0, (32)0
153; CHECK-NEXT:    lea.sl %s0, vi8@hi(, %s0)
154; CHECK-NEXT:    ld1b.zx %s0, (, %s0)
155; CHECK-NEXT:    b.l.t (, %s10)
156  %1 = load i8, i8* @vi8, align 1
157  ret i8 %1
158}
159
160