Home | History | Annotate | Download | only in SystemZ
      1 ; Test memsets that set 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 -1, 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 -1, 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), 255
     30 ; CHECK: br %r14
     31   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, 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), 255
     39 ; CHECK: br %r14
     40   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, 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), -1
     48 ; CHECK: br %r14
     49   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, 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), -1
     57 ; CHECK: br %r14
     58   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, 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), -1
     66 ; CHECK-DAG: mvi 2(%r2), 255
     67 ; CHECK: br %r14
     68   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, 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), -1
     76 ; CHECK-DAG: mvi 2(%r2), 255
     77 ; CHECK: br %r14
     78   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, 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), -1
     86 ; CHECK: br %r14
     87   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, 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), -1
     95 ; CHECK: br %r14
     96   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, 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), -1
    104 ; CHECK-DAG: mvi 4(%r2), 255
    105 ; CHECK: br %r14
    106   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, 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), -1
    114 ; CHECK-DAG: mvi 4(%r2), 255
    115 ; CHECK: br %r14
    116   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, 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), -1
    124 ; CHECK-DAG: mvhhi 4(%r2), -1
    125 ; CHECK: br %r14
    126   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, 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), -1
    134 ; CHECK-DAG: mvhhi 4(%r2), -1
    135 ; CHECK: br %r14
    136   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, 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: mvi 0(%r2), 255
    144 ; CHECK: mvc 1(6,%r2), 0(%r2)
    145 ; CHECK: br %r14
    146   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 7, i32 1, i1 false)
    147   ret void
    148 }
    149 
    150 ; 7 bytes, i64 version.
    151 define void @f16(i8 *%dest) {
    152 ; CHECK-LABEL: f16:
    153 ; CHECK: mvi 0(%r2), 255
    154 ; CHECK: mvc 1(6,%r2), 0(%r2)
    155 ; CHECK: br %r14
    156   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 7, i32 1, i1 false)
    157   ret void
    158 }
    159 
    160 ; 8 bytes, i32 version.
    161 define void @f17(i8 *%dest) {
    162 ; CHECK-LABEL: f17:
    163 ; CHECK: mvghi 0(%r2), -1
    164 ; CHECK: br %r14
    165   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 8, i32 1, i1 false)
    166   ret void
    167 }
    168 
    169 ; 8 bytes, i64 version.
    170 define void @f18(i8 *%dest) {
    171 ; CHECK-LABEL: f18:
    172 ; CHECK: mvghi 0(%r2), -1
    173 ; CHECK: br %r14
    174   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 8, i32 1, i1 false)
    175   ret void
    176 }
    177 
    178 ; 9 bytes, i32 version.
    179 define void @f19(i8 *%dest) {
    180 ; CHECK-LABEL: f19:
    181 ; CHECK-DAG: mvghi 0(%r2), -1
    182 ; CHECK-DAG: mvi 8(%r2), 255
    183 ; CHECK: br %r14
    184   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 9, i32 1, i1 false)
    185   ret void
    186 }
    187 
    188 ; 9 bytes, i64 version.
    189 define void @f20(i8 *%dest) {
    190 ; CHECK-LABEL: f20:
    191 ; CHECK-DAG: mvghi 0(%r2), -1
    192 ; CHECK-DAG: mvi 8(%r2), 255
    193 ; CHECK: br %r14
    194   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 9, i32 1, i1 false)
    195   ret void
    196 }
    197 
    198 ; 10 bytes, i32 version.
    199 define void @f21(i8 *%dest) {
    200 ; CHECK-LABEL: f21:
    201 ; CHECK-DAG: mvghi 0(%r2), -1
    202 ; CHECK-DAG: mvhhi 8(%r2), -1
    203 ; CHECK: br %r14
    204   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 10, i32 1, i1 false)
    205   ret void
    206 }
    207 
    208 ; 10 bytes, i64 version.
    209 define void @f22(i8 *%dest) {
    210 ; CHECK-LABEL: f22:
    211 ; CHECK-DAG: mvghi 0(%r2), -1
    212 ; CHECK-DAG: mvhhi 8(%r2), -1
    213 ; CHECK: br %r14
    214   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 10, i32 1, i1 false)
    215   ret void
    216 }
    217 
    218 ; 11 bytes, i32 version.
    219 define void @f23(i8 *%dest) {
    220 ; CHECK-LABEL: f23:
    221 ; CHECK: mvi 0(%r2), 255
    222 ; CHECK: mvc 1(10,%r2), 0(%r2)
    223 ; CHECK: br %r14
    224   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 11, i32 1, i1 false)
    225   ret void
    226 }
    227 
    228 ; 11 bytes, i64 version.
    229 define void @f24(i8 *%dest) {
    230 ; CHECK-LABEL: f24:
    231 ; CHECK: mvi 0(%r2), 255
    232 ; CHECK: mvc 1(10,%r2), 0(%r2)
    233 ; CHECK: br %r14
    234   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 11, i32 1, i1 false)
    235   ret void
    236 }
    237 
    238 ; 12 bytes, i32 version.
    239 define void @f25(i8 *%dest) {
    240 ; CHECK-LABEL: f25:
    241 ; CHECK-DAG: mvghi 0(%r2), -1
    242 ; CHECK-DAG: mvhi 8(%r2), -1
    243 ; CHECK: br %r14
    244   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 12, i32 1, i1 false)
    245   ret void
    246 }
    247 
    248 ; 12 bytes, i64 version.
    249 define void @f26(i8 *%dest) {
    250 ; CHECK-LABEL: f26:
    251 ; CHECK-DAG: mvghi 0(%r2), -1
    252 ; CHECK-DAG: mvhi 8(%r2), -1
    253 ; CHECK: br %r14
    254   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 12, i32 1, i1 false)
    255   ret void
    256 }
    257 
    258 ; 13 bytes, i32 version.
    259 define void @f27(i8 *%dest) {
    260 ; CHECK-LABEL: f27:
    261 ; CHECK: mvi 0(%r2), 255
    262 ; CHECK: mvc 1(12,%r2), 0(%r2)
    263 ; CHECK: br %r14
    264   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 13, i32 1, i1 false)
    265   ret void
    266 }
    267 
    268 ; 13 bytes, i64 version.
    269 define void @f28(i8 *%dest) {
    270 ; CHECK-LABEL: f28:
    271 ; CHECK: mvi 0(%r2), 255
    272 ; CHECK: mvc 1(12,%r2), 0(%r2)
    273 ; CHECK: br %r14
    274   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 13, i32 1, i1 false)
    275   ret void
    276 }
    277 
    278 ; 14 bytes, i32 version.
    279 define void @f29(i8 *%dest) {
    280 ; CHECK-LABEL: f29:
    281 ; CHECK: mvi 0(%r2), 255
    282 ; CHECK: mvc 1(13,%r2), 0(%r2)
    283 ; CHECK: br %r14
    284   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 14, i32 1, i1 false)
    285   ret void
    286 }
    287 
    288 ; 14 bytes, i64 version.
    289 define void @f30(i8 *%dest) {
    290 ; CHECK-LABEL: f30:
    291 ; CHECK: mvi 0(%r2), 255
    292 ; CHECK: mvc 1(13,%r2), 0(%r2)
    293 ; CHECK: br %r14
    294   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 14, i32 1, i1 false)
    295   ret void
    296 }
    297 
    298 ; 15 bytes, i32 version.
    299 define void @f31(i8 *%dest) {
    300 ; CHECK-LABEL: f31:
    301 ; CHECK: mvi 0(%r2), 255
    302 ; CHECK: mvc 1(14,%r2), 0(%r2)
    303 ; CHECK: br %r14
    304   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 15, i32 1, i1 false)
    305   ret void
    306 }
    307 
    308 ; 15 bytes, i64 version.
    309 define void @f32(i8 *%dest) {
    310 ; CHECK-LABEL: f32:
    311 ; CHECK: mvi 0(%r2), 255
    312 ; CHECK: mvc 1(14,%r2), 0(%r2)
    313 ; CHECK: br %r14
    314   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 15, i32 1, i1 false)
    315   ret void
    316 }
    317 
    318 ; 16 bytes, i32 version.
    319 define void @f33(i8 *%dest) {
    320 ; CHECK-LABEL: f33:
    321 ; CHECK-DAG: mvghi 0(%r2), -1
    322 ; CHECK-DAG: mvghi 8(%r2), -1
    323 ; CHECK: br %r14
    324   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 16, i32 1, i1 false)
    325   ret void
    326 }
    327 
    328 ; 16 bytes, i64 version.
    329 define void @f34(i8 *%dest) {
    330 ; CHECK-LABEL: f34:
    331 ; CHECK-DAG: mvghi 0(%r2), -1
    332 ; CHECK-DAG: mvghi 8(%r2), -1
    333 ; CHECK: br %r14
    334   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 16, i32 1, i1 false)
    335   ret void
    336 }
    337 
    338 ; 17 bytes, i32 version.
    339 define void @f35(i8 *%dest) {
    340 ; CHECK-LABEL: f35:
    341 ; CHECK: mvi 0(%r2), 255
    342 ; CHECK: mvc 1(16,%r2), 0(%r2)
    343 ; CHECK: br %r14
    344   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 17, i32 1, i1 false)
    345   ret void
    346 }
    347 
    348 ; 17 bytes, i64 version.
    349 define void @f36(i8 *%dest) {
    350 ; CHECK-LABEL: f36:
    351 ; CHECK: mvi 0(%r2), 255
    352 ; CHECK: mvc 1(16,%r2), 0(%r2)
    353 ; CHECK: br %r14
    354   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 17, i32 1, i1 false)
    355   ret void
    356 }
    357 
    358 ; 257 bytes, i32 version.
    359 define void @f37(i8 *%dest) {
    360 ; CHECK-LABEL: f37:
    361 ; CHECK: mvi 0(%r2), 255
    362 ; CHECK: mvc 1(256,%r2), 0(%r2)
    363 ; CHECK: br %r14
    364   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 257, i32 1, i1 false)
    365   ret void
    366 }
    367 
    368 ; 257 bytes, i64 version.
    369 define void @f38(i8 *%dest) {
    370 ; CHECK-LABEL: f38:
    371 ; CHECK: mvi 0(%r2), 255
    372 ; CHECK: mvc 1(256,%r2), 0(%r2)
    373 ; CHECK: br %r14
    374   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 257, i32 1, i1 false)
    375   ret void
    376 }
    377 
    378 ; 258 bytes, i32 version.  We need two MVCs.
    379 define void @f39(i8 *%dest) {
    380 ; CHECK-LABEL: f39:
    381 ; CHECK: mvi 0(%r2), 255
    382 ; CHECK: mvc 1(256,%r2), 0(%r2)
    383 ; CHECK: mvc 257(1,%r2), 256(%r2)
    384 ; CHECK: br %r14
    385   call void @llvm.memset.p0i8.i32(i8 *%dest, i8 -1, i32 258, i32 1, i1 false)
    386   ret void
    387 }
    388 
    389 ; 258 bytes, i64 version.
    390 define void @f40(i8 *%dest) {
    391 ; CHECK-LABEL: f40:
    392 ; CHECK: mvi 0(%r2), 255
    393 ; CHECK: mvc 1(256,%r2), 0(%r2)
    394 ; CHECK: mvc 257(1,%r2), 256(%r2)
    395 ; CHECK: br %r14
    396   call void @llvm.memset.p0i8.i64(i8 *%dest, i8 -1, i64 258, i32 1, i1 false)
    397   ret void
    398 }
    399