Home | History | Annotate | Download | only in SystemZ
      1 ; Test extensions of f32 to f64.
      2 ;
      3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 \
      4 ; RUN:   | FileCheck -check-prefix=CHECK -check-prefix=CHECK-SCALAR %s
      5 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
      6 
      7 ; Check register extension.
      8 define double @f1(float %val) {
      9 ; CHECK-LABEL: f1:
     10 ; CHECK: ldebr %f0, %f0
     11 ; CHECK: br %r14
     12   %res = fpext float %val to double
     13   ret double %res
     14 }
     15 
     16 ; Check the low end of the LDEB range.
     17 define double @f2(float *%ptr) {
     18 ; CHECK-LABEL: f2:
     19 ; CHECK: ldeb %f0, 0(%r2)
     20 ; CHECK: br %r14
     21   %val = load float , float *%ptr
     22   %res = fpext float %val to double
     23   ret double %res
     24 }
     25 
     26 ; Check the high end of the aligned LDEB range.
     27 define double @f3(float *%base) {
     28 ; CHECK-LABEL: f3:
     29 ; CHECK: ldeb %f0, 4092(%r2)
     30 ; CHECK: br %r14
     31   %ptr = getelementptr float, float *%base, i64 1023
     32   %val = load float , float *%ptr
     33   %res = fpext float %val to double
     34   ret double %res
     35 }
     36 
     37 ; Check the next word up, which needs separate address logic.
     38 ; Other sequences besides this one would be OK.
     39 define double @f4(float *%base) {
     40 ; CHECK-LABEL: f4:
     41 ; CHECK: aghi %r2, 4096
     42 ; CHECK: ldeb %f0, 0(%r2)
     43 ; CHECK: br %r14
     44   %ptr = getelementptr float, float *%base, i64 1024
     45   %val = load float , float *%ptr
     46   %res = fpext float %val to double
     47   ret double %res
     48 }
     49 
     50 ; Check negative displacements, which also need separate address logic.
     51 define double @f5(float *%base) {
     52 ; CHECK-LABEL: f5:
     53 ; CHECK: aghi %r2, -4
     54 ; CHECK: ldeb %f0, 0(%r2)
     55 ; CHECK: br %r14
     56   %ptr = getelementptr float, float *%base, i64 -1
     57   %val = load float , float *%ptr
     58   %res = fpext float %val to double
     59   ret double %res
     60 }
     61 
     62 ; Check that LDEB allows indices.
     63 define double @f6(float *%base, i64 %index) {
     64 ; CHECK-LABEL: f6:
     65 ; CHECK: sllg %r1, %r3, 2
     66 ; CHECK: ldeb %f0, 400(%r1,%r2)
     67 ; CHECK: br %r14
     68   %ptr1 = getelementptr float, float *%base, i64 %index
     69   %ptr2 = getelementptr float, float *%ptr1, i64 100
     70   %val = load float , float *%ptr2
     71   %res = fpext float %val to double
     72   ret double %res
     73 }
     74 
     75 ; Test a case where we spill the source of at least one LDEBR.  We want
     76 ; to use LDEB if possible.
     77 define void @f7(double *%ptr1, float *%ptr2) {
     78 ; CHECK-LABEL: f7:
     79 ; CHECK-SCALAR: ldeb {{%f[0-9]+}}, 16{{[04]}}(%r15)
     80 ; CHECK: br %r14
     81   %val0 = load volatile float , float *%ptr2
     82   %val1 = load volatile float , float *%ptr2
     83   %val2 = load volatile float , float *%ptr2
     84   %val3 = load volatile float , float *%ptr2
     85   %val4 = load volatile float , float *%ptr2
     86   %val5 = load volatile float , float *%ptr2
     87   %val6 = load volatile float , float *%ptr2
     88   %val7 = load volatile float , float *%ptr2
     89   %val8 = load volatile float , float *%ptr2
     90   %val9 = load volatile float , float *%ptr2
     91   %val10 = load volatile float , float *%ptr2
     92   %val11 = load volatile float , float *%ptr2
     93   %val12 = load volatile float , float *%ptr2
     94   %val13 = load volatile float , float *%ptr2
     95   %val14 = load volatile float , float *%ptr2
     96   %val15 = load volatile float , float *%ptr2
     97   %val16 = load volatile float , float *%ptr2
     98 
     99   %ext0 = fpext float %val0 to double
    100   %ext1 = fpext float %val1 to double
    101   %ext2 = fpext float %val2 to double
    102   %ext3 = fpext float %val3 to double
    103   %ext4 = fpext float %val4 to double
    104   %ext5 = fpext float %val5 to double
    105   %ext6 = fpext float %val6 to double
    106   %ext7 = fpext float %val7 to double
    107   %ext8 = fpext float %val8 to double
    108   %ext9 = fpext float %val9 to double
    109   %ext10 = fpext float %val10 to double
    110   %ext11 = fpext float %val11 to double
    111   %ext12 = fpext float %val12 to double
    112   %ext13 = fpext float %val13 to double
    113   %ext14 = fpext float %val14 to double
    114   %ext15 = fpext float %val15 to double
    115   %ext16 = fpext float %val16 to double
    116 
    117   store volatile float %val0, float *%ptr2
    118   store volatile float %val1, float *%ptr2
    119   store volatile float %val2, float *%ptr2
    120   store volatile float %val3, float *%ptr2
    121   store volatile float %val4, float *%ptr2
    122   store volatile float %val5, float *%ptr2
    123   store volatile float %val6, float *%ptr2
    124   store volatile float %val7, float *%ptr2
    125   store volatile float %val8, float *%ptr2
    126   store volatile float %val9, float *%ptr2
    127   store volatile float %val10, float *%ptr2
    128   store volatile float %val11, float *%ptr2
    129   store volatile float %val12, float *%ptr2
    130   store volatile float %val13, float *%ptr2
    131   store volatile float %val14, float *%ptr2
    132   store volatile float %val15, float *%ptr2
    133   store volatile float %val16, float *%ptr2
    134 
    135   store volatile double %ext0, double *%ptr1
    136   store volatile double %ext1, double *%ptr1
    137   store volatile double %ext2, double *%ptr1
    138   store volatile double %ext3, double *%ptr1
    139   store volatile double %ext4, double *%ptr1
    140   store volatile double %ext5, double *%ptr1
    141   store volatile double %ext6, double *%ptr1
    142   store volatile double %ext7, double *%ptr1
    143   store volatile double %ext8, double *%ptr1
    144   store volatile double %ext9, double *%ptr1
    145   store volatile double %ext10, double *%ptr1
    146   store volatile double %ext11, double *%ptr1
    147   store volatile double %ext12, double *%ptr1
    148   store volatile double %ext13, double *%ptr1
    149   store volatile double %ext14, double *%ptr1
    150   store volatile double %ext15, double *%ptr1
    151   store volatile double %ext16, double *%ptr1
    152 
    153   ret void
    154 }
    155