1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
3 ; RUN: llc %s -o - -mtriple=aarch64 -O0 -global-isel=1 -global-isel-abort=1 -mattr=+mops,+mte | FileCheck %s --check-prefix=GISel-O0
4 ; RUN: llc %s -o - -mtriple=aarch64 -global-isel=1 -global-isel-abort=1 -mattr=+mops,+mte | FileCheck %s --check-prefix=GISel
5 ; RUN: llc %s -o - -mtriple=aarch64 -O2 -mattr=+mops,+mte | FileCheck %s --check-prefix=SDAG
7 declare ptr @llvm.aarch64.mops.memset.tag(ptr, i8, i64)
9 define ptr @memset_tagged_0_zeroval(ptr %dst, i64 %size) {
10 ; GISel-O0-LABEL: memset_tagged_0_zeroval:
11 ; GISel-O0: // %bb.0: // %entry
12 ; GISel-O0-NEXT: mov x8, xzr
13 ; GISel-O0-NEXT: setgp [x0]!, x8!, x8
14 ; GISel-O0-NEXT: setgm [x0]!, x8!, x8
15 ; GISel-O0-NEXT: setge [x0]!, x8!, x8
18 ; GISel-LABEL: memset_tagged_0_zeroval:
19 ; GISel: // %bb.0: // %entry
20 ; GISel-NEXT: mov x8, xzr
21 ; GISel-NEXT: setgp [x0]!, x8!, xzr
22 ; GISel-NEXT: setgm [x0]!, x8!, xzr
23 ; GISel-NEXT: setge [x0]!, x8!, xzr
26 ; SDAG-LABEL: memset_tagged_0_zeroval:
27 ; SDAG: // %bb.0: // %entry
28 ; SDAG-NEXT: mov x8, xzr
29 ; SDAG-NEXT: setgp [x0]!, x8!, xzr
30 ; SDAG-NEXT: setgm [x0]!, x8!, xzr
31 ; SDAG-NEXT: setge [x0]!, x8!, xzr
34 %r = tail call ptr @llvm.aarch64.mops.memset.tag(ptr %dst, i8 0, i64 0)
38 define ptr @memset_tagged_1_zeroval(ptr %dst, i64 %size) {
39 ; GISel-O0-LABEL: memset_tagged_1_zeroval:
40 ; GISel-O0: // %bb.0: // %entry
41 ; GISel-O0-NEXT: mov w8, #1
42 ; GISel-O0-NEXT: // kill: def $x8 killed $w8
43 ; GISel-O0-NEXT: mov x9, xzr
44 ; GISel-O0-NEXT: setgp [x0]!, x8!, x9
45 ; GISel-O0-NEXT: setgm [x0]!, x8!, x9
46 ; GISel-O0-NEXT: setge [x0]!, x8!, x9
49 ; GISel-LABEL: memset_tagged_1_zeroval:
50 ; GISel: // %bb.0: // %entry
51 ; GISel-NEXT: mov w8, #1
52 ; GISel-NEXT: setgp [x0]!, x8!, xzr
53 ; GISel-NEXT: setgm [x0]!, x8!, xzr
54 ; GISel-NEXT: setge [x0]!, x8!, xzr
57 ; SDAG-LABEL: memset_tagged_1_zeroval:
58 ; SDAG: // %bb.0: // %entry
59 ; SDAG-NEXT: mov w8, #1
60 ; SDAG-NEXT: setgp [x0]!, x8!, xzr
61 ; SDAG-NEXT: setgm [x0]!, x8!, xzr
62 ; SDAG-NEXT: setge [x0]!, x8!, xzr
65 %r = tail call ptr @llvm.aarch64.mops.memset.tag(ptr %dst, i8 0, i64 1)
69 define ptr @memset_tagged_10_zeroval(ptr %dst, i64 %size) {
70 ; GISel-O0-LABEL: memset_tagged_10_zeroval:
71 ; GISel-O0: // %bb.0: // %entry
72 ; GISel-O0-NEXT: mov w8, #10
73 ; GISel-O0-NEXT: // kill: def $x8 killed $w8
74 ; GISel-O0-NEXT: mov x9, xzr
75 ; GISel-O0-NEXT: setgp [x0]!, x8!, x9
76 ; GISel-O0-NEXT: setgm [x0]!, x8!, x9
77 ; GISel-O0-NEXT: setge [x0]!, x8!, x9
80 ; GISel-LABEL: memset_tagged_10_zeroval:
81 ; GISel: // %bb.0: // %entry
82 ; GISel-NEXT: mov w8, #10
83 ; GISel-NEXT: setgp [x0]!, x8!, xzr
84 ; GISel-NEXT: setgm [x0]!, x8!, xzr
85 ; GISel-NEXT: setge [x0]!, x8!, xzr
88 ; SDAG-LABEL: memset_tagged_10_zeroval:
89 ; SDAG: // %bb.0: // %entry
90 ; SDAG-NEXT: mov w8, #10
91 ; SDAG-NEXT: setgp [x0]!, x8!, xzr
92 ; SDAG-NEXT: setgm [x0]!, x8!, xzr
93 ; SDAG-NEXT: setge [x0]!, x8!, xzr
96 %r = tail call ptr @llvm.aarch64.mops.memset.tag(ptr %dst, i8 0, i64 10)
100 define ptr @memset_tagged_10000_zeroval(ptr %dst, i64 %size) {
101 ; GISel-O0-LABEL: memset_tagged_10000_zeroval:
102 ; GISel-O0: // %bb.0: // %entry
103 ; GISel-O0-NEXT: mov w8, #10000
104 ; GISel-O0-NEXT: // kill: def $x8 killed $w8
105 ; GISel-O0-NEXT: mov x9, xzr
106 ; GISel-O0-NEXT: setgp [x0]!, x8!, x9
107 ; GISel-O0-NEXT: setgm [x0]!, x8!, x9
108 ; GISel-O0-NEXT: setge [x0]!, x8!, x9
111 ; GISel-LABEL: memset_tagged_10000_zeroval:
112 ; GISel: // %bb.0: // %entry
113 ; GISel-NEXT: mov w8, #10000
114 ; GISel-NEXT: setgp [x0]!, x8!, xzr
115 ; GISel-NEXT: setgm [x0]!, x8!, xzr
116 ; GISel-NEXT: setge [x0]!, x8!, xzr
119 ; SDAG-LABEL: memset_tagged_10000_zeroval:
120 ; SDAG: // %bb.0: // %entry
121 ; SDAG-NEXT: mov w8, #10000
122 ; SDAG-NEXT: setgp [x0]!, x8!, xzr
123 ; SDAG-NEXT: setgm [x0]!, x8!, xzr
124 ; SDAG-NEXT: setge [x0]!, x8!, xzr
127 %r = tail call ptr @llvm.aarch64.mops.memset.tag(ptr %dst, i8 0, i64 10000)
131 define ptr @memset_tagged_size_zeroval(ptr %dst, i64 %size) {
132 ; GISel-O0-LABEL: memset_tagged_size_zeroval:
133 ; GISel-O0: // %bb.0: // %entry
134 ; GISel-O0-NEXT: mov x8, xzr
135 ; GISel-O0-NEXT: setgp [x0]!, x1!, x8
136 ; GISel-O0-NEXT: setgm [x0]!, x1!, x8
137 ; GISel-O0-NEXT: setge [x0]!, x1!, x8
140 ; GISel-LABEL: memset_tagged_size_zeroval:
141 ; GISel: // %bb.0: // %entry
142 ; GISel-NEXT: setgp [x0]!, x1!, xzr
143 ; GISel-NEXT: setgm [x0]!, x1!, xzr
144 ; GISel-NEXT: setge [x0]!, x1!, xzr
147 ; SDAG-LABEL: memset_tagged_size_zeroval:
148 ; SDAG: // %bb.0: // %entry
149 ; SDAG-NEXT: setgp [x0]!, x1!, xzr
150 ; SDAG-NEXT: setgm [x0]!, x1!, xzr
151 ; SDAG-NEXT: setge [x0]!, x1!, xzr
154 %r = tail call ptr @llvm.aarch64.mops.memset.tag(ptr %dst, i8 0, i64 %size)
158 define ptr @memset_tagged_0(ptr %dst, i64 %size, i32 %value) {
159 ; GISel-O0-LABEL: memset_tagged_0:
160 ; GISel-O0: // %bb.0: // %entry
161 ; GISel-O0-NEXT: mov x8, xzr
162 ; GISel-O0-NEXT: // implicit-def: $x9
163 ; GISel-O0-NEXT: mov w9, w2
164 ; GISel-O0-NEXT: setgp [x0]!, x8!, x9
165 ; GISel-O0-NEXT: setgm [x0]!, x8!, x9
166 ; GISel-O0-NEXT: setge [x0]!, x8!, x9
169 ; GISel-LABEL: memset_tagged_0:
170 ; GISel: // %bb.0: // %entry
171 ; GISel-NEXT: mov x8, xzr
172 ; GISel-NEXT: // kill: def $w2 killed $w2 def $x2
173 ; GISel-NEXT: setgp [x0]!, x8!, x2
174 ; GISel-NEXT: setgm [x0]!, x8!, x2
175 ; GISel-NEXT: setge [x0]!, x8!, x2
178 ; SDAG-LABEL: memset_tagged_0:
179 ; SDAG: // %bb.0: // %entry
180 ; SDAG-NEXT: mov x8, xzr
181 ; SDAG-NEXT: // kill: def $w2 killed $w2 def $x2
182 ; SDAG-NEXT: setgp [x0]!, x8!, x2
183 ; SDAG-NEXT: setgm [x0]!, x8!, x2
184 ; SDAG-NEXT: setge [x0]!, x8!, x2
187 %value_trunc = trunc i32 %value to i8
188 %r = tail call ptr @llvm.aarch64.mops.memset.tag(ptr %dst, i8 %value_trunc, i64 0)
192 define ptr @memset_tagged_1(ptr %dst, i64 %size, i32 %value) {
193 ; GISel-O0-LABEL: memset_tagged_1:
194 ; GISel-O0: // %bb.0: // %entry
195 ; GISel-O0-NEXT: mov w8, #1
196 ; GISel-O0-NEXT: // kill: def $x8 killed $w8
197 ; GISel-O0-NEXT: // implicit-def: $x9
198 ; GISel-O0-NEXT: mov w9, w2
199 ; GISel-O0-NEXT: setgp [x0]!, x8!, x9
200 ; GISel-O0-NEXT: setgm [x0]!, x8!, x9
201 ; GISel-O0-NEXT: setge [x0]!, x8!, x9
204 ; GISel-LABEL: memset_tagged_1:
205 ; GISel: // %bb.0: // %entry
206 ; GISel-NEXT: mov w8, #1
207 ; GISel-NEXT: // kill: def $w2 killed $w2 def $x2
208 ; GISel-NEXT: setgp [x0]!, x8!, x2
209 ; GISel-NEXT: setgm [x0]!, x8!, x2
210 ; GISel-NEXT: setge [x0]!, x8!, x2
213 ; SDAG-LABEL: memset_tagged_1:
214 ; SDAG: // %bb.0: // %entry
215 ; SDAG-NEXT: mov w8, #1
216 ; SDAG-NEXT: // kill: def $w2 killed $w2 def $x2
217 ; SDAG-NEXT: setgp [x0]!, x8!, x2
218 ; SDAG-NEXT: setgm [x0]!, x8!, x2
219 ; SDAG-NEXT: setge [x0]!, x8!, x2
222 %value_trunc = trunc i32 %value to i8
223 %r = tail call ptr @llvm.aarch64.mops.memset.tag(ptr %dst, i8 %value_trunc, i64 1)
227 define ptr @memset_tagged_10(ptr %dst, i64 %size, i32 %value) {
228 ; GISel-O0-LABEL: memset_tagged_10:
229 ; GISel-O0: // %bb.0: // %entry
230 ; GISel-O0-NEXT: mov w8, #10
231 ; GISel-O0-NEXT: // kill: def $x8 killed $w8
232 ; GISel-O0-NEXT: // implicit-def: $x9
233 ; GISel-O0-NEXT: mov w9, w2
234 ; GISel-O0-NEXT: setgp [x0]!, x8!, x9
235 ; GISel-O0-NEXT: setgm [x0]!, x8!, x9
236 ; GISel-O0-NEXT: setge [x0]!, x8!, x9
239 ; GISel-LABEL: memset_tagged_10:
240 ; GISel: // %bb.0: // %entry
241 ; GISel-NEXT: mov w8, #10
242 ; GISel-NEXT: // kill: def $w2 killed $w2 def $x2
243 ; GISel-NEXT: setgp [x0]!, x8!, x2
244 ; GISel-NEXT: setgm [x0]!, x8!, x2
245 ; GISel-NEXT: setge [x0]!, x8!, x2
248 ; SDAG-LABEL: memset_tagged_10:
249 ; SDAG: // %bb.0: // %entry
250 ; SDAG-NEXT: mov w8, #10
251 ; SDAG-NEXT: // kill: def $w2 killed $w2 def $x2
252 ; SDAG-NEXT: setgp [x0]!, x8!, x2
253 ; SDAG-NEXT: setgm [x0]!, x8!, x2
254 ; SDAG-NEXT: setge [x0]!, x8!, x2
257 %value_trunc = trunc i32 %value to i8
258 %r = tail call ptr @llvm.aarch64.mops.memset.tag(ptr %dst, i8 %value_trunc, i64 10)
262 define ptr @memset_tagged_10000(ptr %dst, i64 %size, i32 %value) {
263 ; GISel-O0-LABEL: memset_tagged_10000:
264 ; GISel-O0: // %bb.0: // %entry
265 ; GISel-O0-NEXT: mov w8, #10000
266 ; GISel-O0-NEXT: // kill: def $x8 killed $w8
267 ; GISel-O0-NEXT: // implicit-def: $x9
268 ; GISel-O0-NEXT: mov w9, w2
269 ; GISel-O0-NEXT: setgp [x0]!, x8!, x9
270 ; GISel-O0-NEXT: setgm [x0]!, x8!, x9
271 ; GISel-O0-NEXT: setge [x0]!, x8!, x9
274 ; GISel-LABEL: memset_tagged_10000:
275 ; GISel: // %bb.0: // %entry
276 ; GISel-NEXT: mov w8, #10000
277 ; GISel-NEXT: // kill: def $w2 killed $w2 def $x2
278 ; GISel-NEXT: setgp [x0]!, x8!, x2
279 ; GISel-NEXT: setgm [x0]!, x8!, x2
280 ; GISel-NEXT: setge [x0]!, x8!, x2
283 ; SDAG-LABEL: memset_tagged_10000:
284 ; SDAG: // %bb.0: // %entry
285 ; SDAG-NEXT: mov w8, #10000
286 ; SDAG-NEXT: // kill: def $w2 killed $w2 def $x2
287 ; SDAG-NEXT: setgp [x0]!, x8!, x2
288 ; SDAG-NEXT: setgm [x0]!, x8!, x2
289 ; SDAG-NEXT: setge [x0]!, x8!, x2
292 %value_trunc = trunc i32 %value to i8
293 %r = tail call ptr @llvm.aarch64.mops.memset.tag(ptr %dst, i8 %value_trunc, i64 10000)
297 define ptr @memset_tagged_size(ptr %dst, i64 %size, i32 %value) {
298 ; GISel-O0-LABEL: memset_tagged_size:
299 ; GISel-O0: // %bb.0: // %entry
300 ; GISel-O0-NEXT: // implicit-def: $x8
301 ; GISel-O0-NEXT: mov w8, w2
302 ; GISel-O0-NEXT: setgp [x0]!, x1!, x8
303 ; GISel-O0-NEXT: setgm [x0]!, x1!, x8
304 ; GISel-O0-NEXT: setge [x0]!, x1!, x8
307 ; GISel-LABEL: memset_tagged_size:
308 ; GISel: // %bb.0: // %entry
309 ; GISel-NEXT: // kill: def $w2 killed $w2 def $x2
310 ; GISel-NEXT: setgp [x0]!, x1!, x2
311 ; GISel-NEXT: setgm [x0]!, x1!, x2
312 ; GISel-NEXT: setge [x0]!, x1!, x2
315 ; SDAG-LABEL: memset_tagged_size:
316 ; SDAG: // %bb.0: // %entry
317 ; SDAG-NEXT: // kill: def $w2 killed $w2 def $x2
318 ; SDAG-NEXT: setgp [x0]!, x1!, x2
319 ; SDAG-NEXT: setgm [x0]!, x1!, x2
320 ; SDAG-NEXT: setge [x0]!, x1!, x2
323 %value_trunc = trunc i32 %value to i8
324 %r = tail call ptr @llvm.aarch64.mops.memset.tag(ptr %dst, i8 %value_trunc, i64 %size)
328 define ptr @memset_tagged_size_aligned(ptr %dst, i64 %size, i32 %value) {
329 ; GISel-O0-LABEL: memset_tagged_size_aligned:
330 ; GISel-O0: // %bb.0: // %entry
331 ; GISel-O0-NEXT: // implicit-def: $x8
332 ; GISel-O0-NEXT: mov w8, w2
333 ; GISel-O0-NEXT: setgp [x0]!, x1!, x8
334 ; GISel-O0-NEXT: setgm [x0]!, x1!, x8
335 ; GISel-O0-NEXT: setge [x0]!, x1!, x8
338 ; GISel-LABEL: memset_tagged_size_aligned:
339 ; GISel: // %bb.0: // %entry
340 ; GISel-NEXT: // kill: def $w2 killed $w2 def $x2
341 ; GISel-NEXT: setgp [x0]!, x1!, x2
342 ; GISel-NEXT: setgm [x0]!, x1!, x2
343 ; GISel-NEXT: setge [x0]!, x1!, x2
346 ; SDAG-LABEL: memset_tagged_size_aligned:
347 ; SDAG: // %bb.0: // %entry
348 ; SDAG-NEXT: // kill: def $w2 killed $w2 def $x2
349 ; SDAG-NEXT: setgp [x0]!, x1!, x2
350 ; SDAG-NEXT: setgm [x0]!, x1!, x2
351 ; SDAG-NEXT: setge [x0]!, x1!, x2
354 %value_trunc = trunc i32 %value to i8
355 %r = tail call ptr @llvm.aarch64.mops.memset.tag(ptr align 16 %dst, i8 %value_trunc, i64 %size)