1 ; RUN: llc -march=hexagon < %s | FileCheck %s
3 ; Bug 6840. Use absolute+index addressing.
5 @ga = common global [1024 x i8] zeroinitializer, align 8
8 ; CHECK: memub(r{{[0-9]+}}+##ga)
9 define zeroext i8 @test0(i32 %i) nounwind readonly {
11 %t = getelementptr inbounds [1024 x i8], ptr @ga, i32 0, i32 %i
12 %0 = load i8, ptr %t, align 1
17 ; CHECK: memb(r{{[0-9]+}}+##ga)
18 define signext i8 @test1(i32 %i) nounwind readonly {
20 %t = getelementptr inbounds [1024 x i8], ptr @ga, i32 0, i32 %i
21 %0 = load i8, ptr %t, align 1
26 ; CHECK: memub(r{{[0-9]+}}<<#1+##ga)
27 define zeroext i8 @test2(i32 %i) nounwind readonly {
29 %j = shl nsw i32 %i, 1
30 %t = getelementptr inbounds [1024 x i8], ptr @ga, i32 0, i32 %j
31 %0 = load i8, ptr %t, align 1
36 ; CHECK: memb(r{{[0-9]+}}<<#1+##ga)
37 define signext i8 @test3(i32 %i) nounwind readonly {
39 %j = shl nsw i32 %i, 1
40 %t = getelementptr inbounds [1024 x i8], ptr @ga, i32 0, i32 %j
41 %0 = load i8, ptr %t, align 1
46 ; CHECK: memub(r{{[0-9]+}}<<#2+##ga)
47 define zeroext i8 @test4(i32 %i) nounwind readonly {
49 %j = shl nsw i32 %i, 2
50 %t = getelementptr inbounds [1024 x i8], ptr @ga, i32 0, i32 %j
51 %0 = load i8, ptr %t, align 1
56 ; CHECK: memb(r{{[0-9]+}}<<#2+##ga)
57 define signext i8 @test5(i32 %i) nounwind readonly {
59 %j = shl nsw i32 %i, 2
60 %t = getelementptr inbounds [1024 x i8], ptr @ga, i32 0, i32 %j
61 %0 = load i8, ptr %t, align 1
66 ; CHECK: memb(r{{[0-9]+}}+##ga)
67 define void @test10(i32 %i, i8 zeroext %v) nounwind {
69 %t = getelementptr inbounds [1024 x i8], ptr @ga, i32 0, i32 %i
70 store i8 %v, ptr %t, align 1
75 ; CHECK: memb(r{{[0-9]+}}<<#1+##ga)
76 define void @test11(i32 %i, i8 signext %v) nounwind {
78 %j = shl nsw i32 %i, 1
79 %t = getelementptr inbounds [1024 x i8], ptr @ga, i32 0, i32 %j
80 store i8 %v, ptr %t, align 1
85 ; CHECK: memb(r{{[0-9]+}}<<#2+##ga)
86 define void @test12(i32 %i, i8 zeroext %v) nounwind {
88 %j = shl nsw i32 %i, 2
89 %t = getelementptr inbounds [1024 x i8], ptr @ga, i32 0, i32 %j
90 store i8 %v, ptr %t, align 1