1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s --check-prefixes=ALL
4 define void @lshr_4bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
5 ; ALL-LABEL: lshr_4bytes:
7 ; ALL-NEXT: ldr w8, [x1]
8 ; ALL-NEXT: ldr w9, [x0]
9 ; ALL-NEXT: lsl w8, w8, #3
10 ; ALL-NEXT: lsr w8, w9, w8
11 ; ALL-NEXT: str w8, [x2]
13 %src = load i32, ptr %src.ptr, align 1
14 %byteOff = load i32, ptr %byteOff.ptr, align 1
15 %bitOff = shl i32 %byteOff, 3
16 %res = lshr i32 %src, %bitOff
17 store i32 %res, ptr %dst, align 1
20 define void @shl_4bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
21 ; ALL-LABEL: shl_4bytes:
23 ; ALL-NEXT: ldr w8, [x1]
24 ; ALL-NEXT: ldr w9, [x0]
25 ; ALL-NEXT: lsl w8, w8, #3
26 ; ALL-NEXT: lsl w8, w9, w8
27 ; ALL-NEXT: str w8, [x2]
29 %src = load i32, ptr %src.ptr, align 1
30 %byteOff = load i32, ptr %byteOff.ptr, align 1
31 %bitOff = shl i32 %byteOff, 3
32 %res = shl i32 %src, %bitOff
33 store i32 %res, ptr %dst, align 1
36 define void @ashr_4bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
37 ; ALL-LABEL: ashr_4bytes:
39 ; ALL-NEXT: ldr w8, [x1]
40 ; ALL-NEXT: ldr w9, [x0]
41 ; ALL-NEXT: lsl w8, w8, #3
42 ; ALL-NEXT: asr w8, w9, w8
43 ; ALL-NEXT: str w8, [x2]
45 %src = load i32, ptr %src.ptr, align 1
46 %byteOff = load i32, ptr %byteOff.ptr, align 1
47 %bitOff = shl i32 %byteOff, 3
48 %res = ashr i32 %src, %bitOff
49 store i32 %res, ptr %dst, align 1
53 define void @lshr_8bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
54 ; ALL-LABEL: lshr_8bytes:
56 ; ALL-NEXT: ldr x8, [x1]
57 ; ALL-NEXT: ldr x9, [x0]
58 ; ALL-NEXT: lsl x8, x8, #3
59 ; ALL-NEXT: lsr x8, x9, x8
60 ; ALL-NEXT: str x8, [x2]
62 %src = load i64, ptr %src.ptr, align 1
63 %byteOff = load i64, ptr %byteOff.ptr, align 1
64 %bitOff = shl i64 %byteOff, 3
65 %res = lshr i64 %src, %bitOff
66 store i64 %res, ptr %dst, align 1
69 define void @shl_8bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
70 ; ALL-LABEL: shl_8bytes:
72 ; ALL-NEXT: ldr x8, [x1]
73 ; ALL-NEXT: ldr x9, [x0]
74 ; ALL-NEXT: lsl x8, x8, #3
75 ; ALL-NEXT: lsl x8, x9, x8
76 ; ALL-NEXT: str x8, [x2]
78 %src = load i64, ptr %src.ptr, align 1
79 %byteOff = load i64, ptr %byteOff.ptr, align 1
80 %bitOff = shl i64 %byteOff, 3
81 %res = shl i64 %src, %bitOff
82 store i64 %res, ptr %dst, align 1
85 define void @ashr_8bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
86 ; ALL-LABEL: ashr_8bytes:
88 ; ALL-NEXT: ldr x8, [x1]
89 ; ALL-NEXT: ldr x9, [x0]
90 ; ALL-NEXT: lsl x8, x8, #3
91 ; ALL-NEXT: asr x8, x9, x8
92 ; ALL-NEXT: str x8, [x2]
94 %src = load i64, ptr %src.ptr, align 1
95 %byteOff = load i64, ptr %byteOff.ptr, align 1
96 %bitOff = shl i64 %byteOff, 3
97 %res = ashr i64 %src, %bitOff
98 store i64 %res, ptr %dst, align 1
102 define void @lshr_16bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
103 ; ALL-LABEL: lshr_16bytes:
105 ; ALL-NEXT: ldr x8, [x1]
106 ; ALL-NEXT: ldp x10, x9, [x0]
107 ; ALL-NEXT: lsl x8, x8, #3
108 ; ALL-NEXT: lsl x11, x9, #1
109 ; ALL-NEXT: and x12, x8, #0x38
110 ; ALL-NEXT: mvn w13, w8
111 ; ALL-NEXT: tst x8, #0x40
112 ; ALL-NEXT: lsr x10, x10, x12
113 ; ALL-NEXT: lsl x11, x11, x13
114 ; ALL-NEXT: lsr x9, x9, x12
115 ; ALL-NEXT: orr x8, x11, x10
116 ; ALL-NEXT: csel x10, xzr, x9, ne
117 ; ALL-NEXT: csel x8, x9, x8, ne
118 ; ALL-NEXT: stp x8, x10, [x2]
120 %src = load i128, ptr %src.ptr, align 1
121 %byteOff = load i128, ptr %byteOff.ptr, align 1
122 %bitOff = shl i128 %byteOff, 3
123 %res = lshr i128 %src, %bitOff
124 store i128 %res, ptr %dst, align 1
127 define void @shl_16bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
128 ; ALL-LABEL: shl_16bytes:
130 ; ALL-NEXT: ldr x8, [x1]
131 ; ALL-NEXT: ldp x9, x10, [x0]
132 ; ALL-NEXT: lsl x8, x8, #3
133 ; ALL-NEXT: lsr x11, x9, #1
134 ; ALL-NEXT: and x12, x8, #0x38
135 ; ALL-NEXT: mvn w13, w8
136 ; ALL-NEXT: tst x8, #0x40
137 ; ALL-NEXT: lsl x10, x10, x12
138 ; ALL-NEXT: lsr x11, x11, x13
139 ; ALL-NEXT: lsl x9, x9, x12
140 ; ALL-NEXT: orr x8, x10, x11
141 ; ALL-NEXT: csel x10, xzr, x9, ne
142 ; ALL-NEXT: csel x8, x9, x8, ne
143 ; ALL-NEXT: stp x10, x8, [x2]
145 %src = load i128, ptr %src.ptr, align 1
146 %byteOff = load i128, ptr %byteOff.ptr, align 1
147 %bitOff = shl i128 %byteOff, 3
148 %res = shl i128 %src, %bitOff
149 store i128 %res, ptr %dst, align 1
152 define void @ashr_16bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
153 ; ALL-LABEL: ashr_16bytes:
155 ; ALL-NEXT: ldr x8, [x1]
156 ; ALL-NEXT: ldp x10, x9, [x0]
157 ; ALL-NEXT: lsl x8, x8, #3
158 ; ALL-NEXT: lsl x11, x9, #1
159 ; ALL-NEXT: and x12, x8, #0x38
160 ; ALL-NEXT: mvn w13, w8
161 ; ALL-NEXT: tst x8, #0x40
162 ; ALL-NEXT: lsr x10, x10, x12
163 ; ALL-NEXT: lsl x11, x11, x13
164 ; ALL-NEXT: asr x12, x9, x12
165 ; ALL-NEXT: asr x9, x9, #63
166 ; ALL-NEXT: orr x8, x11, x10
167 ; ALL-NEXT: csel x9, x9, x12, ne
168 ; ALL-NEXT: csel x8, x12, x8, ne
169 ; ALL-NEXT: stp x8, x9, [x2]
171 %src = load i128, ptr %src.ptr, align 1
172 %byteOff = load i128, ptr %byteOff.ptr, align 1
173 %bitOff = shl i128 %byteOff, 3
174 %res = ashr i128 %src, %bitOff
175 store i128 %res, ptr %dst, align 1
179 define void @lshr_32bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
180 ; ALL-LABEL: lshr_32bytes:
182 ; ALL-NEXT: sub sp, sp, #64
183 ; ALL-NEXT: ldp x9, x8, [x0, #16]
184 ; ALL-NEXT: movi v0.2d, #0000000000000000
185 ; ALL-NEXT: ldr x10, [x1]
186 ; ALL-NEXT: ldr q1, [x0]
187 ; ALL-NEXT: stp x9, x8, [sp, #16]
188 ; ALL-NEXT: mov x8, sp
189 ; ALL-NEXT: and x9, x10, #0x1f
190 ; ALL-NEXT: str q1, [sp]
191 ; ALL-NEXT: add x8, x8, x9
192 ; ALL-NEXT: stp q0, q0, [sp, #32]
193 ; ALL-NEXT: ldp x10, x9, [x8, #16]
194 ; ALL-NEXT: ldr q0, [x8]
195 ; ALL-NEXT: str q0, [x2]
196 ; ALL-NEXT: stp x10, x9, [x2, #16]
197 ; ALL-NEXT: add sp, sp, #64
199 %src = load i256, ptr %src.ptr, align 1
200 %byteOff = load i256, ptr %byteOff.ptr, align 1
201 %bitOff = shl i256 %byteOff, 3
202 %res = lshr i256 %src, %bitOff
203 store i256 %res, ptr %dst, align 1
206 define void @shl_32bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
207 ; ALL-LABEL: shl_32bytes:
209 ; ALL-NEXT: sub sp, sp, #64
210 ; ALL-NEXT: ldp x9, x8, [x0, #16]
211 ; ALL-NEXT: movi v0.2d, #0000000000000000
212 ; ALL-NEXT: ldr x10, [x1]
213 ; ALL-NEXT: ldr q1, [x0]
214 ; ALL-NEXT: stp x9, x8, [sp, #48]
215 ; ALL-NEXT: mov x8, sp
216 ; ALL-NEXT: and x9, x10, #0x1f
217 ; ALL-NEXT: add x8, x8, #32
218 ; ALL-NEXT: stp q0, q0, [sp]
219 ; ALL-NEXT: str q1, [sp, #32]
220 ; ALL-NEXT: sub x8, x8, x9
221 ; ALL-NEXT: ldp x9, x10, [x8, #16]
222 ; ALL-NEXT: ldr q0, [x8]
223 ; ALL-NEXT: str q0, [x2]
224 ; ALL-NEXT: stp x9, x10, [x2, #16]
225 ; ALL-NEXT: add sp, sp, #64
227 %src = load i256, ptr %src.ptr, align 1
228 %byteOff = load i256, ptr %byteOff.ptr, align 1
229 %bitOff = shl i256 %byteOff, 3
230 %res = shl i256 %src, %bitOff
231 store i256 %res, ptr %dst, align 1
234 define void @ashr_32bytes(ptr %src.ptr, ptr %byteOff.ptr, ptr %dst) nounwind {
235 ; ALL-LABEL: ashr_32bytes:
237 ; ALL-NEXT: sub sp, sp, #64
238 ; ALL-NEXT: ldp x9, x8, [x0, #16]
239 ; ALL-NEXT: ldr x10, [x1]
240 ; ALL-NEXT: ldr q0, [x0]
241 ; ALL-NEXT: and x10, x10, #0x1f
242 ; ALL-NEXT: stp x9, x8, [sp, #16]
243 ; ALL-NEXT: asr x8, x8, #63
244 ; ALL-NEXT: mov x9, sp
245 ; ALL-NEXT: str q0, [sp]
246 ; ALL-NEXT: stp x8, x8, [sp, #48]
247 ; ALL-NEXT: stp x8, x8, [sp, #32]
248 ; ALL-NEXT: add x8, x9, x10
249 ; ALL-NEXT: ldp x10, x9, [x8, #16]
250 ; ALL-NEXT: ldr q0, [x8]
251 ; ALL-NEXT: str q0, [x2]
252 ; ALL-NEXT: stp x10, x9, [x2, #16]
253 ; ALL-NEXT: add sp, sp, #64
255 %src = load i256, ptr %src.ptr, align 1
256 %byteOff = load i256, ptr %byteOff.ptr, align 1
257 %bitOff = shl i256 %byteOff, 3
258 %res = ashr i256 %src, %bitOff
259 store i256 %res, ptr %dst, align 1