1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -march=hexagon < %s | FileCheck %s
4 @array8 = global [128 x i8] zeroinitializer
5 @array32 = global [128 x i32] zeroinitializer
6 @global_gp = global i1 false
10 define i32 @f0(i1* %a0) #0 {
14 ; CHECK-NEXT: r0 = memub(r0+#1)
17 ; CHECK-NEXT: r0 = sub(#0,r0)
18 ; CHECK-NEXT: jumpr r31
20 %v0 = getelementptr i1, i1* %a0, i32 1
21 %v1 = load i1, i1* %v0
22 %v2 = sext i1 %v1 to i32
26 define i32 @f1(i1* %a0, i32 %a1) #0 {
30 ; CHECK-NEXT: r0 = memub(r0+r1<<#0)
33 ; CHECK-NEXT: r0 = sub(#0,r0)
34 ; CHECK-NEXT: jumpr r31
36 %v0 = getelementptr i1, i1* %a0, i32 %a1
37 %v1 = load i1, i1* %v0
38 %v2 = sext i1 %v1 to i32
42 define i32 @f2(i32 %a0) #0 {
46 ; CHECK-NEXT: r0 = memub(r0+##array8)
49 ; CHECK-NEXT: r0 = sub(#0,r0)
50 ; CHECK-NEXT: jumpr r31
52 %v0 = getelementptr [128 x i8], [128 x i8]* @array8, i32 0, i32 %a0
53 %v1 = bitcast i8* %v0 to i1*
54 %v2 = load i1, i1* %v1
55 %v3 = sext i1 %v2 to i32
59 define i32 @f3(i32 %a0) #0 {
63 ; CHECK-NEXT: r0 = memub(r0<<#2+##array32)
66 ; CHECK-NEXT: r0 = sub(#0,r0)
67 ; CHECK-NEXT: jumpr r31
69 %v0 = getelementptr [128 x i32], [128 x i32]* @array32, i32 0, i32 %a0
70 %v1 = bitcast i32* %v0 to i1*
71 %v2 = load i1, i1* %v1
72 %v3 = sext i1 %v2 to i32
80 ; CHECK-NEXT: r0 = memub(gp+#global_gp)
83 ; CHECK-NEXT: r0 = sub(#0,r0)
84 ; CHECK-NEXT: jumpr r31
86 %v0 = load i1, i1* @global_gp
87 %v1 = sext i1 %v0 to i32
91 define i32 @f5(i64 %a0, i64 %a1, i64 %a2, i1 signext %a3) #0 {
95 ; CHECK-NEXT: r0 = memub(r29+#0)
98 ; CHECK-NEXT: r0 = sub(#0,r0)
99 ; CHECK-NEXT: jumpr r31
101 %v0 = sext i1 %a3 to i32
105 define i64 @f6(i1* %a0) #0 {
109 ; CHECK-NEXT: r0 = memub(r0+#1)
112 ; CHECK-NEXT: r0 = sub(#0,r0)
115 ; CHECK-NEXT: r1 = asr(r0,#31)
116 ; CHECK-NEXT: jumpr r31
118 %v0 = getelementptr i1, i1* %a0, i32 1
119 %v1 = load i1, i1* %v0
120 %v2 = sext i1 %v1 to i64
124 define i64 @f7(i1* %a0, i32 %a1) #0 {
128 ; CHECK-NEXT: r0 = memub(r0+r1<<#0)
131 ; CHECK-NEXT: r0 = sub(#0,r0)
134 ; CHECK-NEXT: r1 = asr(r0,#31)
135 ; CHECK-NEXT: jumpr r31
137 %v0 = getelementptr i1, i1* %a0, i32 %a1
138 %v1 = load i1, i1* %v0
139 %v2 = sext i1 %v1 to i64
143 define i64 @f8(i32 %a0) #0 {
147 ; CHECK-NEXT: r0 = memub(r0+##array8)
150 ; CHECK-NEXT: r0 = sub(#0,r0)
153 ; CHECK-NEXT: r1 = asr(r0,#31)
154 ; CHECK-NEXT: jumpr r31
156 %v0 = getelementptr [128 x i8], [128 x i8]* @array8, i32 0, i32 %a0
157 %v1 = bitcast i8* %v0 to i1*
158 %v2 = load i1, i1* %v1
159 %v3 = sext i1 %v2 to i64
163 define i64 @f9(i32 %a0) #0 {
167 ; CHECK-NEXT: r0 = memub(r0<<#2+##array32)
170 ; CHECK-NEXT: r0 = sub(#0,r0)
173 ; CHECK-NEXT: r1 = asr(r0,#31)
174 ; CHECK-NEXT: jumpr r31
176 %v0 = getelementptr [128 x i32], [128 x i32]* @array32, i32 0, i32 %a0
177 %v1 = bitcast i32* %v0 to i1*
178 %v2 = load i1, i1* %v1
179 %v3 = sext i1 %v2 to i64
183 define i64 @f10() #0 {
187 ; CHECK-NEXT: r0 = memub(gp+#global_gp)
190 ; CHECK-NEXT: r0 = sub(#0,r0)
193 ; CHECK-NEXT: r1 = asr(r0,#31)
194 ; CHECK-NEXT: jumpr r31
196 %v0 = load i1, i1* @global_gp
197 %v1 = sext i1 %v0 to i64
201 define i64 @f11(i64 %a0, i64 %a1, i64 %a2, i1 signext %a3) #0 {
205 ; CHECK-NEXT: r0 = memub(r29+#0)
208 ; CHECK-NEXT: r0 = sub(#0,r0)
211 ; CHECK-NEXT: r1 = asr(r0,#31)
212 ; CHECK-NEXT: jumpr r31
214 %v0 = sext i1 %a3 to i64
220 define i32 @f12(i1* %a0) #0 {
224 ; CHECK-NEXT: r0 = memub(r0+#1)
225 ; CHECK-NEXT: jumpr r31
227 %v0 = getelementptr i1, i1* %a0, i32 1
228 %v1 = load i1, i1* %v0
229 %v2 = zext i1 %v1 to i32
233 define i32 @f13(i1* %a0, i32 %a1) #0 {
237 ; CHECK-NEXT: jumpr r31
238 ; CHECK-NEXT: r0 = memub(r0+r1<<#0)
240 %v0 = getelementptr i1, i1* %a0, i32 %a1
241 %v1 = load i1, i1* %v0
242 %v2 = zext i1 %v1 to i32
246 define i32 @f14(i32 %a0) #0 {
250 ; CHECK-NEXT: jumpr r31
251 ; CHECK-NEXT: r0 = memub(r0+##array8)
253 %v0 = getelementptr [128 x i8], [128 x i8]* @array8, i32 0, i32 %a0
254 %v1 = bitcast i8* %v0 to i1*
255 %v2 = load i1, i1* %v1
256 %v3 = zext i1 %v2 to i32
260 define i32 @f15(i32 %a0) #0 {
264 ; CHECK-NEXT: jumpr r31
265 ; CHECK-NEXT: r0 = memub(r0<<#2+##array32)
267 %v0 = getelementptr [128 x i32], [128 x i32]* @array32, i32 0, i32 %a0
268 %v1 = bitcast i32* %v0 to i1*
269 %v2 = load i1, i1* %v1
270 %v3 = zext i1 %v2 to i32
274 define i32 @f16() #0 {
278 ; CHECK-NEXT: jumpr r31
279 ; CHECK-NEXT: r0 = memub(gp+#global_gp)
281 %v0 = load i1, i1* @global_gp
282 %v1 = zext i1 %v0 to i32
286 define i32 @f17(i64 %a0, i64 %a1, i64 %a2, i1 zeroext %a3) #0 {
290 ; CHECK-NEXT: jumpr r31
291 ; CHECK-NEXT: r0 = memub(r29+#0)
293 %v0 = zext i1 %a3 to i32
297 define i64 @f18(i1* %a0) #0 {
301 ; CHECK-NEXT: jumpr r31
302 ; CHECK-NEXT: r1 = #0
303 ; CHECK-NEXT: r0 = memub(r0+#1)
305 %v0 = getelementptr i1, i1* %a0, i32 1
306 %v1 = load i1, i1* %v0
307 %v2 = zext i1 %v1 to i64
311 define i64 @f19(i1* %a0, i32 %a1) #0 {
315 ; CHECK-NEXT: r1 = #0
316 ; CHECK-NEXT: jumpr r31
317 ; CHECK-NEXT: r0 = memub(r0+r1<<#0)
319 %v0 = getelementptr i1, i1* %a0, i32 %a1
320 %v1 = load i1, i1* %v0
321 %v2 = zext i1 %v1 to i64
325 define i64 @f20(i32 %a0) #0 {
329 ; CHECK-NEXT: r1 = #0
330 ; CHECK-NEXT: jumpr r31
331 ; CHECK-NEXT: r0 = memub(r0+##array8)
333 %v0 = getelementptr [128 x i8], [128 x i8]* @array8, i32 0, i32 %a0
334 %v1 = bitcast i8* %v0 to i1*
335 %v2 = load i1, i1* %v1
336 %v3 = zext i1 %v2 to i64
340 define i64 @f21(i32 %a0) #0 {
344 ; CHECK-NEXT: r1 = #0
345 ; CHECK-NEXT: jumpr r31
346 ; CHECK-NEXT: r0 = memub(r0<<#2+##array32)
348 %v0 = getelementptr [128 x i32], [128 x i32]* @array32, i32 0, i32 %a0
349 %v1 = bitcast i32* %v0 to i1*
350 %v2 = load i1, i1* %v1
351 %v3 = zext i1 %v2 to i64
355 define i64 @f22() #0 {
359 ; CHECK-NEXT: r1 = #0
360 ; CHECK-NEXT: jumpr r31
361 ; CHECK-NEXT: r0 = memub(gp+#global_gp)
363 %v0 = load i1, i1* @global_gp
364 %v1 = zext i1 %v0 to i64
368 define i64 @f23(i64 %a0, i64 %a1, i64 %a2, i1 signext %a3) #0 {
372 ; CHECK-NEXT: r1 = #0
373 ; CHECK-NEXT: jumpr r31
374 ; CHECK-NEXT: r0 = memub(r29+#0)
376 %v0 = zext i1 %a3 to i64
380 attributes #0 = { nounwind "target-cpu"="hexagonv66" }