1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=arm64-apple-ios | FileCheck %s
4 ; <rdar://problem/13820218>
6 define signext i16 @extendedLeftShiftcharToshortBy4(i8 signext %a) nounwind readnone ssp {
7 ; CHECK-LABEL: extendedLeftShiftcharToshortBy4:
8 ; CHECK: ; %bb.0: ; %entry
9 ; CHECK-NEXT: add w8, w0, #1
10 ; CHECK-NEXT: sbfiz w0, w8, #4, #8
14 %conv1 = sext i8 %inc to i32
15 %shl = shl nsw i32 %conv1, 4
16 %conv2 = trunc i32 %shl to i16
20 define signext i16 @extendedRightShiftcharToshortBy4(i8 signext %a) nounwind readnone ssp {
21 ; CHECK-LABEL: extendedRightShiftcharToshortBy4:
22 ; CHECK: ; %bb.0: ; %entry
23 ; CHECK-NEXT: add w8, w0, #1
24 ; CHECK-NEXT: sbfx w0, w8, #4, #4
28 %conv1 = sext i8 %inc to i32
29 %shr4 = lshr i32 %conv1, 4
30 %conv2 = trunc i32 %shr4 to i16
34 define signext i16 @extendedLeftShiftcharToshortBy8(i8 signext %a) nounwind readnone ssp {
35 ; CHECK-LABEL: extendedLeftShiftcharToshortBy8:
36 ; CHECK: ; %bb.0: ; %entry
37 ; CHECK-NEXT: add w8, w0, #1
38 ; CHECK-NEXT: sbfiz w0, w8, #8, #8
42 %conv1 = sext i8 %inc to i32
43 %shl = shl nsw i32 %conv1, 8
44 %conv2 = trunc i32 %shl to i16
48 define signext i16 @extendedRightShiftcharToshortBy8(i8 signext %a) nounwind readnone ssp {
49 ; CHECK-LABEL: extendedRightShiftcharToshortBy8:
50 ; CHECK: ; %bb.0: ; %entry
51 ; CHECK-NEXT: add w8, w0, #1
52 ; CHECK-NEXT: sxtb w8, w8
53 ; CHECK-NEXT: asr w0, w8, #8
57 %conv1 = sext i8 %inc to i32
58 %shr4 = lshr i32 %conv1, 8
59 %conv2 = trunc i32 %shr4 to i16
63 define i32 @extendedLeftShiftcharTointBy4(i8 signext %a) nounwind readnone ssp {
64 ; CHECK-LABEL: extendedLeftShiftcharTointBy4:
65 ; CHECK: ; %bb.0: ; %entry
66 ; CHECK-NEXT: add w8, w0, #1
67 ; CHECK-NEXT: sbfiz w0, w8, #4, #8
71 %conv = sext i8 %inc to i32
72 %shl = shl nsw i32 %conv, 4
76 define i32 @extendedRightShiftcharTointBy4(i8 signext %a) nounwind readnone ssp {
77 ; CHECK-LABEL: extendedRightShiftcharTointBy4:
78 ; CHECK: ; %bb.0: ; %entry
79 ; CHECK-NEXT: add w8, w0, #1
80 ; CHECK-NEXT: sbfx w0, w8, #4, #4
84 %conv = sext i8 %inc to i32
85 %shr = ashr i32 %conv, 4
89 define i32 @extendedLeftShiftcharTointBy8(i8 signext %a) nounwind readnone ssp {
90 ; CHECK-LABEL: extendedLeftShiftcharTointBy8:
91 ; CHECK: ; %bb.0: ; %entry
92 ; CHECK-NEXT: add w8, w0, #1
93 ; CHECK-NEXT: sbfiz w0, w8, #8, #8
97 %conv = sext i8 %inc to i32
98 %shl = shl nsw i32 %conv, 8
102 define i32 @extendedRightShiftcharTointBy8(i8 signext %a) nounwind readnone ssp {
103 ; CHECK-LABEL: extendedRightShiftcharTointBy8:
104 ; CHECK: ; %bb.0: ; %entry
105 ; CHECK-NEXT: add w8, w0, #1
106 ; CHECK-NEXT: sxtb w8, w8
107 ; CHECK-NEXT: asr w0, w8, #8
111 %conv = sext i8 %inc to i32
112 %shr = ashr i32 %conv, 8
116 define i64 @extendedLeftShiftcharToint64By4(i8 signext %a) nounwind readnone ssp {
117 ; CHECK-LABEL: extendedLeftShiftcharToint64By4:
118 ; CHECK: ; %bb.0: ; %entry
119 ; CHECK-NEXT: add w8, w0, #1
120 ; CHECK-NEXT: sbfiz x0, x8, #4, #8
124 %conv = sext i8 %inc to i64
125 %shl = shl nsw i64 %conv, 4
129 define i64 @extendedRightShiftcharToint64By4(i8 signext %a) nounwind readnone ssp {
130 ; CHECK-LABEL: extendedRightShiftcharToint64By4:
131 ; CHECK: ; %bb.0: ; %entry
132 ; CHECK-NEXT: add w8, w0, #1
133 ; CHECK-NEXT: sbfx x0, x8, #4, #4
137 %conv = sext i8 %inc to i64
138 %shr = ashr i64 %conv, 4
142 define i64 @extendedLeftShiftcharToint64By8(i8 signext %a) nounwind readnone ssp {
143 ; CHECK-LABEL: extendedLeftShiftcharToint64By8:
144 ; CHECK: ; %bb.0: ; %entry
145 ; CHECK-NEXT: add w8, w0, #1
146 ; CHECK-NEXT: sbfiz x0, x8, #8, #8
150 %conv = sext i8 %inc to i64
151 %shl = shl nsw i64 %conv, 8
155 define i64 @extendedRightShiftcharToint64By8(i8 signext %a) nounwind readnone ssp {
156 ; CHECK-LABEL: extendedRightShiftcharToint64By8:
157 ; CHECK: ; %bb.0: ; %entry
158 ; CHECK-NEXT: add w8, w0, #1
159 ; CHECK-NEXT: sxtb x8, w8
160 ; CHECK-NEXT: asr x0, x8, #8
164 %conv = sext i8 %inc to i64
165 %shr = ashr i64 %conv, 8
169 define i32 @extendedLeftShiftshortTointBy4(i16 signext %a) nounwind readnone ssp {
170 ; CHECK-LABEL: extendedLeftShiftshortTointBy4:
171 ; CHECK: ; %bb.0: ; %entry
172 ; CHECK-NEXT: add w8, w0, #1
173 ; CHECK-NEXT: sbfiz w0, w8, #4, #16
177 %conv = sext i16 %inc to i32
178 %shl = shl nsw i32 %conv, 4
182 define i32 @extendedRightShiftshortTointBy4(i16 signext %a) nounwind readnone ssp {
183 ; CHECK-LABEL: extendedRightShiftshortTointBy4:
184 ; CHECK: ; %bb.0: ; %entry
185 ; CHECK-NEXT: add w8, w0, #1
186 ; CHECK-NEXT: sbfx w0, w8, #4, #12
190 %conv = sext i16 %inc to i32
191 %shr = ashr i32 %conv, 4
195 define i32 @extendedLeftShiftshortTointBy16(i16 signext %a) nounwind readnone ssp {
196 ; CHECK-LABEL: extendedLeftShiftshortTointBy16:
197 ; CHECK: ; %bb.0: ; %entry
198 ; CHECK-NEXT: lsl w8, w0, #16
199 ; CHECK-NEXT: add w0, w8, #16, lsl #12 ; =65536
203 %conv2 = zext i16 %inc to i32
204 %shl = shl nuw i32 %conv2, 16
208 define i32 @extendedRightShiftshortTointBy16(i16 signext %a) nounwind readnone ssp {
209 ; CHECK-LABEL: extendedRightShiftshortTointBy16:
210 ; CHECK: ; %bb.0: ; %entry
211 ; CHECK-NEXT: add w8, w0, #1
212 ; CHECK-NEXT: sxth w8, w8
213 ; CHECK-NEXT: asr w0, w8, #16
217 %conv = sext i16 %inc to i32
218 %shr = ashr i32 %conv, 16
222 define i64 @extendedLeftShiftshortToint64By4(i16 signext %a) nounwind readnone ssp {
223 ; CHECK-LABEL: extendedLeftShiftshortToint64By4:
224 ; CHECK: ; %bb.0: ; %entry
225 ; CHECK-NEXT: add w8, w0, #1
226 ; CHECK-NEXT: sbfiz x0, x8, #4, #16
230 %conv = sext i16 %inc to i64
231 %shl = shl nsw i64 %conv, 4
235 define i64 @extendedRightShiftshortToint64By4(i16 signext %a) nounwind readnone ssp {
236 ; CHECK-LABEL: extendedRightShiftshortToint64By4:
237 ; CHECK: ; %bb.0: ; %entry
238 ; CHECK-NEXT: add w8, w0, #1
239 ; CHECK-NEXT: sbfx x0, x8, #4, #12
243 %conv = sext i16 %inc to i64
244 %shr = ashr i64 %conv, 4
248 define i64 @extendedLeftShiftshortToint64By16(i16 signext %a) nounwind readnone ssp {
249 ; CHECK-LABEL: extendedLeftShiftshortToint64By16:
250 ; CHECK: ; %bb.0: ; %entry
251 ; CHECK-NEXT: add w8, w0, #1
252 ; CHECK-NEXT: sbfiz x0, x8, #16, #16
256 %conv = sext i16 %inc to i64
257 %shl = shl nsw i64 %conv, 16
261 define i64 @extendedRightShiftshortToint64By16(i16 signext %a) nounwind readnone ssp {
262 ; CHECK-LABEL: extendedRightShiftshortToint64By16:
263 ; CHECK: ; %bb.0: ; %entry
264 ; CHECK-NEXT: add w8, w0, #1
265 ; CHECK-NEXT: sxth x8, w8
266 ; CHECK-NEXT: asr x0, x8, #16
270 %conv = sext i16 %inc to i64
271 %shr = ashr i64 %conv, 16
275 define i64 @extendedLeftShiftintToint64By4(i32 %a) nounwind readnone ssp {
276 ; CHECK-LABEL: extendedLeftShiftintToint64By4:
277 ; CHECK: ; %bb.0: ; %entry
278 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
279 ; CHECK-NEXT: sbfiz x8, x0, #4, #32
280 ; CHECK-NEXT: add x0, x8, #16
283 %inc = add nsw i32 %a, 1
284 %conv = sext i32 %inc to i64
285 %shl = shl nsw i64 %conv, 4
289 define i64 @extendedRightShiftintToint64By4(i32 %a) nounwind readnone ssp {
290 ; CHECK-LABEL: extendedRightShiftintToint64By4:
291 ; CHECK: ; %bb.0: ; %entry
292 ; CHECK-NEXT: add w8, w0, #1
293 ; CHECK-NEXT: sbfx x0, x8, #4, #28
296 %inc = add nsw i32 %a, 1
297 %conv = sext i32 %inc to i64
298 %shr = ashr i64 %conv, 4
302 define i64 @extendedLeftShiftintToint64By32(i32 %a) nounwind readnone ssp {
303 ; CHECK-LABEL: extendedLeftShiftintToint64By32:
304 ; CHECK: ; %bb.0: ; %entry
305 ; CHECK-NEXT: add w8, w0, #1
306 ; CHECK-NEXT: lsl x0, x8, #32
309 %inc = add nsw i32 %a, 1
310 %conv2 = zext i32 %inc to i64
311 %shl = shl nuw i64 %conv2, 32
315 define i64 @extendedRightShiftintToint64By32(i32 %a) nounwind readnone ssp {
316 ; CHECK-LABEL: extendedRightShiftintToint64By32:
317 ; CHECK: ; %bb.0: ; %entry
318 ; CHECK-NEXT: add w8, w0, #1
319 ; CHECK-NEXT: sxtw x8, w8
320 ; CHECK-NEXT: asr x0, x8, #32
323 %inc = add nsw i32 %a, 1
324 %conv = sext i32 %inc to i64
325 %shr = ashr i64 %conv, 32
329 define i64 @sign_extend_inreg_isdef32(i64) {
330 ; CHECK-LABEL: sign_extend_inreg_isdef32:
332 ; CHECK-NEXT: sbfx x8, x0, #32, #16
333 ; CHECK-NEXT: mov w0, w8
337 %4 = trunc i64 %3 to i32
338 %5 = ashr exact i32 %4, 16
339 %6 = zext i32 %5 to i64