Home | History | Annotate | Download | only in SystemZ
      1 ; Test 128-bit floating-point stores.
      2 ;
      3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
      4 
      5 ; Check stores with no offset.
      6 define void @f1(i64 %src, double %val) {
      7 ; CHECK-LABEL: f1:
      8 ; CHECK: std %f0, 0(%r2)
      9 ; CHECK: std %f2, 8(%r2)
     10 ; CHECK: br %r14
     11   %ptr = inttoptr i64 %src to fp128 *
     12   %ext = fpext double %val to fp128
     13   store fp128 %ext, fp128 *%ptr
     14   ret void
     15 }
     16 
     17 ; Check the highest aligned offset that allows STD for both halves.
     18 define void @f2(i64 %src, double %val) {
     19 ; CHECK-LABEL: f2:
     20 ; CHECK: std %f0, 4080(%r2)
     21 ; CHECK: std %f2, 4088(%r2)
     22 ; CHECK: br %r14
     23   %add = add i64 %src, 4080
     24   %ptr = inttoptr i64 %add to fp128 *
     25   %ext = fpext double %val to fp128
     26   store fp128 %ext, fp128 *%ptr
     27   ret void
     28 }
     29 
     30 ; Check the next doubleword up, which requires a mixture of STD and STDY.
     31 define void @f3(i64 %src, double %val) {
     32 ; CHECK-LABEL: f3:
     33 ; CHECK: std %f0, 4088(%r2)
     34 ; CHECK: stdy %f2, 4096(%r2)
     35 ; CHECK: br %r14
     36   %add = add i64 %src, 4088
     37   %ptr = inttoptr i64 %add to fp128 *
     38   %ext = fpext double %val to fp128
     39   store fp128 %ext, fp128 *%ptr
     40   ret void
     41 }
     42 
     43 ; Check the next doubleword after that, which requires STDY for both halves.
     44 define void @f4(i64 %src, double %val) {
     45 ; CHECK-LABEL: f4:
     46 ; CHECK: stdy %f0, 4096(%r2)
     47 ; CHECK: stdy %f2, 4104(%r2)
     48 ; CHECK: br %r14
     49   %add = add i64 %src, 4096
     50   %ptr = inttoptr i64 %add to fp128 *
     51   %ext = fpext double %val to fp128
     52   store fp128 %ext, fp128 *%ptr
     53   ret void
     54 }
     55 
     56 ; Check the highest aligned offset that allows STDY for both halves.
     57 define void @f5(i64 %src, double %val) {
     58 ; CHECK-LABEL: f5:
     59 ; CHECK: stdy %f0, 524272(%r2)
     60 ; CHECK: stdy %f2, 524280(%r2)
     61 ; CHECK: br %r14
     62   %add = add i64 %src, 524272
     63   %ptr = inttoptr i64 %add to fp128 *
     64   %ext = fpext double %val to fp128
     65   store fp128 %ext, fp128 *%ptr
     66   ret void
     67 }
     68 
     69 ; Check the next doubleword up, which requires separate address logic.
     70 ; Other sequences besides this one would be OK.
     71 define void @f6(i64 %src, double %val) {
     72 ; CHECK-LABEL: f6:
     73 ; CHECK: lay %r1, 524280(%r2)
     74 ; CHECK: std %f0, 0(%r1)
     75 ; CHECK: std %f2, 8(%r1)
     76 ; CHECK: br %r14
     77   %add = add i64 %src, 524280
     78   %ptr = inttoptr i64 %add to fp128 *
     79   %ext = fpext double %val to fp128
     80   store fp128 %ext, fp128 *%ptr
     81   ret void
     82 }
     83 
     84 ; Check the highest aligned negative offset, which needs a combination of
     85 ; STDY and STD.
     86 define void @f7(i64 %src, double %val) {
     87 ; CHECK-LABEL: f7:
     88 ; CHECK: stdy %f0, -8(%r2)
     89 ; CHECK: std %f2, 0(%r2)
     90 ; CHECK: br %r14
     91   %add = add i64 %src, -8
     92   %ptr = inttoptr i64 %add to fp128 *
     93   %ext = fpext double %val to fp128
     94   store fp128 %ext, fp128 *%ptr
     95   ret void
     96 }
     97 
     98 ; Check the next doubleword down, which requires STDY for both halves.
     99 define void @f8(i64 %src, double %val) {
    100 ; CHECK-LABEL: f8:
    101 ; CHECK: stdy %f0, -16(%r2)
    102 ; CHECK: stdy %f2, -8(%r2)
    103 ; CHECK: br %r14
    104   %add = add i64 %src, -16
    105   %ptr = inttoptr i64 %add to fp128 *
    106   %ext = fpext double %val to fp128
    107   store fp128 %ext, fp128 *%ptr
    108   ret void
    109 }
    110 
    111 ; Check the lowest offset that allows STDY for both halves.
    112 define void @f9(i64 %src, double %val) {
    113 ; CHECK-LABEL: f9:
    114 ; CHECK: stdy %f0, -524288(%r2)
    115 ; CHECK: stdy %f2, -524280(%r2)
    116 ; CHECK: br %r14
    117   %add = add i64 %src, -524288
    118   %ptr = inttoptr i64 %add to fp128 *
    119   %ext = fpext double %val to fp128
    120   store fp128 %ext, fp128 *%ptr
    121   ret void
    122 }
    123 
    124 ; Check the next doubleword down, which requires separate address logic.
    125 ; Other sequences besides this one would be OK.
    126 define void @f10(i64 %src, double %val) {
    127 ; CHECK-LABEL: f10:
    128 ; CHECK: agfi %r2, -524296
    129 ; CHECK: std %f0, 0(%r2)
    130 ; CHECK: std %f2, 8(%r2)
    131 ; CHECK: br %r14
    132   %add = add i64 %src, -524296
    133   %ptr = inttoptr i64 %add to fp128 *
    134   %ext = fpext double %val to fp128
    135   store fp128 %ext, fp128 *%ptr
    136   ret void
    137 }
    138 
    139 ; Check that indices are allowed.
    140 define void @f11(i64 %src, i64 %index, double %val) {
    141 ; CHECK-LABEL: f11:
    142 ; CHECK: std %f0, 4088({{%r2,%r3|%r3,%r2}})
    143 ; CHECK: stdy %f2, 4096({{%r2,%r3|%r3,%r2}})
    144 ; CHECK: br %r14
    145   %add1 = add i64 %src, %index
    146   %add2 = add i64 %add1, 4088
    147   %ptr = inttoptr i64 %add2 to fp128 *
    148   %ext = fpext double %val to fp128
    149   store fp128 %ext, fp128 *%ptr
    150   ret void
    151 }
    152