Home | History | Annotate | Download | only in SystemZ
      1 ; Test spilling of vector registers.
      2 ;
      3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
      4 
      5 ; We need to allocate a 16-byte spill slot and save the 8 call-saved FPRs.
      6 ; The frame size should be exactly 160 + 16 + 8 * 8 = 240.
      7 define void @f1(<16 x i8> *%ptr) {
      8 ; CHECK-LABEL: f1:
      9 ; CHECK: aghi %r15, -240
     10 ; CHECK-DAG: std %f8,
     11 ; CHECK-DAG: std %f9,
     12 ; CHECK-DAG: std %f10,
     13 ; CHECK-DAG: std %f11,
     14 ; CHECK-DAG: std %f12,
     15 ; CHECK-DAG: std %f13,
     16 ; CHECK-DAG: std %f14,
     17 ; CHECK-DAG: std %f15,
     18 ; CHECK: vst {{%v[0-9]+}}, 160(%r15)
     19 ; CHECK: vl {{%v[0-9]+}}, 160(%r15)
     20 ; CHECK-DAG: ld %f8,
     21 ; CHECK-DAG: ld %f9,
     22 ; CHECK-DAG: ld %f10,
     23 ; CHECK-DAG: ld %f11,
     24 ; CHECK-DAG: ld %f12,
     25 ; CHECK-DAG: ld %f13,
     26 ; CHECK-DAG: ld %f14,
     27 ; CHECK-DAG: ld %f15,
     28 ; CHECK: aghi %r15, 240
     29 ; CHECK: br %r14
     30   %v0 = load volatile <16 x i8>, <16 x i8> *%ptr
     31   %v1 = load volatile <16 x i8>, <16 x i8> *%ptr
     32   %v2 = load volatile <16 x i8>, <16 x i8> *%ptr
     33   %v3 = load volatile <16 x i8>, <16 x i8> *%ptr
     34   %v4 = load volatile <16 x i8>, <16 x i8> *%ptr
     35   %v5 = load volatile <16 x i8>, <16 x i8> *%ptr
     36   %v6 = load volatile <16 x i8>, <16 x i8> *%ptr
     37   %v7 = load volatile <16 x i8>, <16 x i8> *%ptr
     38   %v8 = load volatile <16 x i8>, <16 x i8> *%ptr
     39   %v9 = load volatile <16 x i8>, <16 x i8> *%ptr
     40   %v10 = load volatile <16 x i8>, <16 x i8> *%ptr
     41   %v11 = load volatile <16 x i8>, <16 x i8> *%ptr
     42   %v12 = load volatile <16 x i8>, <16 x i8> *%ptr
     43   %v13 = load volatile <16 x i8>, <16 x i8> *%ptr
     44   %v14 = load volatile <16 x i8>, <16 x i8> *%ptr
     45   %v15 = load volatile <16 x i8>, <16 x i8> *%ptr
     46   %v16 = load volatile <16 x i8>, <16 x i8> *%ptr
     47   %v17 = load volatile <16 x i8>, <16 x i8> *%ptr
     48   %v18 = load volatile <16 x i8>, <16 x i8> *%ptr
     49   %v19 = load volatile <16 x i8>, <16 x i8> *%ptr
     50   %v20 = load volatile <16 x i8>, <16 x i8> *%ptr
     51   %v21 = load volatile <16 x i8>, <16 x i8> *%ptr
     52   %v22 = load volatile <16 x i8>, <16 x i8> *%ptr
     53   %v23 = load volatile <16 x i8>, <16 x i8> *%ptr
     54   %v24 = load volatile <16 x i8>, <16 x i8> *%ptr
     55   %v25 = load volatile <16 x i8>, <16 x i8> *%ptr
     56   %v26 = load volatile <16 x i8>, <16 x i8> *%ptr
     57   %v27 = load volatile <16 x i8>, <16 x i8> *%ptr
     58   %v28 = load volatile <16 x i8>, <16 x i8> *%ptr
     59   %v29 = load volatile <16 x i8>, <16 x i8> *%ptr
     60   %v30 = load volatile <16 x i8>, <16 x i8> *%ptr
     61   %v31 = load volatile <16 x i8>, <16 x i8> *%ptr
     62   %vx = load volatile <16 x i8>, <16 x i8> *%ptr
     63   store volatile <16 x i8> %vx, <16 x i8> *%ptr
     64   store volatile <16 x i8> %v31, <16 x i8> *%ptr
     65   store volatile <16 x i8> %v30, <16 x i8> *%ptr
     66   store volatile <16 x i8> %v29, <16 x i8> *%ptr
     67   store volatile <16 x i8> %v28, <16 x i8> *%ptr
     68   store volatile <16 x i8> %v27, <16 x i8> *%ptr
     69   store volatile <16 x i8> %v26, <16 x i8> *%ptr
     70   store volatile <16 x i8> %v25, <16 x i8> *%ptr
     71   store volatile <16 x i8> %v24, <16 x i8> *%ptr
     72   store volatile <16 x i8> %v23, <16 x i8> *%ptr
     73   store volatile <16 x i8> %v22, <16 x i8> *%ptr
     74   store volatile <16 x i8> %v21, <16 x i8> *%ptr
     75   store volatile <16 x i8> %v20, <16 x i8> *%ptr
     76   store volatile <16 x i8> %v19, <16 x i8> *%ptr
     77   store volatile <16 x i8> %v18, <16 x i8> *%ptr
     78   store volatile <16 x i8> %v17, <16 x i8> *%ptr
     79   store volatile <16 x i8> %v16, <16 x i8> *%ptr
     80   store volatile <16 x i8> %v15, <16 x i8> *%ptr
     81   store volatile <16 x i8> %v14, <16 x i8> *%ptr
     82   store volatile <16 x i8> %v13, <16 x i8> *%ptr
     83   store volatile <16 x i8> %v12, <16 x i8> *%ptr
     84   store volatile <16 x i8> %v11, <16 x i8> *%ptr
     85   store volatile <16 x i8> %v10, <16 x i8> *%ptr
     86   store volatile <16 x i8> %v9, <16 x i8> *%ptr
     87   store volatile <16 x i8> %v8, <16 x i8> *%ptr
     88   store volatile <16 x i8> %v7, <16 x i8> *%ptr
     89   store volatile <16 x i8> %v6, <16 x i8> *%ptr
     90   store volatile <16 x i8> %v5, <16 x i8> *%ptr
     91   store volatile <16 x i8> %v4, <16 x i8> *%ptr
     92   store volatile <16 x i8> %v3, <16 x i8> *%ptr
     93   store volatile <16 x i8> %v2, <16 x i8> *%ptr
     94   store volatile <16 x i8> %v1, <16 x i8> *%ptr
     95   store volatile <16 x i8> %v0, <16 x i8> *%ptr
     96   ret void
     97 }
     98 
     99 ; Like f1, but no 16-byte slot should be needed.
    100 define void @f2(<16 x i8> *%ptr) {
    101 ; CHECK-LABEL: f2:
    102 ; CHECK: aghi %r15, -224
    103 ; CHECK-DAG: std %f8,
    104 ; CHECK-DAG: std %f9,
    105 ; CHECK-DAG: std %f10,
    106 ; CHECK-DAG: std %f11,
    107 ; CHECK-DAG: std %f12,
    108 ; CHECK-DAG: std %f13,
    109 ; CHECK-DAG: std %f14,
    110 ; CHECK-DAG: std %f15,
    111 ; CHECK-NOT: vst {{.*}}(%r15)
    112 ; CHECK-NOT: vl {{.*}}(%r15)
    113 ; CHECK-DAG: ld %f8,
    114 ; CHECK-DAG: ld %f9,
    115 ; CHECK-DAG: ld %f10,
    116 ; CHECK-DAG: ld %f11,
    117 ; CHECK-DAG: ld %f12,
    118 ; CHECK-DAG: ld %f13,
    119 ; CHECK-DAG: ld %f14,
    120 ; CHECK-DAG: ld %f15,
    121 ; CHECK: aghi %r15, 224
    122 ; CHECK: br %r14
    123   %v0 = load volatile <16 x i8>, <16 x i8> *%ptr
    124   %v1 = load volatile <16 x i8>, <16 x i8> *%ptr
    125   %v2 = load volatile <16 x i8>, <16 x i8> *%ptr
    126   %v3 = load volatile <16 x i8>, <16 x i8> *%ptr
    127   %v4 = load volatile <16 x i8>, <16 x i8> *%ptr
    128   %v5 = load volatile <16 x i8>, <16 x i8> *%ptr
    129   %v6 = load volatile <16 x i8>, <16 x i8> *%ptr
    130   %v7 = load volatile <16 x i8>, <16 x i8> *%ptr
    131   %v8 = load volatile <16 x i8>, <16 x i8> *%ptr
    132   %v9 = load volatile <16 x i8>, <16 x i8> *%ptr
    133   %v10 = load volatile <16 x i8>, <16 x i8> *%ptr
    134   %v11 = load volatile <16 x i8>, <16 x i8> *%ptr
    135   %v12 = load volatile <16 x i8>, <16 x i8> *%ptr
    136   %v13 = load volatile <16 x i8>, <16 x i8> *%ptr
    137   %v14 = load volatile <16 x i8>, <16 x i8> *%ptr
    138   %v15 = load volatile <16 x i8>, <16 x i8> *%ptr
    139   %v16 = load volatile <16 x i8>, <16 x i8> *%ptr
    140   %v17 = load volatile <16 x i8>, <16 x i8> *%ptr
    141   %v18 = load volatile <16 x i8>, <16 x i8> *%ptr
    142   %v19 = load volatile <16 x i8>, <16 x i8> *%ptr
    143   %v20 = load volatile <16 x i8>, <16 x i8> *%ptr
    144   %v21 = load volatile <16 x i8>, <16 x i8> *%ptr
    145   %v22 = load volatile <16 x i8>, <16 x i8> *%ptr
    146   %v23 = load volatile <16 x i8>, <16 x i8> *%ptr
    147   %v24 = load volatile <16 x i8>, <16 x i8> *%ptr
    148   %v25 = load volatile <16 x i8>, <16 x i8> *%ptr
    149   %v26 = load volatile <16 x i8>, <16 x i8> *%ptr
    150   %v27 = load volatile <16 x i8>, <16 x i8> *%ptr
    151   %v28 = load volatile <16 x i8>, <16 x i8> *%ptr
    152   %v29 = load volatile <16 x i8>, <16 x i8> *%ptr
    153   %v30 = load volatile <16 x i8>, <16 x i8> *%ptr
    154   %v31 = load volatile <16 x i8>, <16 x i8> *%ptr
    155   store volatile <16 x i8> %v31, <16 x i8> *%ptr
    156   store volatile <16 x i8> %v30, <16 x i8> *%ptr
    157   store volatile <16 x i8> %v29, <16 x i8> *%ptr
    158   store volatile <16 x i8> %v28, <16 x i8> *%ptr
    159   store volatile <16 x i8> %v27, <16 x i8> *%ptr
    160   store volatile <16 x i8> %v26, <16 x i8> *%ptr
    161   store volatile <16 x i8> %v25, <16 x i8> *%ptr
    162   store volatile <16 x i8> %v24, <16 x i8> *%ptr
    163   store volatile <16 x i8> %v23, <16 x i8> *%ptr
    164   store volatile <16 x i8> %v22, <16 x i8> *%ptr
    165   store volatile <16 x i8> %v21, <16 x i8> *%ptr
    166   store volatile <16 x i8> %v20, <16 x i8> *%ptr
    167   store volatile <16 x i8> %v19, <16 x i8> *%ptr
    168   store volatile <16 x i8> %v18, <16 x i8> *%ptr
    169   store volatile <16 x i8> %v17, <16 x i8> *%ptr
    170   store volatile <16 x i8> %v16, <16 x i8> *%ptr
    171   store volatile <16 x i8> %v15, <16 x i8> *%ptr
    172   store volatile <16 x i8> %v14, <16 x i8> *%ptr
    173   store volatile <16 x i8> %v13, <16 x i8> *%ptr
    174   store volatile <16 x i8> %v12, <16 x i8> *%ptr
    175   store volatile <16 x i8> %v11, <16 x i8> *%ptr
    176   store volatile <16 x i8> %v10, <16 x i8> *%ptr
    177   store volatile <16 x i8> %v9, <16 x i8> *%ptr
    178   store volatile <16 x i8> %v8, <16 x i8> *%ptr
    179   store volatile <16 x i8> %v7, <16 x i8> *%ptr
    180   store volatile <16 x i8> %v6, <16 x i8> *%ptr
    181   store volatile <16 x i8> %v5, <16 x i8> *%ptr
    182   store volatile <16 x i8> %v4, <16 x i8> *%ptr
    183   store volatile <16 x i8> %v3, <16 x i8> *%ptr
    184   store volatile <16 x i8> %v2, <16 x i8> *%ptr
    185   store volatile <16 x i8> %v1, <16 x i8> *%ptr
    186   store volatile <16 x i8> %v0, <16 x i8> *%ptr
    187   ret void
    188 }
    189 
    190 ; Like f2, but only %f8 should be saved.
    191 define void @f3(<16 x i8> *%ptr) {
    192 ; CHECK-LABEL: f3:
    193 ; CHECK: aghi %r15, -168
    194 ; CHECK-DAG: std %f8,
    195 ; CHECK-NOT: vst {{.*}}(%r15)
    196 ; CHECK-NOT: vl {{.*}}(%r15)
    197 ; CHECK-NOT: %v9
    198 ; CHECK-NOT: %v10
    199 ; CHECK-NOT: %v11
    200 ; CHECK-NOT: %v12
    201 ; CHECK-NOT: %v13
    202 ; CHECK-NOT: %v14
    203 ; CHECK-NOT: %v15
    204 ; CHECK-DAG: ld %f8,
    205 ; CHECK: aghi %r15, 168
    206 ; CHECK: br %r14
    207   %v0 = load volatile <16 x i8>, <16 x i8> *%ptr
    208   %v1 = load volatile <16 x i8>, <16 x i8> *%ptr
    209   %v2 = load volatile <16 x i8>, <16 x i8> *%ptr
    210   %v3 = load volatile <16 x i8>, <16 x i8> *%ptr
    211   %v4 = load volatile <16 x i8>, <16 x i8> *%ptr
    212   %v5 = load volatile <16 x i8>, <16 x i8> *%ptr
    213   %v6 = load volatile <16 x i8>, <16 x i8> *%ptr
    214   %v7 = load volatile <16 x i8>, <16 x i8> *%ptr
    215   %v8 = load volatile <16 x i8>, <16 x i8> *%ptr
    216   %v16 = load volatile <16 x i8>, <16 x i8> *%ptr
    217   %v17 = load volatile <16 x i8>, <16 x i8> *%ptr
    218   %v18 = load volatile <16 x i8>, <16 x i8> *%ptr
    219   %v19 = load volatile <16 x i8>, <16 x i8> *%ptr
    220   %v20 = load volatile <16 x i8>, <16 x i8> *%ptr
    221   %v21 = load volatile <16 x i8>, <16 x i8> *%ptr
    222   %v22 = load volatile <16 x i8>, <16 x i8> *%ptr
    223   %v23 = load volatile <16 x i8>, <16 x i8> *%ptr
    224   %v24 = load volatile <16 x i8>, <16 x i8> *%ptr
    225   %v25 = load volatile <16 x i8>, <16 x i8> *%ptr
    226   %v26 = load volatile <16 x i8>, <16 x i8> *%ptr
    227   %v27 = load volatile <16 x i8>, <16 x i8> *%ptr
    228   %v28 = load volatile <16 x i8>, <16 x i8> *%ptr
    229   %v29 = load volatile <16 x i8>, <16 x i8> *%ptr
    230   %v30 = load volatile <16 x i8>, <16 x i8> *%ptr
    231   %v31 = load volatile <16 x i8>, <16 x i8> *%ptr
    232   store volatile <16 x i8> %v31, <16 x i8> *%ptr
    233   store volatile <16 x i8> %v30, <16 x i8> *%ptr
    234   store volatile <16 x i8> %v29, <16 x i8> *%ptr
    235   store volatile <16 x i8> %v28, <16 x i8> *%ptr
    236   store volatile <16 x i8> %v27, <16 x i8> *%ptr
    237   store volatile <16 x i8> %v26, <16 x i8> *%ptr
    238   store volatile <16 x i8> %v25, <16 x i8> *%ptr
    239   store volatile <16 x i8> %v24, <16 x i8> *%ptr
    240   store volatile <16 x i8> %v23, <16 x i8> *%ptr
    241   store volatile <16 x i8> %v22, <16 x i8> *%ptr
    242   store volatile <16 x i8> %v21, <16 x i8> *%ptr
    243   store volatile <16 x i8> %v20, <16 x i8> *%ptr
    244   store volatile <16 x i8> %v19, <16 x i8> *%ptr
    245   store volatile <16 x i8> %v18, <16 x i8> *%ptr
    246   store volatile <16 x i8> %v17, <16 x i8> *%ptr
    247   store volatile <16 x i8> %v16, <16 x i8> *%ptr
    248   store volatile <16 x i8> %v8, <16 x i8> *%ptr
    249   store volatile <16 x i8> %v7, <16 x i8> *%ptr
    250   store volatile <16 x i8> %v6, <16 x i8> *%ptr
    251   store volatile <16 x i8> %v5, <16 x i8> *%ptr
    252   store volatile <16 x i8> %v4, <16 x i8> *%ptr
    253   store volatile <16 x i8> %v3, <16 x i8> *%ptr
    254   store volatile <16 x i8> %v2, <16 x i8> *%ptr
    255   store volatile <16 x i8> %v1, <16 x i8> *%ptr
    256   store volatile <16 x i8> %v0, <16 x i8> *%ptr
    257   ret void
    258 }
    259 
    260 ; Like f2, but no registers should be saved.
    261 define void @f4(<16 x i8> *%ptr) {
    262 ; CHECK-LABEL: f4:
    263 ; CHECK-NOT: %r15
    264 ; CHECK: br %r14
    265   %v0 = load volatile <16 x i8>, <16 x i8> *%ptr
    266   %v1 = load volatile <16 x i8>, <16 x i8> *%ptr
    267   %v2 = load volatile <16 x i8>, <16 x i8> *%ptr
    268   %v3 = load volatile <16 x i8>, <16 x i8> *%ptr
    269   %v4 = load volatile <16 x i8>, <16 x i8> *%ptr
    270   %v5 = load volatile <16 x i8>, <16 x i8> *%ptr
    271   %v6 = load volatile <16 x i8>, <16 x i8> *%ptr
    272   %v7 = load volatile <16 x i8>, <16 x i8> *%ptr
    273   %v16 = load volatile <16 x i8>, <16 x i8> *%ptr
    274   %v17 = load volatile <16 x i8>, <16 x i8> *%ptr
    275   %v18 = load volatile <16 x i8>, <16 x i8> *%ptr
    276   %v19 = load volatile <16 x i8>, <16 x i8> *%ptr
    277   %v20 = load volatile <16 x i8>, <16 x i8> *%ptr
    278   %v21 = load volatile <16 x i8>, <16 x i8> *%ptr
    279   %v22 = load volatile <16 x i8>, <16 x i8> *%ptr
    280   %v23 = load volatile <16 x i8>, <16 x i8> *%ptr
    281   %v24 = load volatile <16 x i8>, <16 x i8> *%ptr
    282   %v25 = load volatile <16 x i8>, <16 x i8> *%ptr
    283   %v26 = load volatile <16 x i8>, <16 x i8> *%ptr
    284   %v27 = load volatile <16 x i8>, <16 x i8> *%ptr
    285   %v28 = load volatile <16 x i8>, <16 x i8> *%ptr
    286   %v29 = load volatile <16 x i8>, <16 x i8> *%ptr
    287   %v30 = load volatile <16 x i8>, <16 x i8> *%ptr
    288   %v31 = load volatile <16 x i8>, <16 x i8> *%ptr
    289   store volatile <16 x i8> %v31, <16 x i8> *%ptr
    290   store volatile <16 x i8> %v30, <16 x i8> *%ptr
    291   store volatile <16 x i8> %v29, <16 x i8> *%ptr
    292   store volatile <16 x i8> %v28, <16 x i8> *%ptr
    293   store volatile <16 x i8> %v27, <16 x i8> *%ptr
    294   store volatile <16 x i8> %v26, <16 x i8> *%ptr
    295   store volatile <16 x i8> %v25, <16 x i8> *%ptr
    296   store volatile <16 x i8> %v24, <16 x i8> *%ptr
    297   store volatile <16 x i8> %v23, <16 x i8> *%ptr
    298   store volatile <16 x i8> %v22, <16 x i8> *%ptr
    299   store volatile <16 x i8> %v21, <16 x i8> *%ptr
    300   store volatile <16 x i8> %v20, <16 x i8> *%ptr
    301   store volatile <16 x i8> %v19, <16 x i8> *%ptr
    302   store volatile <16 x i8> %v18, <16 x i8> *%ptr
    303   store volatile <16 x i8> %v17, <16 x i8> *%ptr
    304   store volatile <16 x i8> %v16, <16 x i8> *%ptr
    305   store volatile <16 x i8> %v7, <16 x i8> *%ptr
    306   store volatile <16 x i8> %v6, <16 x i8> *%ptr
    307   store volatile <16 x i8> %v5, <16 x i8> *%ptr
    308   store volatile <16 x i8> %v4, <16 x i8> *%ptr
    309   store volatile <16 x i8> %v3, <16 x i8> *%ptr
    310   store volatile <16 x i8> %v2, <16 x i8> *%ptr
    311   store volatile <16 x i8> %v1, <16 x i8> *%ptr
    312   store volatile <16 x i8> %v0, <16 x i8> *%ptr
    313   ret void
    314 }
    315