1 ; RUN: llc -march=hexagon < %s | FileCheck %s 2 ; 3 ; Bug 6840. Use absolute+index addressing. 4 5 @ga = common global [1024 x i8] zeroinitializer, align 8 6 7 ; CHECK-LABEL: test0 8 ; CHECK: memub(r{{[0-9]+}}+##ga) 9 define zeroext i8 @test0(i32 %i) nounwind readonly { 10 entry: 11 %t = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %i 12 %0 = load i8, i8* %t, align 1 13 ret i8 %0 14 } 15 16 ; CHECK-LABEL: test1 17 ; CHECK: memb(r{{[0-9]+}}+##ga) 18 define signext i8 @test1(i32 %i) nounwind readonly { 19 entry: 20 %t = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %i 21 %0 = load i8, i8* %t, align 1 22 ret i8 %0 23 } 24 25 ; CHECK-LABEL: test2 26 ; CHECK: memub(r{{[0-9]+}}<<#1+##ga) 27 define zeroext i8 @test2(i32 %i) nounwind readonly { 28 entry: 29 %j = shl nsw i32 %i, 1 30 %t = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %j 31 %0 = load i8, i8* %t, align 1 32 ret i8 %0 33 } 34 35 ; CHECK-LABEL: test3 36 ; CHECK: memb(r{{[0-9]+}}<<#1+##ga) 37 define signext i8 @test3(i32 %i) nounwind readonly { 38 entry: 39 %j = shl nsw i32 %i, 1 40 %t = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %j 41 %0 = load i8, i8* %t, align 1 42 ret i8 %0 43 } 44 45 ; CHECK-LABEL: test4 46 ; CHECK: memub(r{{[0-9]+}}<<#2+##ga) 47 define zeroext i8 @test4(i32 %i) nounwind readonly { 48 entry: 49 %j = shl nsw i32 %i, 2 50 %t = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %j 51 %0 = load i8, i8* %t, align 1 52 ret i8 %0 53 } 54 55 ; CHECK-LABEL: test5 56 ; CHECK: memb(r{{[0-9]+}}<<#2+##ga) 57 define signext i8 @test5(i32 %i) nounwind readonly { 58 entry: 59 %j = shl nsw i32 %i, 2 60 %t = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %j 61 %0 = load i8, i8* %t, align 1 62 ret i8 %0 63 } 64 65 ; CHECK-LABEL: test10 66 ; CHECK: memb(r{{[0-9]+}}+##ga) 67 define void @test10(i32 %i, i8 zeroext %v) nounwind { 68 entry: 69 %t = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %i 70 store i8 %v, i8* %t, align 1 71 ret void 72 } 73 74 ; CHECK-LABEL: test11 75 ; CHECK: memb(r{{[0-9]+}}<<#1+##ga) 76 define void @test11(i32 %i, i8 signext %v) nounwind { 77 entry: 78 %j = shl nsw i32 %i, 1 79 %t = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %j 80 store i8 %v, i8* %t, align 1 81 ret void 82 } 83 84 ; CHECK-LABEL: test12 85 ; CHECK: memb(r{{[0-9]+}}<<#2+##ga) 86 define void @test12(i32 %i, i8 zeroext %v) nounwind { 87 entry: 88 %j = shl nsw i32 %i, 2 89 %t = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %j 90 store i8 %v, i8* %t, align 1 91 ret void 92 } 93