1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-unknown-linux-gnu -mattr=-neon | FileCheck %s --check-prefixes=ALL,GPR
3 ; RUN: llc < %s -mtriple=aarch64-unknown-linux-gnu -mattr=neon | FileCheck %s --check-prefixes=ALL,NEON
5 declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind
6 declare void @llvm.memset.inline.p0.i64(ptr nocapture, i8, i64, i1) nounwind
8 ; /////////////////////////////////////////////////////////////////////////////
10 define void @memset_1(ptr %a, i8 %value) nounwind {
11 ; ALL-LABEL: memset_1:
13 ; ALL-NEXT: strb w1, [x0]
15 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 %value, i64 1, i1 0)
19 define void @memset_2(ptr %a, i8 %value) nounwind {
20 ; ALL-LABEL: memset_2:
22 ; ALL-NEXT: bfi w1, w1, #8, #24
23 ; ALL-NEXT: strh w1, [x0]
25 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 %value, i64 2, i1 0)
29 define void @memset_4(ptr %a, i8 %value) nounwind {
30 ; ALL-LABEL: memset_4:
32 ; ALL-NEXT: mov w8, #16843009
33 ; ALL-NEXT: and w9, w1, #0xff
34 ; ALL-NEXT: mul w8, w9, w8
35 ; ALL-NEXT: str w8, [x0]
37 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 %value, i64 4, i1 0)
41 define void @memset_8(ptr %a, i8 %value) nounwind {
42 ; ALL-LABEL: memset_8:
44 ; ALL-NEXT: // kill: def $w1 killed $w1 def $x1
45 ; ALL-NEXT: mov x8, #72340172838076673
46 ; ALL-NEXT: and x9, x1, #0xff
47 ; ALL-NEXT: mul x8, x9, x8
48 ; ALL-NEXT: str x8, [x0]
50 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 %value, i64 8, i1 0)
54 define void @memset_16(ptr %a, i8 %value) nounwind {
55 ; ALL-LABEL: memset_16:
57 ; ALL-NEXT: // kill: def $w1 killed $w1 def $x1
58 ; ALL-NEXT: mov x8, #72340172838076673
59 ; ALL-NEXT: and x9, x1, #0xff
60 ; ALL-NEXT: mul x8, x9, x8
61 ; ALL-NEXT: stp x8, x8, [x0]
63 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 %value, i64 16, i1 0)
67 define void @memset_32(ptr %a, i8 %value) nounwind {
68 ; GPR-LABEL: memset_32:
70 ; GPR-NEXT: // kill: def $w1 killed $w1 def $x1
71 ; GPR-NEXT: mov x8, #72340172838076673
72 ; GPR-NEXT: and x9, x1, #0xff
73 ; GPR-NEXT: mul x8, x9, x8
74 ; GPR-NEXT: stp x8, x8, [x0, #16]
75 ; GPR-NEXT: stp x8, x8, [x0]
78 ; NEON-LABEL: memset_32:
80 ; NEON-NEXT: dup v0.16b, w1
81 ; NEON-NEXT: stp q0, q0, [x0]
83 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 %value, i64 32, i1 0)
87 define void @memset_64(ptr %a, i8 %value) nounwind {
88 ; GPR-LABEL: memset_64:
90 ; GPR-NEXT: // kill: def $w1 killed $w1 def $x1
91 ; GPR-NEXT: mov x8, #72340172838076673
92 ; GPR-NEXT: and x9, x1, #0xff
93 ; GPR-NEXT: mul x8, x9, x8
94 ; GPR-NEXT: stp x8, x8, [x0, #48]
95 ; GPR-NEXT: stp x8, x8, [x0, #32]
96 ; GPR-NEXT: stp x8, x8, [x0, #16]
97 ; GPR-NEXT: stp x8, x8, [x0]
100 ; NEON-LABEL: memset_64:
102 ; NEON-NEXT: dup v0.16b, w1
103 ; NEON-NEXT: stp q0, q0, [x0]
104 ; NEON-NEXT: stp q0, q0, [x0, #32]
106 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 %value, i64 64, i1 0)
110 ; /////////////////////////////////////////////////////////////////////////////
112 define void @aligned_memset_16(ptr align 16 %a, i8 %value) nounwind {
113 ; ALL-LABEL: aligned_memset_16:
115 ; ALL-NEXT: // kill: def $w1 killed $w1 def $x1
116 ; ALL-NEXT: mov x8, #72340172838076673
117 ; ALL-NEXT: and x9, x1, #0xff
118 ; ALL-NEXT: mul x8, x9, x8
119 ; ALL-NEXT: stp x8, x8, [x0]
121 tail call void @llvm.memset.inline.p0.i64(ptr align 16 %a, i8 %value, i64 16, i1 0)
125 define void @aligned_memset_32(ptr align 32 %a, i8 %value) nounwind {
126 ; GPR-LABEL: aligned_memset_32:
128 ; GPR-NEXT: // kill: def $w1 killed $w1 def $x1
129 ; GPR-NEXT: mov x8, #72340172838076673
130 ; GPR-NEXT: and x9, x1, #0xff
131 ; GPR-NEXT: mul x8, x9, x8
132 ; GPR-NEXT: stp x8, x8, [x0, #16]
133 ; GPR-NEXT: stp x8, x8, [x0]
136 ; NEON-LABEL: aligned_memset_32:
138 ; NEON-NEXT: dup v0.16b, w1
139 ; NEON-NEXT: stp q0, q0, [x0]
141 tail call void @llvm.memset.inline.p0.i64(ptr align 32 %a, i8 %value, i64 32, i1 0)
145 define void @aligned_memset_64(ptr align 64 %a, i8 %value) nounwind {
146 ; GPR-LABEL: aligned_memset_64:
148 ; GPR-NEXT: // kill: def $w1 killed $w1 def $x1
149 ; GPR-NEXT: mov x8, #72340172838076673
150 ; GPR-NEXT: and x9, x1, #0xff
151 ; GPR-NEXT: mul x8, x9, x8
152 ; GPR-NEXT: stp x8, x8, [x0, #48]
153 ; GPR-NEXT: stp x8, x8, [x0, #32]
154 ; GPR-NEXT: stp x8, x8, [x0, #16]
155 ; GPR-NEXT: stp x8, x8, [x0]
158 ; NEON-LABEL: aligned_memset_64:
160 ; NEON-NEXT: dup v0.16b, w1
161 ; NEON-NEXT: stp q0, q0, [x0]
162 ; NEON-NEXT: stp q0, q0, [x0, #32]
164 tail call void @llvm.memset.inline.p0.i64(ptr align 64 %a, i8 %value, i64 64, i1 0)
168 ; /////////////////////////////////////////////////////////////////////////////
170 define void @bzero_1(ptr %a) nounwind {
171 ; ALL-LABEL: bzero_1:
173 ; ALL-NEXT: strb wzr, [x0]
175 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 0, i64 1, i1 0)
179 define void @bzero_2(ptr %a) nounwind {
180 ; ALL-LABEL: bzero_2:
182 ; ALL-NEXT: strh wzr, [x0]
184 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 0, i64 2, i1 0)
188 define void @bzero_4(ptr %a) nounwind {
189 ; ALL-LABEL: bzero_4:
191 ; ALL-NEXT: str wzr, [x0]
193 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 0, i64 4, i1 0)
197 define void @bzero_8(ptr %a) nounwind {
198 ; ALL-LABEL: bzero_8:
200 ; ALL-NEXT: str xzr, [x0]
202 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 0, i64 8, i1 0)
206 define void @bzero_16(ptr %a) nounwind {
207 ; ALL-LABEL: bzero_16:
209 ; ALL-NEXT: stp xzr, xzr, [x0]
211 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 0, i64 16, i1 0)
215 define void @bzero_32(ptr %a) nounwind {
216 ; GPR-LABEL: bzero_32:
218 ; GPR-NEXT: adrp x8, .LCPI15_0
219 ; GPR-NEXT: ldr q0, [x8, :lo12:.LCPI15_0]
220 ; GPR-NEXT: stp q0, q0, [x0]
223 ; NEON-LABEL: bzero_32:
225 ; NEON-NEXT: movi v0.2d, #0000000000000000
226 ; NEON-NEXT: stp q0, q0, [x0]
228 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 0, i64 32, i1 0)
232 define void @bzero_64(ptr %a) nounwind {
233 ; GPR-LABEL: bzero_64:
235 ; GPR-NEXT: adrp x8, .LCPI16_0
236 ; GPR-NEXT: ldr q0, [x8, :lo12:.LCPI16_0]
237 ; GPR-NEXT: stp q0, q0, [x0]
238 ; GPR-NEXT: stp q0, q0, [x0, #32]
241 ; NEON-LABEL: bzero_64:
243 ; NEON-NEXT: movi v0.2d, #0000000000000000
244 ; NEON-NEXT: stp q0, q0, [x0]
245 ; NEON-NEXT: stp q0, q0, [x0, #32]
247 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 0, i64 64, i1 0)
251 ; /////////////////////////////////////////////////////////////////////////////
253 define void @aligned_bzero_16(ptr %a) nounwind {
254 ; ALL-LABEL: aligned_bzero_16:
256 ; ALL-NEXT: stp xzr, xzr, [x0]
258 tail call void @llvm.memset.inline.p0.i64(ptr align 16 %a, i8 0, i64 16, i1 0)
262 define void @aligned_bzero_32(ptr %a) nounwind {
263 ; GPR-LABEL: aligned_bzero_32:
265 ; GPR-NEXT: adrp x8, .LCPI18_0
266 ; GPR-NEXT: ldr q0, [x8, :lo12:.LCPI18_0]
267 ; GPR-NEXT: stp q0, q0, [x0]
270 ; NEON-LABEL: aligned_bzero_32:
272 ; NEON-NEXT: movi v0.2d, #0000000000000000
273 ; NEON-NEXT: stp q0, q0, [x0]
275 tail call void @llvm.memset.inline.p0.i64(ptr align 32 %a, i8 0, i64 32, i1 0)
279 define void @aligned_bzero_64(ptr %a) nounwind {
280 ; GPR-LABEL: aligned_bzero_64:
282 ; GPR-NEXT: adrp x8, .LCPI19_0
283 ; GPR-NEXT: ldr q0, [x8, :lo12:.LCPI19_0]
284 ; GPR-NEXT: stp q0, q0, [x0]
285 ; GPR-NEXT: stp q0, q0, [x0, #32]
288 ; NEON-LABEL: aligned_bzero_64:
290 ; NEON-NEXT: movi v0.2d, #0000000000000000
291 ; NEON-NEXT: stp q0, q0, [x0]
292 ; NEON-NEXT: stp q0, q0, [x0, #32]
294 tail call void @llvm.memset.inline.p0.i64(ptr align 64 %a, i8 0, i64 64, i1 0)