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