blob: 6ea2b3d95daf7a296b007016b233540c8dad28a7 [file] [log] [blame]
Colin LeMahieub8575b12015-06-13 21:46:39 +00001; 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@gb = common global [1024 x i8] zeroinitializer, align 8
7
8; CHECK: memub(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##ga)
9define zeroext i8 @lf2(i32 %i) nounwind readonly {
10entry:
11 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %i
12 %0 = load i8, i8* %arrayidx, align 1
13 ret i8 %0
14}
15
16; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##gb)
17define signext i8 @lf2s(i32 %i) nounwind readonly {
18entry:
19 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @gb, i32 0, i32 %i
20 %0 = load i8, i8* %arrayidx, align 1
21 ret i8 %0
22}
23
24; CHECK: memub(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##ga)
25define zeroext i8 @lf3(i32 %i) nounwind readonly {
26entry:
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
30 ret i8 %0
31}
32
33; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##gb)
34define signext i8 @lf3s(i32 %i) nounwind readonly {
35entry:
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
39 ret i8 %0
40}
41
42; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##ga)
43define void @sf4(i32 %i, i8 zeroext %j) nounwind {
44entry:
45 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @ga, i32 0, i32 %i
46 store i8 %j, i8* %arrayidx, align 1
47 ret void
48}
49
50; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#0{{ *}}+{{ *}}##gb)
51define void @sf4s(i32 %i, i8 signext %j) nounwind {
52entry:
53 %arrayidx = getelementptr inbounds [1024 x i8], [1024 x i8]* @gb, i32 0, i32 %i
54 store i8 %j, i8* %arrayidx, align 1
55 ret void
56}
57
58; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##ga)
59define void @sf5(i32 %i, i8 zeroext %j) nounwind {
60entry:
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
64 ret void
65}
66
67; CHECK: memb(r{{[0-9]+}}{{ *}}<<{{ *}}#2{{ *}}+{{ *}}##gb)
68define void @sf5s(i32 %i, i8 signext %j) nounwind {
69entry:
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
73 ret void
74}