• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test memset in cases where the set value is a constant other than 0 and -1.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5declare void @llvm.memset.p0i8.i32(i8 *nocapture, i8, i32, i1) nounwind
6declare void @llvm.memset.p0i8.i64(i8 *nocapture, i8, i64, i1) nounwind
7
8; No bytes, i32 version.
9define void @f1(i8* %dest) {
10; CHECK-LABEL: f1:
11; CHECK-NOT: %r2
12; CHECK: br %r14
13  call void @llvm.memset.p0i8.i32(i8* %dest, i8 128, i32 0, i1 false)
14  ret void
15}
16
17; No bytes, i64 version.
18define void @f2(i8* %dest) {
19; CHECK-LABEL: f2:
20; CHECK-NOT: %r2
21; CHECK: br %r14
22  call void @llvm.memset.p0i8.i64(i8* %dest, i8 128, i64 0, i1 false)
23  ret void
24}
25
26; 1 byte, i32 version.
27define void @f3(i8* %dest) {
28; CHECK-LABEL: f3:
29; CHECK: mvi 0(%r2), 128
30; CHECK: br %r14
31  call void @llvm.memset.p0i8.i32(i8* %dest, i8 128, i32 1, i1 false)
32  ret void
33}
34
35; 1 byte, i64 version.
36define void @f4(i8* %dest) {
37; CHECK-LABEL: f4:
38; CHECK: mvi 0(%r2), 128
39; CHECK: br %r14
40  call void @llvm.memset.p0i8.i64(i8* %dest, i8 128, i64 1, i1 false)
41  ret void
42}
43
44; 2 bytes, i32 version.
45define void @f5(i8* %dest) {
46; CHECK-LABEL: f5:
47; CHECK: mvhhi 0(%r2), -32640
48; CHECK: br %r14
49  call void @llvm.memset.p0i8.i32(i8* %dest, i8 128, i32 2, i1 false)
50  ret void
51}
52
53; 2 bytes, i64 version.
54define void @f6(i8* %dest) {
55; CHECK-LABEL: f6:
56; CHECK: mvhhi 0(%r2), -32640
57; CHECK: br %r14
58  call void @llvm.memset.p0i8.i64(i8* %dest, i8 128, i64 2, i1 false)
59  ret void
60}
61
62; 3 bytes, i32 version.
63define void @f7(i8* %dest) {
64; CHECK-LABEL: f7:
65; CHECK-DAG: mvhhi 0(%r2), -32640
66; CHECK-DAG: mvi 2(%r2), 128
67; CHECK: br %r14
68  call void @llvm.memset.p0i8.i32(i8* %dest, i8 128, i32 3, i1 false)
69  ret void
70}
71
72; 3 bytes, i64 version.
73define void @f8(i8* %dest) {
74; CHECK-LABEL: f8:
75; CHECK-DAG: mvhhi 0(%r2), -32640
76; CHECK-DAG: mvi 2(%r2), 128
77; CHECK: br %r14
78  call void @llvm.memset.p0i8.i64(i8* %dest, i8 128, i64 3, i1 false)
79  ret void
80}
81
82; 4 bytes, i32 version.
83define void @f9(i8* %dest) {
84; CHECK-LABEL: f9:
85; CHECK: iilf [[REG:%r[0-5]]], 2155905152
86; CHECK: st [[REG]], 0(%r2)
87; CHECK: br %r14
88  call void @llvm.memset.p0i8.i32(i8* %dest, i8 128, i32 4, i1 false)
89  ret void
90}
91
92; 4 bytes, i64 version.
93define void @f10(i8* %dest) {
94; CHECK-LABEL: f10:
95; CHECK: iilf [[REG:%r[0-5]]], 2155905152
96; CHECK: st [[REG]], 0(%r2)
97; CHECK: br %r14
98  call void @llvm.memset.p0i8.i64(i8* %dest, i8 128, i64 4, i1 false)
99  ret void
100}
101
102; 5 bytes, i32 version.
103define void @f11(i8* %dest) {
104; CHECK-LABEL: f11:
105; CHECK: mvi 0(%r2), 128
106; CHECK: mvc 1(4,%r2), 0(%r2)
107; CHECK: br %r14
108  call void @llvm.memset.p0i8.i32(i8* %dest, i8 128, i32 5, i1 false)
109  ret void
110}
111
112; 5 bytes, i64 version.
113define void @f12(i8* %dest) {
114; CHECK-LABEL: f12:
115; CHECK: mvi 0(%r2), 128
116; CHECK: mvc 1(4,%r2), 0(%r2)
117; CHECK: br %r14
118  call void @llvm.memset.p0i8.i64(i8* %dest, i8 128, i64 5, i1 false)
119  ret void
120}
121
122; 257 bytes, i32 version.
123define void @f13(i8* %dest) {
124; CHECK-LABEL: f13:
125; CHECK: mvi 0(%r2), 128
126; CHECK: mvc 1(256,%r2), 0(%r2)
127; CHECK: br %r14
128  call void @llvm.memset.p0i8.i32(i8* %dest, i8 128, i32 257, i1 false)
129  ret void
130}
131
132; 257 bytes, i64 version.
133define void @f14(i8* %dest) {
134; CHECK-LABEL: f14:
135; CHECK: mvi 0(%r2), 128
136; CHECK: mvc 1(256,%r2), 0(%r2)
137; CHECK: br %r14
138  call void @llvm.memset.p0i8.i64(i8* %dest, i8 128, i64 257, i1 false)
139  ret void
140}
141
142; 258 bytes, i32 version.  We need two MVCs.
143define void @f15(i8* %dest) {
144; CHECK-LABEL: f15:
145; CHECK: mvi 0(%r2), 128
146; CHECK: mvc 1(256,%r2), 0(%r2)
147; CHECK: mvc 257(1,%r2), 256(%r2)
148; CHECK: br %r14
149  call void @llvm.memset.p0i8.i32(i8* %dest, i8 128, i32 258, i1 false)
150  ret void
151}
152
153; 258 bytes, i64 version.
154define void @f16(i8* %dest) {
155; CHECK-LABEL: f16:
156; CHECK: mvi 0(%r2), 128
157; CHECK: mvc 1(256,%r2), 0(%r2)
158; CHECK: mvc 257(1,%r2), 256(%r2)
159; CHECK: br %r14
160  call void @llvm.memset.p0i8.i64(i8* %dest, i8 128, i64 258, i1 false)
161  ret void
162}
163