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(ptr %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, ptr %a0, i32 1
21 %v1 = load i1, ptr %v0
22 %v2 = sext i1 %v1 to i32
26 define i32 @f1(ptr %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, ptr %a0, i32 %a1
37 %v1 = load i1, ptr %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], ptr @array8, i32 0, i32 %a0
53 %v2 = load i1, ptr %v0
54 %v3 = sext i1 %v2 to i32
58 define i32 @f3(i32 %a0) #0 {
62 ; CHECK-NEXT: r0 = memub(r0<<#2+##array32)
65 ; CHECK-NEXT: r0 = sub(#0,r0)
66 ; CHECK-NEXT: jumpr r31
68 %v0 = getelementptr [128 x i32], ptr @array32, i32 0, i32 %a0
69 %v2 = load i1, ptr %v0
70 %v3 = sext i1 %v2 to i32
78 ; CHECK-NEXT: r0 = memub(gp+#global_gp)
81 ; CHECK-NEXT: r0 = sub(#0,r0)
82 ; CHECK-NEXT: jumpr r31
84 %v0 = load i1, ptr @global_gp
85 %v1 = sext i1 %v0 to i32
89 define i32 @f5(i64 %a0, i64 %a1, i64 %a2, i1 signext %a3) #0 {
93 ; CHECK-NEXT: r0 = memub(r29+#0)
96 ; CHECK-NEXT: r0 = sub(#0,r0)
97 ; CHECK-NEXT: jumpr r31
99 %v0 = sext i1 %a3 to i32
103 define i64 @f6(ptr %a0) #0 {
107 ; CHECK-NEXT: r0 = memub(r0+#1)
110 ; CHECK-NEXT: r0 = sub(#0,r0)
113 ; CHECK-NEXT: r1 = asr(r0,#31)
114 ; CHECK-NEXT: jumpr r31
116 %v0 = getelementptr i1, ptr %a0, i32 1
117 %v1 = load i1, ptr %v0
118 %v2 = sext i1 %v1 to i64
122 define i64 @f7(ptr %a0, i32 %a1) #0 {
126 ; CHECK-NEXT: r0 = memub(r0+r1<<#0)
129 ; CHECK-NEXT: r0 = sub(#0,r0)
132 ; CHECK-NEXT: r1 = asr(r0,#31)
133 ; CHECK-NEXT: jumpr r31
135 %v0 = getelementptr i1, ptr %a0, i32 %a1
136 %v1 = load i1, ptr %v0
137 %v2 = sext i1 %v1 to i64
141 define i64 @f8(i32 %a0) #0 {
145 ; CHECK-NEXT: r0 = memub(r0+##array8)
148 ; CHECK-NEXT: r0 = sub(#0,r0)
151 ; CHECK-NEXT: r1 = asr(r0,#31)
152 ; CHECK-NEXT: jumpr r31
154 %v0 = getelementptr [128 x i8], ptr @array8, i32 0, i32 %a0
155 %v2 = load i1, ptr %v0
156 %v3 = sext i1 %v2 to i64
160 define i64 @f9(i32 %a0) #0 {
164 ; CHECK-NEXT: r0 = memub(r0<<#2+##array32)
167 ; CHECK-NEXT: r0 = sub(#0,r0)
170 ; CHECK-NEXT: r1 = asr(r0,#31)
171 ; CHECK-NEXT: jumpr r31
173 %v0 = getelementptr [128 x i32], ptr @array32, i32 0, i32 %a0
174 %v2 = load i1, ptr %v0
175 %v3 = sext i1 %v2 to i64
179 define i64 @f10() #0 {
183 ; CHECK-NEXT: r0 = memub(gp+#global_gp)
186 ; CHECK-NEXT: r0 = sub(#0,r0)
189 ; CHECK-NEXT: r1 = asr(r0,#31)
190 ; CHECK-NEXT: jumpr r31
192 %v0 = load i1, ptr @global_gp
193 %v1 = sext i1 %v0 to i64
197 define i64 @f11(i64 %a0, i64 %a1, i64 %a2, i1 signext %a3) #0 {
201 ; CHECK-NEXT: r0 = memub(r29+#0)
204 ; CHECK-NEXT: r0 = sub(#0,r0)
207 ; CHECK-NEXT: r1 = asr(r0,#31)
208 ; CHECK-NEXT: jumpr r31
210 %v0 = sext i1 %a3 to i64
216 define i32 @f12(ptr %a0) #0 {
220 ; CHECK-NEXT: r0 = memub(r0+#1)
221 ; CHECK-NEXT: jumpr r31
223 %v0 = getelementptr i1, ptr %a0, i32 1
224 %v1 = load i1, ptr %v0
225 %v2 = zext i1 %v1 to i32
229 define i32 @f13(ptr %a0, i32 %a1) #0 {
233 ; CHECK-NEXT: jumpr r31
234 ; CHECK-NEXT: r0 = memub(r0+r1<<#0)
236 %v0 = getelementptr i1, ptr %a0, i32 %a1
237 %v1 = load i1, ptr %v0
238 %v2 = zext i1 %v1 to i32
242 define i32 @f14(i32 %a0) #0 {
246 ; CHECK-NEXT: jumpr r31
247 ; CHECK-NEXT: r0 = memub(r0+##array8)
249 %v0 = getelementptr [128 x i8], ptr @array8, i32 0, i32 %a0
250 %v2 = load i1, ptr %v0
251 %v3 = zext i1 %v2 to i32
255 define i32 @f15(i32 %a0) #0 {
259 ; CHECK-NEXT: jumpr r31
260 ; CHECK-NEXT: r0 = memub(r0<<#2+##array32)
262 %v0 = getelementptr [128 x i32], ptr @array32, i32 0, i32 %a0
263 %v2 = load i1, ptr %v0
264 %v3 = zext i1 %v2 to i32
268 define i32 @f16() #0 {
272 ; CHECK-NEXT: jumpr r31
273 ; CHECK-NEXT: r0 = memub(gp+#global_gp)
275 %v0 = load i1, ptr @global_gp
276 %v1 = zext i1 %v0 to i32
280 define i32 @f17(i64 %a0, i64 %a1, i64 %a2, i1 zeroext %a3) #0 {
284 ; CHECK-NEXT: jumpr r31
285 ; CHECK-NEXT: r0 = memub(r29+#0)
287 %v0 = zext i1 %a3 to i32
291 define i64 @f18(ptr %a0) #0 {
295 ; CHECK-NEXT: jumpr r31
296 ; CHECK-NEXT: r1 = #0
297 ; CHECK-NEXT: r0 = memub(r0+#1)
299 %v0 = getelementptr i1, ptr %a0, i32 1
300 %v1 = load i1, ptr %v0
301 %v2 = zext i1 %v1 to i64
305 define i64 @f19(ptr %a0, i32 %a1) #0 {
309 ; CHECK-NEXT: r1 = #0
310 ; CHECK-NEXT: jumpr r31
311 ; CHECK-NEXT: r0 = memub(r0+r1<<#0)
313 %v0 = getelementptr i1, ptr %a0, i32 %a1
314 %v1 = load i1, ptr %v0
315 %v2 = zext i1 %v1 to i64
319 define i64 @f20(i32 %a0) #0 {
323 ; CHECK-NEXT: r1 = #0
324 ; CHECK-NEXT: jumpr r31
325 ; CHECK-NEXT: r0 = memub(r0+##array8)
327 %v0 = getelementptr [128 x i8], ptr @array8, i32 0, i32 %a0
328 %v2 = load i1, ptr %v0
329 %v3 = zext i1 %v2 to i64
333 define i64 @f21(i32 %a0) #0 {
337 ; CHECK-NEXT: r1 = #0
338 ; CHECK-NEXT: jumpr r31
339 ; CHECK-NEXT: r0 = memub(r0<<#2+##array32)
341 %v0 = getelementptr [128 x i32], ptr @array32, i32 0, i32 %a0
342 %v2 = load i1, ptr %v0
343 %v3 = zext i1 %v2 to i64
347 define i64 @f22() #0 {
351 ; CHECK-NEXT: r1 = #0
352 ; CHECK-NEXT: jumpr r31
353 ; CHECK-NEXT: r0 = memub(gp+#global_gp)
355 %v0 = load i1, ptr @global_gp
356 %v1 = zext i1 %v0 to i64
360 define i64 @f23(i64 %a0, i64 %a1, i64 %a2, i1 signext %a3) #0 {
364 ; CHECK-NEXT: r1 = #0
365 ; CHECK-NEXT: jumpr r31
366 ; CHECK-NEXT: r0 = memub(r29+#0)
368 %v0 = zext i1 %a3 to i64
372 attributes #0 = { nounwind "target-cpu"="hexagonv66" }