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 2
5@vi32 = common dso_local local_unnamed_addr global i32 0, align 4
6@vi64 = common dso_local local_unnamed_addr global i64 0, align 8
7@vi128 = common dso_local local_unnamed_addr global i128 0, align 16
8@vf32 = common dso_local local_unnamed_addr global float 0.000000e+00, align 4
9@vf64 = common dso_local local_unnamed_addr global double 0.000000e+00, align 8
10@vf128 = common dso_local local_unnamed_addr global fp128 0xL00000000000000000000000000000000, align 16
11
12; Function Attrs: norecurse nounwind readonly
13define fp128 @loadf128com() {
14; CHECK-LABEL: loadf128com:
15; CHECK:       # %bb.0:
16; CHECK-NEXT:    lea %s0, vf128@lo
17; CHECK-NEXT:    and %s0, %s0, (32)0
18; CHECK-NEXT:    lea.sl %s2, vf128@hi(, %s0)
19; CHECK-NEXT:    ld %s0, 8(, %s2)
20; CHECK-NEXT:    ld %s1, (, %s2)
21; CHECK-NEXT:    b.l.t (, %s10)
22  %1 = load fp128, fp128* @vf128, align 16
23  ret fp128 %1
24}
25
26; Function Attrs: norecurse nounwind readonly
27define double @loadf64com() {
28; CHECK-LABEL: loadf64com:
29; CHECK:       # %bb.0:
30; CHECK-NEXT:    lea %s0, vf64@lo
31; CHECK-NEXT:    and %s0, %s0, (32)0
32; CHECK-NEXT:    lea.sl %s0, vf64@hi(, %s0)
33; CHECK-NEXT:    ld %s0, (, %s0)
34; CHECK-NEXT:    b.l.t (, %s10)
35  %1 = load double, double* @vf64, align 8
36  ret double %1
37}
38
39; Function Attrs: norecurse nounwind readonly
40define float @loadf32com() {
41; CHECK-LABEL: loadf32com:
42; CHECK:       # %bb.0:
43; CHECK-NEXT:    lea %s0, vf32@lo
44; CHECK-NEXT:    and %s0, %s0, (32)0
45; CHECK-NEXT:    lea.sl %s0, vf32@hi(, %s0)
46; CHECK-NEXT:    ldu %s0, (, %s0)
47; CHECK-NEXT:    b.l.t (, %s10)
48  %1 = load float, float* @vf32, align 4
49  ret float %1
50}
51
52; Function Attrs: norecurse nounwind readonly
53define i128 @loadi128com() {
54; CHECK-LABEL: loadi128com:
55; CHECK:       # %bb.0:
56; CHECK-NEXT:    lea %s0, vi128@lo
57; CHECK-NEXT:    and %s0, %s0, (32)0
58; CHECK-NEXT:    lea.sl %s1, vi128@hi(, %s0)
59; CHECK-NEXT:    ld %s0, (, %s1)
60; CHECK-NEXT:    ld %s1, 8(, %s1)
61; CHECK-NEXT:    b.l.t (, %s10)
62  %1 = load i128, i128* @vi128, align 16
63  ret i128 %1
64}
65
66; Function Attrs: norecurse nounwind readonly
67define i64 @loadi64com() {
68; CHECK-LABEL: loadi64com:
69; CHECK:       # %bb.0:
70; CHECK-NEXT:    lea %s0, vi64@lo
71; CHECK-NEXT:    and %s0, %s0, (32)0
72; CHECK-NEXT:    lea.sl %s0, vi64@hi(, %s0)
73; CHECK-NEXT:    ld %s0, (, %s0)
74; CHECK-NEXT:    b.l.t (, %s10)
75  %1 = load i64, i64* @vi64, align 8
76  ret i64 %1
77}
78
79; Function Attrs: norecurse nounwind readonly
80define i32 @loadi32com() {
81; CHECK-LABEL: loadi32com:
82; CHECK:       # %bb.0:
83; CHECK-NEXT:    lea %s0, vi32@lo
84; CHECK-NEXT:    and %s0, %s0, (32)0
85; CHECK-NEXT:    lea.sl %s0, vi32@hi(, %s0)
86; CHECK-NEXT:    ldl.sx %s0, (, %s0)
87; CHECK-NEXT:    b.l.t (, %s10)
88  %1 = load i32, i32* @vi32, align 4
89  ret i32 %1
90}
91
92; Function Attrs: norecurse nounwind readonly
93define i16 @loadi16com() {
94; CHECK-LABEL: loadi16com:
95; CHECK:       # %bb.0:
96; CHECK-NEXT:    lea %s0, vi16@lo
97; CHECK-NEXT:    and %s0, %s0, (32)0
98; CHECK-NEXT:    lea.sl %s0, vi16@hi(, %s0)
99; CHECK-NEXT:    ld2b.zx %s0, (, %s0)
100; CHECK-NEXT:    b.l.t (, %s10)
101  %1 = load i16, i16* @vi16, align 2
102  ret i16 %1
103}
104
105; Function Attrs: norecurse nounwind readonly
106define i8 @loadi8com() {
107; CHECK-LABEL: loadi8com:
108; CHECK:       # %bb.0:
109; CHECK-NEXT:    lea %s0, vi8@lo
110; CHECK-NEXT:    and %s0, %s0, (32)0
111; CHECK-NEXT:    lea.sl %s0, vi8@hi(, %s0)
112; CHECK-NEXT:    ld1b.zx %s0, (, %s0)
113; CHECK-NEXT:    b.l.t (, %s10)
114  %1 = load i8, i8* @vi8, align 1
115  ret i8 %1
116}
117