1 ; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s
3 @bufi8 = global [3 x i8] zeroinitializer, align 1
4 @bufi16 = global [3 x i16] zeroinitializer, align 2
5 @bufi32 = global [3 x i32] zeroinitializer, align 4
6 @bufi64 = global [3 x i64] zeroinitializer, align 8
7 @bufi128 = global [3 x i128] zeroinitializer, align 16
8 @buff32 = global [3 x float] zeroinitializer, align 4
9 @buff64 = global [3 x double] zeroinitializer, align 8
10 @buff128 = global [3 x fp128] zeroinitializer, align 16
12 ; Function Attrs: noinline nounwind optnone
13 define signext i8 @loadi8s() {
14 ; CHECK-LABEL: loadi8s:
15 ; CHECK: # %bb.0: # %entry
16 ; CHECK-NEXT: lea %s0, bufi8@lo
17 ; CHECK-NEXT: and %s0, %s0, (32)0
18 ; CHECK-NEXT: lea.sl %s0, bufi8@hi(, %s0)
19 ; CHECK-NEXT: ld1b.sx %s0, 2(, %s0)
20 ; CHECK-NEXT: b.l.t (, %s10)
22 %0 = load i8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @bufi8, i64 0, i64 2), align 1
26 ; Function Attrs: noinline nounwind optnone
27 define signext i16 @loadi16s() {
28 ; CHECK-LABEL: loadi16s:
29 ; CHECK: # %bb.0: # %entry
30 ; CHECK-NEXT: lea %s0, bufi16@lo
31 ; CHECK-NEXT: and %s0, %s0, (32)0
32 ; CHECK-NEXT: lea.sl %s0, bufi16@hi(, %s0)
33 ; CHECK-NEXT: ld2b.sx %s0, 4(, %s0)
34 ; CHECK-NEXT: b.l.t (, %s10)
36 %0 = load i16, i16* getelementptr inbounds ([3 x i16], [3 x i16]* @bufi16, i64 0, i64 2), align 2
40 ; Function Attrs: noinline nounwind optnone
41 define signext i32 @loadi32s() {
42 ; CHECK-LABEL: loadi32s:
43 ; CHECK: # %bb.0: # %entry
44 ; CHECK-NEXT: lea %s0, bufi32@lo
45 ; CHECK-NEXT: and %s0, %s0, (32)0
46 ; CHECK-NEXT: lea.sl %s0, bufi32@hi(, %s0)
47 ; CHECK-NEXT: ldl.sx %s0, 8(, %s0)
48 ; CHECK-NEXT: b.l.t (, %s10)
50 %0 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @bufi32, i64 0, i64 2), align 4
54 ; Function Attrs: noinline nounwind optnone
55 define i64 @loadi64s() {
56 ; CHECK-LABEL: loadi64s:
57 ; CHECK: # %bb.0: # %entry
58 ; CHECK-NEXT: lea %s0, bufi64@lo
59 ; CHECK-NEXT: and %s0, %s0, (32)0
60 ; CHECK-NEXT: lea.sl %s0, bufi64@hi(, %s0)
61 ; CHECK-NEXT: ld %s0, 16(, %s0)
62 ; CHECK-NEXT: b.l.t (, %s10)
64 %0 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @bufi64, i64 0, i64 2), align 8
68 ; Function Attrs: noinline nounwind optnone
69 define i128 @loadi128s() {
70 ; CHECK-LABEL: loadi128s:
71 ; CHECK: # %bb.0: # %entry
72 ; CHECK-NEXT: lea %s0, bufi128@lo
73 ; CHECK-NEXT: and %s0, %s0, (32)0
74 ; CHECK-NEXT: lea.sl %s1, bufi128@hi(, %s0)
75 ; CHECK-NEXT: ld %s0, 32(, %s1)
76 ; CHECK-NEXT: ld %s1, 40(, %s1)
77 ; CHECK-NEXT: b.l.t (, %s10)
79 %0 = load i128, i128* getelementptr inbounds ([3 x i128], [3 x i128]* @bufi128, i64 0, i64 2), align 16
83 ; Function Attrs: noinline nounwind optnone
84 define zeroext i8 @loadi8z() {
85 ; CHECK-LABEL: loadi8z:
86 ; CHECK: # %bb.0: # %entry
87 ; CHECK-NEXT: lea %s0, bufi8@lo
88 ; CHECK-NEXT: and %s0, %s0, (32)0
89 ; CHECK-NEXT: lea.sl %s0, bufi8@hi(, %s0)
90 ; CHECK-NEXT: ld1b.zx %s0, 2(, %s0)
91 ; CHECK-NEXT: b.l.t (, %s10)
93 %0 = load i8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @bufi8, i64 0, i64 2), align 1
97 ; Function Attrs: noinline nounwind optnone
98 define zeroext i16 @loadi16z() {
99 ; CHECK-LABEL: loadi16z:
100 ; CHECK: # %bb.0: # %entry
101 ; CHECK-NEXT: lea %s0, bufi16@lo
102 ; CHECK-NEXT: and %s0, %s0, (32)0
103 ; CHECK-NEXT: lea.sl %s0, bufi16@hi(, %s0)
104 ; CHECK-NEXT: ld2b.zx %s0, 4(, %s0)
105 ; CHECK-NEXT: b.l.t (, %s10)
107 %0 = load i16, i16* getelementptr inbounds ([3 x i16], [3 x i16]* @bufi16, i64 0, i64 2), align 2
111 ; Function Attrs: noinline nounwind optnone
112 define zeroext i32 @loadi32z() {
113 ; CHECK-LABEL: loadi32z:
114 ; CHECK: # %bb.0: # %entry
115 ; CHECK-NEXT: lea %s0, bufi32@lo
116 ; CHECK-NEXT: and %s0, %s0, (32)0
117 ; CHECK-NEXT: lea.sl %s0, bufi32@hi(, %s0)
118 ; CHECK-NEXT: ldl.zx %s0, 8(, %s0)
119 ; CHECK-NEXT: b.l.t (, %s10)
121 %0 = load i32, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @bufi32, i64 0, i64 2), align 4
125 ; Function Attrs: noinline nounwind optnone
126 define i64 @loadi64z() {
127 ; CHECK-LABEL: loadi64z:
128 ; CHECK: # %bb.0: # %entry
129 ; CHECK-NEXT: lea %s0, bufi64@lo
130 ; CHECK-NEXT: and %s0, %s0, (32)0
131 ; CHECK-NEXT: lea.sl %s0, bufi64@hi(, %s0)
132 ; CHECK-NEXT: ld %s0, 16(, %s0)
133 ; CHECK-NEXT: b.l.t (, %s10)
135 %0 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @bufi64, i64 0, i64 2), align 8
139 ; Function Attrs: noinline nounwind optnone
140 define i128 @loadi128z() {
141 ; CHECK-LABEL: loadi128z:
142 ; CHECK: # %bb.0: # %entry
143 ; CHECK-NEXT: lea %s0, bufi128@lo
144 ; CHECK-NEXT: and %s0, %s0, (32)0
145 ; CHECK-NEXT: lea.sl %s1, bufi128@hi(, %s0)
146 ; CHECK-NEXT: ld %s0, 32(, %s1)
147 ; CHECK-NEXT: ld %s1, 40(, %s1)
148 ; CHECK-NEXT: b.l.t (, %s10)
150 %0 = load i128, i128* getelementptr inbounds ([3 x i128], [3 x i128]* @bufi128, i64 0, i64 2), align 16
154 ; Function Attrs: noinline nounwind optnone
155 define float @loadf32() {
156 ; CHECK-LABEL: loadf32:
157 ; CHECK: # %bb.0: # %entry
158 ; CHECK-NEXT: lea %s0, buff32@lo
159 ; CHECK-NEXT: and %s0, %s0, (32)0
160 ; CHECK-NEXT: lea.sl %s0, buff32@hi(, %s0)
161 ; CHECK-NEXT: ldu %s0, 8(, %s0)
162 ; CHECK-NEXT: b.l.t (, %s10)
164 %0 = load float, float* getelementptr inbounds ([3 x float], [3 x float]* @buff32, i64 0, i64 2), align 4
168 ; Function Attrs: noinline nounwind optnone
169 define double @loadf64() {
170 ; CHECK-LABEL: loadf64:
171 ; CHECK: # %bb.0: # %entry
172 ; CHECK-NEXT: lea %s0, buff64@lo
173 ; CHECK-NEXT: and %s0, %s0, (32)0
174 ; CHECK-NEXT: lea.sl %s0, buff64@hi(, %s0)
175 ; CHECK-NEXT: ld %s0, 16(, %s0)
176 ; CHECK-NEXT: b.l.t (, %s10)
178 %0 = load double, double* getelementptr inbounds ([3 x double], [3 x double]* @buff64, i64 0, i64 2), align 8
182 ; Function Attrs: noinline nounwind optnone
183 define fp128 @loadf128() {
184 ; CHECK-LABEL: loadf128:
185 ; CHECK: # %bb.0: # %entry
186 ; CHECK-NEXT: lea %s0, buff128@lo
187 ; CHECK-NEXT: and %s0, %s0, (32)0
188 ; CHECK-NEXT: lea.sl %s2, buff128@hi(, %s0)
189 ; CHECK-NEXT: ld %s0, 40(, %s2)
190 ; CHECK-NEXT: ld %s1, 32(, %s2)
191 ; CHECK-NEXT: b.l.t (, %s10)
193 %0 = load fp128, fp128* getelementptr inbounds ([3 x fp128], [3 x fp128]* @buff128, i64 0, i64 2), align 16