1 ; Test memsets that clear all bits. 2 ; 3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 5 declare void @llvm.memset.p0i8.i32(i8 *nocapture, i8, i32, i32, i1) nounwind 6 declare void @llvm.memset.p0i8.i64(i8 *nocapture, i8, i64, i32, i1) nounwind 7 8 ; No bytes, i32 version. 9 define 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 0, i32 0, i32 1, i1 false) 14 ret void 15 } 16 17 ; No bytes, i64 version. 18 define 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 0, i64 0, i32 1, i1 false) 23 ret void 24 } 25 26 ; 1 byte, i32 version. 27 define void @f3(i8 *%dest) { 28 ; CHECK-LABEL: f3: 29 ; CHECK: mvi 0(%r2), 0 30 ; CHECK: br %r14 31 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 1, i32 1, i1 false) 32 ret void 33 } 34 35 ; 1 byte, i64 version. 36 define void @f4(i8 *%dest) { 37 ; CHECK-LABEL: f4: 38 ; CHECK: mvi 0(%r2), 0 39 ; CHECK: br %r14 40 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 1, i32 1, i1 false) 41 ret void 42 } 43 44 ; 2 bytes, i32 version. 45 define void @f5(i8 *%dest) { 46 ; CHECK-LABEL: f5: 47 ; CHECK: mvhhi 0(%r2), 0 48 ; CHECK: br %r14 49 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 2, i32 1, i1 false) 50 ret void 51 } 52 53 ; 2 bytes, i64 version. 54 define void @f6(i8 *%dest) { 55 ; CHECK-LABEL: f6: 56 ; CHECK: mvhhi 0(%r2), 0 57 ; CHECK: br %r14 58 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 2, i32 1, i1 false) 59 ret void 60 } 61 62 ; 3 bytes, i32 version. 63 define void @f7(i8 *%dest) { 64 ; CHECK-LABEL: f7: 65 ; CHECK-DAG: mvhhi 0(%r2), 0 66 ; CHECK-DAG: mvi 2(%r2), 0 67 ; CHECK: br %r14 68 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 3, i32 1, i1 false) 69 ret void 70 } 71 72 ; 3 bytes, i64 version. 73 define void @f8(i8 *%dest) { 74 ; CHECK-LABEL: f8: 75 ; CHECK-DAG: mvhhi 0(%r2), 0 76 ; CHECK-DAG: mvi 2(%r2), 0 77 ; CHECK: br %r14 78 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 3, i32 1, i1 false) 79 ret void 80 } 81 82 ; 4 bytes, i32 version. 83 define void @f9(i8 *%dest) { 84 ; CHECK-LABEL: f9: 85 ; CHECK: mvhi 0(%r2), 0 86 ; CHECK: br %r14 87 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 4, i32 1, i1 false) 88 ret void 89 } 90 91 ; 4 bytes, i64 version. 92 define void @f10(i8 *%dest) { 93 ; CHECK-LABEL: f10: 94 ; CHECK: mvhi 0(%r2), 0 95 ; CHECK: br %r14 96 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 4, i32 1, i1 false) 97 ret void 98 } 99 100 ; 5 bytes, i32 version. 101 define void @f11(i8 *%dest) { 102 ; CHECK-LABEL: f11: 103 ; CHECK-DAG: mvhi 0(%r2), 0 104 ; CHECK-DAG: mvi 4(%r2), 0 105 ; CHECK: br %r14 106 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 5, i32 1, i1 false) 107 ret void 108 } 109 110 ; 5 bytes, i64 version. 111 define void @f12(i8 *%dest) { 112 ; CHECK-LABEL: f12: 113 ; CHECK-DAG: mvhi 0(%r2), 0 114 ; CHECK-DAG: mvi 4(%r2), 0 115 ; CHECK: br %r14 116 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 5, i32 1, i1 false) 117 ret void 118 } 119 120 ; 6 bytes, i32 version. 121 define void @f13(i8 *%dest) { 122 ; CHECK-LABEL: f13: 123 ; CHECK-DAG: mvhi 0(%r2), 0 124 ; CHECK-DAG: mvhhi 4(%r2), 0 125 ; CHECK: br %r14 126 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 6, i32 1, i1 false) 127 ret void 128 } 129 130 ; 6 bytes, i64 version. 131 define void @f14(i8 *%dest) { 132 ; CHECK-LABEL: f14: 133 ; CHECK-DAG: mvhi 0(%r2), 0 134 ; CHECK-DAG: mvhhi 4(%r2), 0 135 ; CHECK: br %r14 136 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 6, i32 1, i1 false) 137 ret void 138 } 139 140 ; 7 bytes, i32 version. 141 define void @f15(i8 *%dest) { 142 ; CHECK-LABEL: f15: 143 ; CHECK: xc 0(7,%r2), 0(%r2) 144 ; CHECK: br %r14 145 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 7, i32 1, i1 false) 146 ret void 147 } 148 149 ; 7 bytes, i64 version. 150 define void @f16(i8 *%dest) { 151 ; CHECK-LABEL: f16: 152 ; CHECK: xc 0(7,%r2), 0(%r2) 153 ; CHECK: br %r14 154 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 7, i32 1, i1 false) 155 ret void 156 } 157 158 ; 8 bytes, i32 version. 159 define void @f17(i8 *%dest) { 160 ; CHECK-LABEL: f17: 161 ; CHECK: mvghi 0(%r2), 0 162 ; CHECK: br %r14 163 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 8, i32 1, i1 false) 164 ret void 165 } 166 167 ; 8 bytes, i64 version. 168 define void @f18(i8 *%dest) { 169 ; CHECK-LABEL: f18: 170 ; CHECK: mvghi 0(%r2), 0 171 ; CHECK: br %r14 172 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 8, i32 1, i1 false) 173 ret void 174 } 175 176 ; 9 bytes, i32 version. 177 define void @f19(i8 *%dest) { 178 ; CHECK-LABEL: f19: 179 ; CHECK-DAG: mvghi 0(%r2), 0 180 ; CHECK-DAG: mvi 8(%r2), 0 181 ; CHECK: br %r14 182 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 9, i32 1, i1 false) 183 ret void 184 } 185 186 ; 9 bytes, i64 version. 187 define void @f20(i8 *%dest) { 188 ; CHECK-LABEL: f20: 189 ; CHECK-DAG: mvghi 0(%r2), 0 190 ; CHECK-DAG: mvi 8(%r2), 0 191 ; CHECK: br %r14 192 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 9, i32 1, i1 false) 193 ret void 194 } 195 196 ; 10 bytes, i32 version. 197 define void @f21(i8 *%dest) { 198 ; CHECK-LABEL: f21: 199 ; CHECK-DAG: mvghi 0(%r2), 0 200 ; CHECK-DAG: mvhhi 8(%r2), 0 201 ; CHECK: br %r14 202 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 10, i32 1, i1 false) 203 ret void 204 } 205 206 ; 10 bytes, i64 version. 207 define void @f22(i8 *%dest) { 208 ; CHECK-LABEL: f22: 209 ; CHECK-DAG: mvghi 0(%r2), 0 210 ; CHECK-DAG: mvhhi 8(%r2), 0 211 ; CHECK: br %r14 212 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 10, i32 1, i1 false) 213 ret void 214 } 215 216 ; 11 bytes, i32 version. 217 define void @f23(i8 *%dest) { 218 ; CHECK-LABEL: f23: 219 ; CHECK: xc 0(11,%r2), 0(%r2) 220 ; CHECK: br %r14 221 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 11, i32 1, i1 false) 222 ret void 223 } 224 225 ; 11 bytes, i64 version. 226 define void @f24(i8 *%dest) { 227 ; CHECK-LABEL: f24: 228 ; CHECK: xc 0(11,%r2), 0(%r2) 229 ; CHECK: br %r14 230 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 11, i32 1, i1 false) 231 ret void 232 } 233 234 ; 12 bytes, i32 version. 235 define void @f25(i8 *%dest) { 236 ; CHECK-LABEL: f25: 237 ; CHECK-DAG: mvghi 0(%r2), 0 238 ; CHECK-DAG: mvhi 8(%r2), 0 239 ; CHECK: br %r14 240 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 12, i32 1, i1 false) 241 ret void 242 } 243 244 ; 12 bytes, i64 version. 245 define void @f26(i8 *%dest) { 246 ; CHECK-LABEL: f26: 247 ; CHECK-DAG: mvghi 0(%r2), 0 248 ; CHECK-DAG: mvhi 8(%r2), 0 249 ; CHECK: br %r14 250 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 12, i32 1, i1 false) 251 ret void 252 } 253 254 ; 13 bytes, i32 version. 255 define void @f27(i8 *%dest) { 256 ; CHECK-LABEL: f27: 257 ; CHECK: xc 0(13,%r2), 0(%r2) 258 ; CHECK: br %r14 259 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 13, i32 1, i1 false) 260 ret void 261 } 262 263 ; 13 bytes, i64 version. 264 define void @f28(i8 *%dest) { 265 ; CHECK-LABEL: f28: 266 ; CHECK: xc 0(13,%r2), 0(%r2) 267 ; CHECK: br %r14 268 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 13, i32 1, i1 false) 269 ret void 270 } 271 272 ; 14 bytes, i32 version. 273 define void @f29(i8 *%dest) { 274 ; CHECK-LABEL: f29: 275 ; CHECK: xc 0(14,%r2), 0(%r2) 276 ; CHECK: br %r14 277 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 14, i32 1, i1 false) 278 ret void 279 } 280 281 ; 14 bytes, i64 version. 282 define void @f30(i8 *%dest) { 283 ; CHECK-LABEL: f30: 284 ; CHECK: xc 0(14,%r2), 0(%r2) 285 ; CHECK: br %r14 286 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 14, i32 1, i1 false) 287 ret void 288 } 289 290 ; 15 bytes, i32 version. 291 define void @f31(i8 *%dest) { 292 ; CHECK-LABEL: f31: 293 ; CHECK: xc 0(15,%r2), 0(%r2) 294 ; CHECK: br %r14 295 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 15, i32 1, i1 false) 296 ret void 297 } 298 299 ; 15 bytes, i64 version. 300 define void @f32(i8 *%dest) { 301 ; CHECK-LABEL: f32: 302 ; CHECK: xc 0(15,%r2), 0(%r2) 303 ; CHECK: br %r14 304 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 15, i32 1, i1 false) 305 ret void 306 } 307 308 ; 16 bytes, i32 version. 309 define void @f33(i8 *%dest) { 310 ; CHECK-LABEL: f33: 311 ; CHECK-DAG: mvghi 0(%r2), 0 312 ; CHECK-DAG: mvghi 8(%r2), 0 313 ; CHECK: br %r14 314 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 16, i32 1, i1 false) 315 ret void 316 } 317 318 ; 16 bytes, i64 version. 319 define void @f34(i8 *%dest) { 320 ; CHECK-LABEL: f34: 321 ; CHECK-DAG: mvghi 0(%r2), 0 322 ; CHECK-DAG: mvghi 8(%r2), 0 323 ; CHECK: br %r14 324 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 16, i32 1, i1 false) 325 ret void 326 } 327 328 ; 17 bytes, i32 version. 329 define void @f35(i8 *%dest) { 330 ; CHECK-LABEL: f35: 331 ; CHECK: xc 0(17,%r2), 0(%r2) 332 ; CHECK: br %r14 333 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 17, i32 1, i1 false) 334 ret void 335 } 336 337 ; 17 bytes, i64 version. 338 define void @f36(i8 *%dest) { 339 ; CHECK-LABEL: f36: 340 ; CHECK: xc 0(17,%r2), 0(%r2) 341 ; CHECK: br %r14 342 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 17, i32 1, i1 false) 343 ret void 344 } 345 346 ; 256 bytes, i32 version. 347 define void @f37(i8 *%dest) { 348 ; CHECK-LABEL: f37: 349 ; CHECK: xc 0(256,%r2), 0(%r2) 350 ; CHECK: br %r14 351 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 256, i32 1, i1 false) 352 ret void 353 } 354 355 ; 256 bytes, i64 version. 356 define void @f38(i8 *%dest) { 357 ; CHECK-LABEL: f38: 358 ; CHECK: xc 0(256,%r2), 0(%r2) 359 ; CHECK: br %r14 360 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 256, i32 1, i1 false) 361 ret void 362 } 363 364 ; 257 bytes, i32 version. We need two MVCs. 365 define void @f39(i8 *%dest) { 366 ; CHECK-LABEL: f39: 367 ; CHECK: xc 0(256,%r2), 0(%r2) 368 ; CHECK: xc 256(1,%r2), 256(%r2) 369 ; CHECK: br %r14 370 call void @llvm.memset.p0i8.i32(i8 *%dest, i8 0, i32 257, i32 1, i1 false) 371 ret void 372 } 373 374 ; 257 bytes, i64 version. 375 define void @f40(i8 *%dest) { 376 ; CHECK-LABEL: f40: 377 ; CHECK: xc 0(256,%r2), 0(%r2) 378 ; CHECK: xc 256(1,%r2), 256(%r2) 379 ; CHECK: br %r14 380 call void @llvm.memset.p0i8.i64(i8 *%dest, i8 0, i64 257, i32 1, i1 false) 381 ret void 382 } 383