1 ; Test memsets that clear 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 0, 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 0, i64 0, i1 false)
26 ; 1 byte, i32 version.
27 define void @f3(i8* %dest) {
29 ; CHECK: mvi 0(%r2), 0
31 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 1, i1 false)
35 ; 1 byte, i64 version.
36 define void @f4(i8* %dest) {
38 ; CHECK: mvi 0(%r2), 0
40 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 1, i1 false)
44 ; 2 bytes, i32 version.
45 define void @f5(i8* %dest) {
47 ; CHECK: mvhhi 0(%r2), 0
49 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 2, i1 false)
53 ; 2 bytes, i64 version.
54 define void @f6(i8* %dest) {
56 ; CHECK: mvhhi 0(%r2), 0
58 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 2, i1 false)
62 ; 3 bytes, i32 version.
63 define void @f7(i8* %dest) {
65 ; CHECK-DAG: mvhhi 0(%r2), 0
66 ; CHECK-DAG: mvi 2(%r2), 0
68 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 3, i1 false)
72 ; 3 bytes, i64 version.
73 define void @f8(i8* %dest) {
75 ; CHECK-DAG: mvhhi 0(%r2), 0
76 ; CHECK-DAG: mvi 2(%r2), 0
78 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 3, i1 false)
82 ; 4 bytes, i32 version.
83 define void @f9(i8* %dest) {
85 ; CHECK: mvhi 0(%r2), 0
87 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 4, i1 false)
91 ; 4 bytes, i64 version.
92 define void @f10(i8* %dest) {
94 ; CHECK: mvhi 0(%r2), 0
96 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 4, i1 false)
100 ; 5 bytes, i32 version.
101 define void @f11(i8* %dest) {
103 ; CHECK-DAG: mvhi 0(%r2), 0
104 ; CHECK-DAG: mvi 4(%r2), 0
106 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 5, i1 false)
110 ; 5 bytes, i64 version.
111 define void @f12(i8* %dest) {
113 ; CHECK-DAG: mvhi 0(%r2), 0
114 ; CHECK-DAG: mvi 4(%r2), 0
116 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 5, i1 false)
120 ; 6 bytes, i32 version.
121 define void @f13(i8* %dest) {
123 ; CHECK-DAG: mvhi 0(%r2), 0
124 ; CHECK-DAG: mvhhi 4(%r2), 0
126 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 6, i1 false)
130 ; 6 bytes, i64 version.
131 define void @f14(i8* %dest) {
133 ; CHECK-DAG: mvhi 0(%r2), 0
134 ; CHECK-DAG: mvhhi 4(%r2), 0
136 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 6, i1 false)
140 ; 7 bytes, i32 version.
141 define void @f15(i8* %dest) {
143 ; CHECK: xc 0(7,%r2), 0(%r2)
145 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 7, i1 false)
149 ; 7 bytes, i64 version.
150 define void @f16(i8* %dest) {
152 ; CHECK: xc 0(7,%r2), 0(%r2)
154 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 7, i1 false)
158 ; 8 bytes, i32 version.
159 define void @f17(i8* %dest) {
161 ; CHECK: mvghi 0(%r2), 0
163 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 8, i1 false)
167 ; 8 bytes, i64 version.
168 define void @f18(i8* %dest) {
170 ; CHECK: mvghi 0(%r2), 0
172 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 8, i1 false)
176 ; 9 bytes, i32 version.
177 define void @f19(i8* %dest) {
179 ; CHECK-DAG: mvghi 0(%r2), 0
180 ; CHECK-DAG: mvi 8(%r2), 0
182 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 9, i1 false)
186 ; 9 bytes, i64 version.
187 define void @f20(i8* %dest) {
189 ; CHECK-DAG: mvghi 0(%r2), 0
190 ; CHECK-DAG: mvi 8(%r2), 0
192 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 9, i1 false)
196 ; 10 bytes, i32 version.
197 define void @f21(i8* %dest) {
199 ; CHECK-DAG: mvghi 0(%r2), 0
200 ; CHECK-DAG: mvhhi 8(%r2), 0
202 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 10, i1 false)
206 ; 10 bytes, i64 version.
207 define void @f22(i8* %dest) {
209 ; CHECK-DAG: mvghi 0(%r2), 0
210 ; CHECK-DAG: mvhhi 8(%r2), 0
212 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 10, i1 false)
216 ; 11 bytes, i32 version.
217 define void @f23(i8* %dest) {
219 ; CHECK: xc 0(11,%r2), 0(%r2)
221 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 11, i1 false)
225 ; 11 bytes, i64 version.
226 define void @f24(i8* %dest) {
228 ; CHECK: xc 0(11,%r2), 0(%r2)
230 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 11, i1 false)
234 ; 12 bytes, i32 version.
235 define void @f25(i8* %dest) {
237 ; CHECK-DAG: mvghi 0(%r2), 0
238 ; CHECK-DAG: mvhi 8(%r2), 0
240 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 12, i1 false)
244 ; 12 bytes, i64 version.
245 define void @f26(i8* %dest) {
247 ; CHECK-DAG: mvghi 0(%r2), 0
248 ; CHECK-DAG: mvhi 8(%r2), 0
250 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 12, i1 false)
254 ; 13 bytes, i32 version.
255 define void @f27(i8* %dest) {
257 ; CHECK: xc 0(13,%r2), 0(%r2)
259 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 13, i1 false)
263 ; 13 bytes, i64 version.
264 define void @f28(i8* %dest) {
266 ; CHECK: xc 0(13,%r2), 0(%r2)
268 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 13, i1 false)
272 ; 14 bytes, i32 version.
273 define void @f29(i8* %dest) {
275 ; CHECK: xc 0(14,%r2), 0(%r2)
277 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 14, i1 false)
281 ; 14 bytes, i64 version.
282 define void @f30(i8* %dest) {
284 ; CHECK: xc 0(14,%r2), 0(%r2)
286 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 14, i1 false)
290 ; 15 bytes, i32 version.
291 define void @f31(i8* %dest) {
293 ; CHECK: xc 0(15,%r2), 0(%r2)
295 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 15, i1 false)
299 ; 15 bytes, i64 version.
300 define void @f32(i8* %dest) {
302 ; CHECK: xc 0(15,%r2), 0(%r2)
304 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 15, i1 false)
308 ; 16 bytes, i32 version.
309 define void @f33(i8* %dest) {
311 ; CHECK-DAG: mvghi 0(%r2), 0
312 ; CHECK-DAG: mvghi 8(%r2), 0
314 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 16, i1 false)
318 ; 16 bytes, i64 version.
319 define void @f34(i8* %dest) {
321 ; CHECK-DAG: mvghi 0(%r2), 0
322 ; CHECK-DAG: mvghi 8(%r2), 0
324 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 16, i1 false)
328 ; 17 bytes, i32 version.
329 define void @f35(i8* %dest) {
331 ; CHECK: xc 0(17,%r2), 0(%r2)
333 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 17, i1 false)
337 ; 17 bytes, i64 version.
338 define void @f36(i8* %dest) {
340 ; CHECK: xc 0(17,%r2), 0(%r2)
342 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 17, i1 false)
346 ; 256 bytes, i32 version.
347 define void @f37(i8* %dest) {
349 ; CHECK: xc 0(256,%r2), 0(%r2)
351 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 256, i1 false)
355 ; 256 bytes, i64 version.
356 define void @f38(i8* %dest) {
358 ; CHECK: xc 0(256,%r2), 0(%r2)
360 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 256, i1 false)
364 ; 257 bytes, i32 version. We need two MVCs.
365 define void @f39(i8* %dest) {
367 ; CHECK: xc 0(256,%r2), 0(%r2)
368 ; CHECK: xc 256(1,%r2), 256(%r2)
370 call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 257, i1 false)
374 ; 257 bytes, i64 version.
375 define void @f40(i8* %dest) {
377 ; CHECK: xc 0(256,%r2), 0(%r2)
378 ; CHECK: xc 256(1,%r2), 256(%r2)
380 call void @llvm.memset.p0i8.i64(i8* %dest, i8 0, i64 257, i1 false)