1 ; RUN: llc < %s -mtriple aarch64--none-eabi -verify-machineinstrs | FileCheck %s
2 ; RUN: llc < %s -mtriple aarch64--none-eabi -mattr=+strict-align -verify-machineinstrs | FileCheck %s -check-prefix=CHECK-STRICT
4 ; CHECK-LABEL: Strh_zero
6 ; CHECK-STRICT-LABEL: Strh_zero
7 ; CHECK-STRICT: strh wzr
8 ; CHECK-STRICT: strh wzr
9 define void @Strh_zero(i16* nocapture %P, i32 %n) {
11 %idxprom = sext i32 %n to i64
12 %arrayidx = getelementptr inbounds i16, i16* %P, i64 %idxprom
13 store i16 0, i16* %arrayidx
14 %add = add nsw i32 %n, 1
15 %idxprom1 = sext i32 %add to i64
16 %arrayidx2 = getelementptr inbounds i16, i16* %P, i64 %idxprom1
17 store i16 0, i16* %arrayidx2
21 ; CHECK-LABEL: Strh_zero_4
23 ; CHECK-STRICT-LABEL: Strh_zero_4
24 ; CHECK-STRICT: strh wzr
25 ; CHECK-STRICT: strh wzr
26 ; CHECK-STRICT: strh wzr
27 ; CHECK-STRICT: strh wzr
28 define void @Strh_zero_4(i16* nocapture %P, i32 %n) {
30 %idxprom = sext i32 %n to i64
31 %arrayidx = getelementptr inbounds i16, i16* %P, i64 %idxprom
32 store i16 0, i16* %arrayidx
33 %add = add nsw i32 %n, 1
34 %idxprom1 = sext i32 %add to i64
35 %arrayidx2 = getelementptr inbounds i16, i16* %P, i64 %idxprom1
36 store i16 0, i16* %arrayidx2
37 %add3 = add nsw i32 %n, 2
38 %idxprom4 = sext i32 %add3 to i64
39 %arrayidx5 = getelementptr inbounds i16, i16* %P, i64 %idxprom4
40 store i16 0, i16* %arrayidx5
41 %add6 = add nsw i32 %n, 3
42 %idxprom7 = sext i32 %add6 to i64
43 %arrayidx8 = getelementptr inbounds i16, i16* %P, i64 %idxprom7
44 store i16 0, i16* %arrayidx8
48 ; CHECK-LABEL: Strw_zero
50 ; CHECK-STRICT-LABEL: Strw_zero
51 ; CHECK-STRICT: stp wzr, wzr
52 define void @Strw_zero(i32* nocapture %P, i32 %n) {
54 %idxprom = sext i32 %n to i64
55 %arrayidx = getelementptr inbounds i32, i32* %P, i64 %idxprom
56 store i32 0, i32* %arrayidx
57 %add = add nsw i32 %n, 1
58 %idxprom1 = sext i32 %add to i64
59 %arrayidx2 = getelementptr inbounds i32, i32* %P, i64 %idxprom1
60 store i32 0, i32* %arrayidx2
64 ; CHECK-LABEL: Strw_zero_nonzero
66 define void @Strw_zero_nonzero(i32* nocapture %P, i32 %n) {
68 %idxprom = sext i32 %n to i64
69 %arrayidx = getelementptr inbounds i32, i32* %P, i64 %idxprom
70 store i32 0, i32* %arrayidx
71 %add = add nsw i32 %n, 1
72 %idxprom1 = sext i32 %add to i64
73 %arrayidx2 = getelementptr inbounds i32, i32* %P, i64 %idxprom1
74 store i32 %n, i32* %arrayidx2
78 ; CHECK-LABEL: Strw_zero_4
80 ; CHECK-STRICT-LABEL: Strw_zero_4
81 ; CHECK-STRICT: stp wzr, wzr
82 ; CHECK-STRICT: stp wzr, wzr
83 define void @Strw_zero_4(i32* nocapture %P, i32 %n) {
85 %idxprom = sext i32 %n to i64
86 %arrayidx = getelementptr inbounds i32, i32* %P, i64 %idxprom
87 store i32 0, i32* %arrayidx
88 %add = add nsw i32 %n, 1
89 %idxprom1 = sext i32 %add to i64
90 %arrayidx2 = getelementptr inbounds i32, i32* %P, i64 %idxprom1
91 store i32 0, i32* %arrayidx2
92 %add3 = add nsw i32 %n, 2
93 %idxprom4 = sext i32 %add3 to i64
94 %arrayidx5 = getelementptr inbounds i32, i32* %P, i64 %idxprom4
95 store i32 0, i32* %arrayidx5
96 %add6 = add nsw i32 %n, 3
97 %idxprom7 = sext i32 %add6 to i64
98 %arrayidx8 = getelementptr inbounds i32, i32* %P, i64 %idxprom7
99 store i32 0, i32* %arrayidx8
103 ; CHECK-LABEL: Sturb_zero
105 ; CHECK-STRICT-LABEL: Sturb_zero
106 ; CHECK-STRICT: sturb wzr
107 ; CHECK-STRICT: sturb wzr
108 define void @Sturb_zero(i8* nocapture %P, i32 %n) #0 {
110 %sub = add nsw i32 %n, -2
111 %idxprom = sext i32 %sub to i64
112 %arrayidx = getelementptr inbounds i8, i8* %P, i64 %idxprom
113 store i8 0, i8* %arrayidx
114 %sub2= add nsw i32 %n, -1
115 %idxprom1 = sext i32 %sub2 to i64
116 %arrayidx2 = getelementptr inbounds i8, i8* %P, i64 %idxprom1
117 store i8 0, i8* %arrayidx2
121 ; CHECK-LABEL: Sturh_zero
123 ; CHECK-STRICT-LABEL: Sturh_zero
124 ; CHECK-STRICT: sturh wzr
125 ; CHECK-STRICT: sturh wzr
126 define void @Sturh_zero(i16* nocapture %P, i32 %n) {
128 %sub = add nsw i32 %n, -2
129 %idxprom = sext i32 %sub to i64
130 %arrayidx = getelementptr inbounds i16, i16* %P, i64 %idxprom
131 store i16 0, i16* %arrayidx
132 %sub1 = add nsw i32 %n, -3
133 %idxprom2 = sext i32 %sub1 to i64
134 %arrayidx3 = getelementptr inbounds i16, i16* %P, i64 %idxprom2
135 store i16 0, i16* %arrayidx3
139 ; CHECK-LABEL: Sturh_zero_4
141 ; CHECK-STRICT-LABEL: Sturh_zero_4
142 ; CHECK-STRICT: sturh wzr
143 ; CHECK-STRICT: sturh wzr
144 ; CHECK-STRICT: sturh wzr
145 ; CHECK-STRICT: sturh wzr
146 define void @Sturh_zero_4(i16* nocapture %P, i32 %n) {
148 %sub = add nsw i32 %n, -3
149 %idxprom = sext i32 %sub to i64
150 %arrayidx = getelementptr inbounds i16, i16* %P, i64 %idxprom
151 store i16 0, i16* %arrayidx
152 %sub1 = add nsw i32 %n, -4
153 %idxprom2 = sext i32 %sub1 to i64
154 %arrayidx3 = getelementptr inbounds i16, i16* %P, i64 %idxprom2
155 store i16 0, i16* %arrayidx3
156 %sub4 = add nsw i32 %n, -2
157 %idxprom5 = sext i32 %sub4 to i64
158 %arrayidx6 = getelementptr inbounds i16, i16* %P, i64 %idxprom5
159 store i16 0, i16* %arrayidx6
160 %sub7 = add nsw i32 %n, -1
161 %idxprom8 = sext i32 %sub7 to i64
162 %arrayidx9 = getelementptr inbounds i16, i16* %P, i64 %idxprom8
163 store i16 0, i16* %arrayidx9
167 ; CHECK-LABEL: Sturw_zero
169 ; CHECK-STRICT-LABEL: Sturw_zero
170 ; CHECK-STRICT: stp wzr, wzr
171 define void @Sturw_zero(i32* nocapture %P, i32 %n) {
173 %sub = add nsw i32 %n, -3
174 %idxprom = sext i32 %sub to i64
175 %arrayidx = getelementptr inbounds i32, i32* %P, i64 %idxprom
176 store i32 0, i32* %arrayidx
177 %sub1 = add nsw i32 %n, -4
178 %idxprom2 = sext i32 %sub1 to i64
179 %arrayidx3 = getelementptr inbounds i32, i32* %P, i64 %idxprom2
180 store i32 0, i32* %arrayidx3
184 ; CHECK-LABEL: Sturw_zero_4
185 ; CHECK: stp xzr, xzr
186 ; CHECK-STRICT-LABEL: Sturw_zero_4
187 ; CHECK-STRICT: stp wzr, wzr
188 ; CHECK-STRICT: stp wzr, wzr
189 define void @Sturw_zero_4(i32* nocapture %P, i32 %n) {
191 %sub = add nsw i32 %n, -3
192 %idxprom = sext i32 %sub to i64
193 %arrayidx = getelementptr inbounds i32, i32* %P, i64 %idxprom
194 store i32 0, i32* %arrayidx
195 %sub1 = add nsw i32 %n, -4
196 %idxprom2 = sext i32 %sub1 to i64
197 %arrayidx3 = getelementptr inbounds i32, i32* %P, i64 %idxprom2
198 store i32 0, i32* %arrayidx3
199 %sub4 = add nsw i32 %n, -2
200 %idxprom5 = sext i32 %sub4 to i64
201 %arrayidx6 = getelementptr inbounds i32, i32* %P, i64 %idxprom5
202 store i32 0, i32* %arrayidx6
203 %sub7 = add nsw i32 %n, -1
204 %idxprom8 = sext i32 %sub7 to i64
205 %arrayidx9 = getelementptr inbounds i32, i32* %P, i64 %idxprom8
206 store i32 0, i32* %arrayidx9