1; RUN: llc -march=hexagon < %s | FileCheck %s
2
3; s4_0Imm
4; CHECK: memb(r0++#-1) = r1
5define i8* @foo1(i8* %a, i8 %b)  {
6  store i8 %b, i8* %a
7  %c = getelementptr i8, i8* %a, i32 -1
8  ret i8* %c
9}
10
11; s4_1Imm
12; CHECK: memh(r0++#-2) = r1
13define i16* @foo2(i16* %a, i16 %b)  {
14  store i16 %b, i16* %a
15  %c = getelementptr i16, i16* %a, i32 -1
16  ret i16* %c
17}
18
19; s4_2Imm
20; CHECK: memw(r0++#-4) = r1
21define i32* @foo3(i32* %a, i32 %b)  {
22  store i32 %b, i32* %a
23  %c = getelementptr i32, i32* %a, i32 -1
24  ret i32* %c
25}
26
27; s4_3Imm
28; CHECK: memd(r0++#-8) = r3:2
29define i64* @foo4(i64* %a, i64 %b)  {
30  store i64 %b, i64* %a
31  %c = getelementptr i64, i64* %a, i32 -1
32  ret i64* %c
33}
34
35; s6Ext
36; CHECK: if (p0.new) memw(r0+#0)=#-1
37define void @foo5(i32* %a, i1 %b) {
38br i1 %b, label %x, label %y
39x:
40  store i32 -1, i32* %a
41  ret void
42y:
43  ret void
44}
45
46; s10Ext
47; CHECK: p0 = cmp.eq(r0, #-1)
48define i1 @foo7(i32 %a) {
49  %b = icmp eq i32 %a, -1
50  ret i1 %b
51}
52
53; s11_0Ext
54; CHECK: memb(r0+#-1) = r1
55define void @foo8(i8* %a, i8 %b) {
56  %c = getelementptr i8, i8* %a, i32 -1
57  store i8 %b, i8* %c
58  ret void
59}
60
61; s11_1Ext
62; CHECK: memh(r0+#-2) = r1
63define void @foo9(i16* %a, i16 %b) {
64  %c = getelementptr i16, i16* %a, i32 -1
65  store i16 %b, i16* %c
66  ret void
67}
68
69; s11_2Ext
70; CHECK: memw(r0+#-4) = r1
71define void @foo10(i32* %a, i32 %b) {
72  %c = getelementptr i32, i32* %a, i32 -1
73  store i32 %b, i32* %c
74  ret void
75}
76
77; s11_3Ext
78; CHECK: memd(r0+#-8) = r3:2
79define void @foo11(i64* %a, i64 %b) {
80  %c = getelementptr i64, i64* %a, i32 -1
81  store i64 %b, i64* %c
82  ret void
83}
84
85; s12Ext
86; CHECK: if (p0.new) r0 = #-1
87define i32 @foo12(i32 %a, i1 %b) {
88br i1 %b, label %x, label %y
89x:
90  ret i32 -1
91y:
92  ret i32 %a
93}
94
95; s16Ext
96; CHECK: r0 = #-2
97define i32 @foo13() {
98  ret i32 -2
99}