1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s --check-prefixes=ALL
3 define void @lshr_4bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
4 ; ALL-LABEL: lshr_4bytes:
6 ; ALL-NEXT: ldr w8, [x0]
7 ; ALL-NEXT: ldr w9, [x1]
8 ; ALL-NEXT: lsr w8, w8, w9
9 ; ALL-NEXT: str w8, [x2]
11 %src = load i32, ptr %src.ptr, align 1
12 %bitOff = load i32, ptr %bitOff.ptr, align 1
13 %res = lshr i32 %src, %bitOff
14 store i32 %res, ptr %dst, align 1
17 define void @shl_4bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
18 ; ALL-LABEL: shl_4bytes:
20 ; ALL-NEXT: ldr w8, [x0]
21 ; ALL-NEXT: ldr w9, [x1]
22 ; ALL-NEXT: lsl w8, w8, w9
23 ; ALL-NEXT: str w8, [x2]
25 %src = load i32, ptr %src.ptr, align 1
26 %bitOff = load i32, ptr %bitOff.ptr, align 1
27 %res = shl i32 %src, %bitOff
28 store i32 %res, ptr %dst, align 1
31 define void @ashr_4bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
32 ; ALL-LABEL: ashr_4bytes:
34 ; ALL-NEXT: ldr w8, [x0]
35 ; ALL-NEXT: ldr w9, [x1]
36 ; ALL-NEXT: asr w8, w8, w9
37 ; ALL-NEXT: str w8, [x2]
39 %src = load i32, ptr %src.ptr, align 1
40 %bitOff = load i32, ptr %bitOff.ptr, align 1
41 %res = ashr i32 %src, %bitOff
42 store i32 %res, ptr %dst, align 1
45 define void @lshr_8bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
46 ; ALL-LABEL: lshr_8bytes:
48 ; ALL-NEXT: ldr x8, [x0]
49 ; ALL-NEXT: ldr x9, [x1]
50 ; ALL-NEXT: lsr x8, x8, x9
51 ; ALL-NEXT: str x8, [x2]
53 %src = load i64, ptr %src.ptr, align 1
54 %bitOff = load i64, ptr %bitOff.ptr, align 1
55 %res = lshr i64 %src, %bitOff
56 store i64 %res, ptr %dst, align 1
59 define void @shl_8bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
60 ; ALL-LABEL: shl_8bytes:
62 ; ALL-NEXT: ldr x8, [x0]
63 ; ALL-NEXT: ldr x9, [x1]
64 ; ALL-NEXT: lsl x8, x8, x9
65 ; ALL-NEXT: str x8, [x2]
67 %src = load i64, ptr %src.ptr, align 1
68 %bitOff = load i64, ptr %bitOff.ptr, align 1
69 %res = shl i64 %src, %bitOff
70 store i64 %res, ptr %dst, align 1
73 define void @ashr_8bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
74 ; ALL-LABEL: ashr_8bytes:
76 ; ALL-NEXT: ldr x8, [x0]
77 ; ALL-NEXT: ldr x9, [x1]
78 ; ALL-NEXT: asr x8, x8, x9
79 ; ALL-NEXT: str x8, [x2]
81 %src = load i64, ptr %src.ptr, align 1
82 %bitOff = load i64, ptr %bitOff.ptr, align 1
83 %res = ashr i64 %src, %bitOff
84 store i64 %res, ptr %dst, align 1
87 define void @lshr_16bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
88 ; ALL-LABEL: lshr_16bytes:
90 ; ALL-NEXT: ldp x10, x8, [x0]
91 ; ALL-NEXT: ldr x9, [x1]
92 ; ALL-NEXT: mvn w12, w9
93 ; ALL-NEXT: tst x9, #0x40
94 ; ALL-NEXT: lsl x11, x8, #1
95 ; ALL-NEXT: lsr x10, x10, x9
96 ; ALL-NEXT: lsr x8, x8, x9
97 ; ALL-NEXT: lsl x11, x11, x12
98 ; ALL-NEXT: orr x9, x11, x10
99 ; ALL-NEXT: csel x10, xzr, x8, ne
100 ; ALL-NEXT: csel x8, x8, x9, ne
101 ; ALL-NEXT: stp x8, x10, [x2]
103 %src = load i128, ptr %src.ptr, align 1
104 %bitOff = load i128, ptr %bitOff.ptr, align 1
105 %res = lshr i128 %src, %bitOff
106 store i128 %res, ptr %dst, align 1
109 define void @shl_16bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
110 ; ALL-LABEL: shl_16bytes:
112 ; ALL-NEXT: ldp x8, x10, [x0]
113 ; ALL-NEXT: ldr x9, [x1]
114 ; ALL-NEXT: mvn w12, w9
115 ; ALL-NEXT: tst x9, #0x40
116 ; ALL-NEXT: lsr x11, x8, #1
117 ; ALL-NEXT: lsl x10, x10, x9
118 ; ALL-NEXT: lsl x8, x8, x9
119 ; ALL-NEXT: lsr x11, x11, x12
120 ; ALL-NEXT: orr x9, x10, x11
121 ; ALL-NEXT: csel x10, xzr, x8, ne
122 ; ALL-NEXT: csel x8, x8, x9, ne
123 ; ALL-NEXT: stp x10, x8, [x2]
125 %src = load i128, ptr %src.ptr, align 1
126 %bitOff = load i128, ptr %bitOff.ptr, align 1
127 %res = shl i128 %src, %bitOff
128 store i128 %res, ptr %dst, align 1
131 define void @ashr_16bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
132 ; ALL-LABEL: ashr_16bytes:
134 ; ALL-NEXT: ldp x9, x8, [x0]
135 ; ALL-NEXT: ldr x10, [x1]
136 ; ALL-NEXT: mvn w12, w10
137 ; ALL-NEXT: tst x10, #0x40
138 ; ALL-NEXT: lsl x11, x8, #1
139 ; ALL-NEXT: lsr x9, x9, x10
140 ; ALL-NEXT: lsl x11, x11, x12
141 ; ALL-NEXT: asr x12, x8, x10
142 ; ALL-NEXT: asr x8, x8, #63
143 ; ALL-NEXT: orr x9, x11, x9
144 ; ALL-NEXT: csel x8, x8, x12, ne
145 ; ALL-NEXT: csel x9, x12, x9, ne
146 ; ALL-NEXT: stp x9, x8, [x2]
148 %src = load i128, ptr %src.ptr, align 1
149 %bitOff = load i128, ptr %bitOff.ptr, align 1
150 %res = ashr i128 %src, %bitOff
151 store i128 %res, ptr %dst, align 1
154 define void @lshr_32bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
155 ; ALL-LABEL: lshr_32bytes:
157 ; ALL-NEXT: sub sp, sp, #64
158 ; ALL-NEXT: ldp x9, x8, [x0, #16]
159 ; ALL-NEXT: movi v0.2d, #0000000000000000
160 ; ALL-NEXT: ldr x10, [x1]
161 ; ALL-NEXT: ldr q1, [x0]
162 ; ALL-NEXT: stp x9, x8, [sp, #16]
163 ; ALL-NEXT: ubfx x8, x10, #3, #5
164 ; ALL-NEXT: mov x9, sp
165 ; ALL-NEXT: str q1, [sp]
166 ; ALL-NEXT: and x10, x10, #0x7
167 ; ALL-NEXT: stp q0, q0, [sp, #32]
168 ; ALL-NEXT: add x8, x9, x8
169 ; ALL-NEXT: mvn w13, w10
170 ; ALL-NEXT: ldp x11, x9, [x8, #16]
171 ; ALL-NEXT: ldp x8, x12, [x8]
172 ; ALL-NEXT: lsl x14, x9, #1
173 ; ALL-NEXT: lsl x15, x11, #1
174 ; ALL-NEXT: lsr x11, x11, x10
175 ; ALL-NEXT: lsl x16, x12, #1
176 ; ALL-NEXT: lsr x9, x9, x10
177 ; ALL-NEXT: lsr x12, x12, x10
178 ; ALL-NEXT: lsl x14, x14, x13
179 ; ALL-NEXT: lsr x8, x8, x10
180 ; ALL-NEXT: lsl x10, x16, x13
181 ; ALL-NEXT: lsl x13, x15, x13
182 ; ALL-NEXT: orr x11, x14, x11
183 ; ALL-NEXT: stp x11, x9, [x2, #16]
184 ; ALL-NEXT: orr x8, x10, x8
185 ; ALL-NEXT: orr x9, x12, x13
186 ; ALL-NEXT: stp x8, x9, [x2]
187 ; ALL-NEXT: add sp, sp, #64
189 %src = load i256, ptr %src.ptr, align 1
190 %bitOff = load i256, ptr %bitOff.ptr, align 1
191 %res = lshr i256 %src, %bitOff
192 store i256 %res, ptr %dst, align 1
195 define void @shl_32bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
196 ; ALL-LABEL: shl_32bytes:
198 ; ALL-NEXT: sub sp, sp, #64
199 ; ALL-NEXT: ldp x9, x8, [x0, #16]
200 ; ALL-NEXT: movi v0.2d, #0000000000000000
201 ; ALL-NEXT: ldr x10, [x1]
202 ; ALL-NEXT: ldr q1, [x0]
203 ; ALL-NEXT: stp x9, x8, [sp, #48]
204 ; ALL-NEXT: mov x8, sp
205 ; ALL-NEXT: ubfx x9, x10, #3, #5
206 ; ALL-NEXT: add x8, x8, #32
207 ; ALL-NEXT: stp q0, q1, [sp, #16]
208 ; ALL-NEXT: and x10, x10, #0x7
209 ; ALL-NEXT: str q0, [sp]
210 ; ALL-NEXT: sub x8, x8, x9
211 ; ALL-NEXT: mvn w13, w10
212 ; ALL-NEXT: ldp x9, x11, [x8]
213 ; ALL-NEXT: ldp x12, x8, [x8, #16]
214 ; ALL-NEXT: lsr x14, x9, #1
215 ; ALL-NEXT: lsr x15, x11, #1
216 ; ALL-NEXT: lsl x11, x11, x10
217 ; ALL-NEXT: lsr x16, x12, #1
218 ; ALL-NEXT: lsl x9, x9, x10
219 ; ALL-NEXT: lsl x12, x12, x10
220 ; ALL-NEXT: lsr x14, x14, x13
221 ; ALL-NEXT: lsl x8, x8, x10
222 ; ALL-NEXT: lsr x10, x16, x13
223 ; ALL-NEXT: lsr x13, x15, x13
224 ; ALL-NEXT: orr x11, x11, x14
225 ; ALL-NEXT: stp x9, x11, [x2]
226 ; ALL-NEXT: orr x8, x8, x10
227 ; ALL-NEXT: orr x9, x12, x13
228 ; ALL-NEXT: stp x9, x8, [x2, #16]
229 ; ALL-NEXT: add sp, sp, #64
231 %src = load i256, ptr %src.ptr, align 1
232 %bitOff = load i256, ptr %bitOff.ptr, align 1
233 %res = shl i256 %src, %bitOff
234 store i256 %res, ptr %dst, align 1
237 define void @ashr_32bytes(ptr %src.ptr, ptr %bitOff.ptr, ptr %dst) nounwind {
238 ; ALL-LABEL: ashr_32bytes:
240 ; ALL-NEXT: sub sp, sp, #64
241 ; ALL-NEXT: ldp x9, x8, [x0, #16]
242 ; ALL-NEXT: mov x11, sp
243 ; ALL-NEXT: ldr x10, [x1]
244 ; ALL-NEXT: ldr q0, [x0]
245 ; ALL-NEXT: stp x9, x8, [sp, #16]
246 ; ALL-NEXT: asr x8, x8, #63
247 ; ALL-NEXT: ubfx x9, x10, #3, #5
248 ; ALL-NEXT: str q0, [sp]
249 ; ALL-NEXT: and x10, x10, #0x7
250 ; ALL-NEXT: stp x8, x8, [sp, #48]
251 ; ALL-NEXT: add x9, x11, x9
252 ; ALL-NEXT: mvn w13, w10
253 ; ALL-NEXT: stp x8, x8, [sp, #32]
254 ; ALL-NEXT: ldp x11, x8, [x9, #16]
255 ; ALL-NEXT: ldp x9, x12, [x9]
256 ; ALL-NEXT: lsl x14, x8, #1
257 ; ALL-NEXT: lsl x15, x11, #1
258 ; ALL-NEXT: lsr x11, x11, x10
259 ; ALL-NEXT: lsl x16, x12, #1
260 ; ALL-NEXT: asr x8, x8, x10
261 ; ALL-NEXT: lsr x12, x12, x10
262 ; ALL-NEXT: lsl x14, x14, x13
263 ; ALL-NEXT: lsr x9, x9, x10
264 ; ALL-NEXT: lsl x10, x16, x13
265 ; ALL-NEXT: lsl x13, x15, x13
266 ; ALL-NEXT: orr x11, x14, x11
267 ; ALL-NEXT: stp x11, x8, [x2, #16]
268 ; ALL-NEXT: orr x8, x10, x9
269 ; ALL-NEXT: orr x9, x12, x13
270 ; ALL-NEXT: stp x8, x9, [x2]
271 ; ALL-NEXT: add sp, sp, #64
273 %src = load i256, ptr %src.ptr, align 1
274 %bitOff = load i256, ptr %bitOff.ptr, align 1
275 %res = ashr i256 %src, %bitOff
276 store i256 %res, ptr %dst, align 1