1 ; Test memsets that set all bits.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 declare void @llvm.memset.p0i8.i32(i8 *nocapture, i8, i32, i1) nounwind
6 declare void @llvm.memset.p0i8.i64(i8 *nocapture, i8, i64, i1) nounwind
8 ; No bytes, i32 version.
9 define void @f1(i8* %dest) {
13 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 0, i1 false)
17 ; No bytes, i64 version.
18 define void @f2(i8* %dest) {
22 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 0, i1 false)
26 ; 1 byte, i32 version.
27 define void @f3(i8* %dest) {
29 ; CHECK: mvi 0(%r2), 255
31 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 1, i1 false)
35 ; 1 byte, i64 version.
36 define void @f4(i8* %dest) {
38 ; CHECK: mvi 0(%r2), 255
40 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 1, i1 false)
44 ; 2 bytes, i32 version.
45 define void @f5(i8* %dest) {
47 ; CHECK: mvhhi 0(%r2), -1
49 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 2, i1 false)
53 ; 2 bytes, i64 version.
54 define void @f6(i8* %dest) {
56 ; CHECK: mvhhi 0(%r2), -1
58 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 2, i1 false)
62 ; 3 bytes, i32 version.
63 define void @f7(i8* %dest) {
65 ; CHECK-DAG: mvhhi 0(%r2), -1
66 ; CHECK-DAG: mvi 2(%r2), 255
68 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 3, i1 false)
72 ; 3 bytes, i64 version.
73 define void @f8(i8* %dest) {
75 ; CHECK-DAG: mvhhi 0(%r2), -1
76 ; CHECK-DAG: mvi 2(%r2), 255
78 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 3, i1 false)
82 ; 4 bytes, i32 version.
83 define void @f9(i8* %dest) {
85 ; CHECK: mvhi 0(%r2), -1
87 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 4, i1 false)
91 ; 4 bytes, i64 version.
92 define void @f10(i8* %dest) {
94 ; CHECK: mvhi 0(%r2), -1
96 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 4, i1 false)
100 ; 5 bytes, i32 version.
101 define void @f11(i8* %dest) {
103 ; CHECK-DAG: mvhi 0(%r2), -1
104 ; CHECK-DAG: mvi 4(%r2), 255
106 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 5, i1 false)
110 ; 5 bytes, i64 version.
111 define void @f12(i8* %dest) {
113 ; CHECK-DAG: mvhi 0(%r2), -1
114 ; CHECK-DAG: mvi 4(%r2), 255
116 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 5, i1 false)
120 ; 6 bytes, i32 version.
121 define void @f13(i8* %dest) {
123 ; CHECK-DAG: mvhi 0(%r2), -1
124 ; CHECK-DAG: mvhhi 4(%r2), -1
126 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 6, i1 false)
130 ; 6 bytes, i64 version.
131 define void @f14(i8* %dest) {
133 ; CHECK-DAG: mvhi 0(%r2), -1
134 ; CHECK-DAG: mvhhi 4(%r2), -1
136 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 6, i1 false)
140 ; 7 bytes, i32 version.
141 define void @f15(i8* %dest) {
143 ; CHECK: mvi 0(%r2), 255
144 ; CHECK: mvc 1(6,%r2), 0(%r2)
146 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 7, i1 false)
150 ; 7 bytes, i64 version.
151 define void @f16(i8* %dest) {
153 ; CHECK: mvi 0(%r2), 255
154 ; CHECK: mvc 1(6,%r2), 0(%r2)
156 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 7, i1 false)
160 ; 8 bytes, i32 version.
161 define void @f17(i8* %dest) {
163 ; CHECK: mvghi 0(%r2), -1
165 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 8, i1 false)
169 ; 8 bytes, i64 version.
170 define void @f18(i8* %dest) {
172 ; CHECK: mvghi 0(%r2), -1
174 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 8, i1 false)
178 ; 9 bytes, i32 version.
179 define void @f19(i8* %dest) {
181 ; CHECK-DAG: mvghi 0(%r2), -1
182 ; CHECK-DAG: mvi 8(%r2), 255
184 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 9, i1 false)
188 ; 9 bytes, i64 version.
189 define void @f20(i8* %dest) {
191 ; CHECK-DAG: mvghi 0(%r2), -1
192 ; CHECK-DAG: mvi 8(%r2), 255
194 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 9, i1 false)
198 ; 10 bytes, i32 version.
199 define void @f21(i8* %dest) {
201 ; CHECK-DAG: mvghi 0(%r2), -1
202 ; CHECK-DAG: mvhhi 8(%r2), -1
204 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 10, i1 false)
208 ; 10 bytes, i64 version.
209 define void @f22(i8* %dest) {
211 ; CHECK-DAG: mvghi 0(%r2), -1
212 ; CHECK-DAG: mvhhi 8(%r2), -1
214 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 10, i1 false)
218 ; 11 bytes, i32 version.
219 define void @f23(i8* %dest) {
221 ; CHECK: mvi 0(%r2), 255
222 ; CHECK: mvc 1(10,%r2), 0(%r2)
224 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 11, i1 false)
228 ; 11 bytes, i64 version.
229 define void @f24(i8* %dest) {
231 ; CHECK: mvi 0(%r2), 255
232 ; CHECK: mvc 1(10,%r2), 0(%r2)
234 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 11, i1 false)
238 ; 12 bytes, i32 version.
239 define void @f25(i8* %dest) {
241 ; CHECK-DAG: mvghi 0(%r2), -1
242 ; CHECK-DAG: mvhi 8(%r2), -1
244 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 12, i1 false)
248 ; 12 bytes, i64 version.
249 define void @f26(i8* %dest) {
251 ; CHECK-DAG: mvghi 0(%r2), -1
252 ; CHECK-DAG: mvhi 8(%r2), -1
254 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 12, i1 false)
258 ; 13 bytes, i32 version.
259 define void @f27(i8* %dest) {
261 ; CHECK: mvi 0(%r2), 255
262 ; CHECK: mvc 1(12,%r2), 0(%r2)
264 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 13, i1 false)
268 ; 13 bytes, i64 version.
269 define void @f28(i8* %dest) {
271 ; CHECK: mvi 0(%r2), 255
272 ; CHECK: mvc 1(12,%r2), 0(%r2)
274 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 13, i1 false)
278 ; 14 bytes, i32 version.
279 define void @f29(i8* %dest) {
281 ; CHECK: mvi 0(%r2), 255
282 ; CHECK: mvc 1(13,%r2), 0(%r2)
284 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 14, i1 false)
288 ; 14 bytes, i64 version.
289 define void @f30(i8* %dest) {
291 ; CHECK: mvi 0(%r2), 255
292 ; CHECK: mvc 1(13,%r2), 0(%r2)
294 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 14, i1 false)
298 ; 15 bytes, i32 version.
299 define void @f31(i8* %dest) {
301 ; CHECK: mvi 0(%r2), 255
302 ; CHECK: mvc 1(14,%r2), 0(%r2)
304 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 15, i1 false)
308 ; 15 bytes, i64 version.
309 define void @f32(i8* %dest) {
311 ; CHECK: mvi 0(%r2), 255
312 ; CHECK: mvc 1(14,%r2), 0(%r2)
314 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 15, i1 false)
318 ; 16 bytes, i32 version.
319 define void @f33(i8* %dest) {
321 ; CHECK-DAG: mvghi 0(%r2), -1
322 ; CHECK-DAG: mvghi 8(%r2), -1
324 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 16, i1 false)
328 ; 16 bytes, i64 version.
329 define void @f34(i8* %dest) {
331 ; CHECK-DAG: mvghi 0(%r2), -1
332 ; CHECK-DAG: mvghi 8(%r2), -1
334 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 16, i1 false)
338 ; 17 bytes, i32 version.
339 define void @f35(i8* %dest) {
341 ; CHECK: mvi 0(%r2), 255
342 ; CHECK: mvc 1(16,%r2), 0(%r2)
344 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 17, i1 false)
348 ; 17 bytes, i64 version.
349 define void @f36(i8* %dest) {
351 ; CHECK: mvi 0(%r2), 255
352 ; CHECK: mvc 1(16,%r2), 0(%r2)
354 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 17, i1 false)
358 ; 257 bytes, i32 version.
359 define void @f37(i8* %dest) {
361 ; CHECK: mvi 0(%r2), 255
362 ; CHECK: mvc 1(256,%r2), 0(%r2)
364 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 257, i1 false)
368 ; 257 bytes, i64 version.
369 define void @f38(i8* %dest) {
371 ; CHECK: mvi 0(%r2), 255
372 ; CHECK: mvc 1(256,%r2), 0(%r2)
374 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 257, i1 false)
378 ; 258 bytes, i32 version. We need two MVCs.
379 define void @f39(i8* %dest) {
381 ; CHECK: mvi 0(%r2), 255
382 ; CHECK: mvc 1(256,%r2), 0(%r2)
383 ; CHECK: mvc 257(1,%r2), 256(%r2)
385 call void @llvm.memset.p0i8.i32(i8* %dest, i8 -1, i32 258, i1 false)
389 ; 258 bytes, i64 version.
390 define void @f40(i8* %dest) {
392 ; CHECK: mvi 0(%r2), 255
393 ; CHECK: mvc 1(256,%r2), 0(%r2)
394 ; CHECK: mvc 257(1,%r2), 256(%r2)
396 call void @llvm.memset.p0i8.i64(i8* %dest, i8 -1, i64 258, i1 false)