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
6 @gb = common global [1024 x i8] zeroinitializer, align 8
8 ; CHECK: memub(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##ga)
9 define zeroext i8 @lf2(i32 %i) nounwind readonly {
11 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %i
12 %0 = load i8, i8* %arrayidx, align 1
16 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##gb)
17 define signext i8 @lf2s(i32 %i) nounwind readonly {
19 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @gb, i32 0, i32 %i
20 %0 = load i8, i8* %arrayidx, align 1
24 ; CHECK: memub(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##ga)
25 define zeroext i8 @lf3(i32 %i) nounwind readonly {
27 %mul = shl nsw i32 %i, 2
28 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %mul
29 %0 = load i8, i8* %arrayidx, align 1
33 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##gb)
34 define signext i8 @lf3s(i32 %i) nounwind readonly {
36 %mul = shl nsw i32 %i, 2
37 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @gb, i32 0, i32 %mul
38 %0 = load i8, i8* %arrayidx, align 1
42 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##ga)
43 define void @sf4(i32 %i, i8 zeroext %j) nounwind {
45 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %i
46 store i8 %j, i8* %arrayidx, align 1
50 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##gb)
51 define void @sf4s(i32 %i, i8 signext %j) nounwind {
53 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @gb, i32 0, i32 %i
54 store i8 %j, i8* %arrayidx, align 1
58 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##ga)
59 define void @sf5(i32 %i, i8 zeroext %j) nounwind {
61 %mul = shl nsw i32 %i, 2
62 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %mul
63 store i8 %j, i8* %arrayidx, align 1
67 ; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##gb)
68 define void @sf5s(i32 %i, i8 signext %j) nounwind {
70 %mul = shl nsw i32 %i, 2
71 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @gb, i32 0, i32 %mul
72 store i8 %j, i8* %arrayidx, align 1