Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 1 | ; Test multiplication of two f32s, producing an f64 result. |
| 2 | ; |
| 3 | ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s |
| 4 | |
| 5 | ; Check register multiplication. |
| 6 | define double @f1(float %f1, float %f2) { |
| 7 | ; CHECK: f1: |
| 8 | ; CHECK: mdebr %f0, %f2 |
| 9 | ; CHECK: br %r14 |
| 10 | %f1x = fpext float %f1 to double |
| 11 | %f2x = fpext float %f2 to double |
| 12 | %res = fmul double %f1x, %f2x |
| 13 | ret double %res |
| 14 | } |
| 15 | |
| 16 | ; Check the low end of the MDEB range. |
| 17 | define double @f2(float %f1, float *%ptr) { |
| 18 | ; CHECK: f2: |
| 19 | ; CHECK: mdeb %f0, 0(%r2) |
| 20 | ; CHECK: br %r14 |
| 21 | %f2 = load float *%ptr |
| 22 | %f1x = fpext float %f1 to double |
| 23 | %f2x = fpext float %f2 to double |
| 24 | %res = fmul double %f1x, %f2x |
| 25 | ret double %res |
| 26 | } |
| 27 | |
| 28 | ; Check the high end of the aligned MDEB range. |
| 29 | define double @f3(float %f1, float *%base) { |
| 30 | ; CHECK: f3: |
| 31 | ; CHECK: mdeb %f0, 4092(%r2) |
| 32 | ; CHECK: br %r14 |
| 33 | %ptr = getelementptr float *%base, i64 1023 |
| 34 | %f2 = load float *%ptr |
| 35 | %f1x = fpext float %f1 to double |
| 36 | %f2x = fpext float %f2 to double |
| 37 | %res = fmul double %f1x, %f2x |
| 38 | ret double %res |
| 39 | } |
| 40 | |
| 41 | ; Check the next word up, which needs separate address logic. |
| 42 | ; Other sequences besides this one would be OK. |
| 43 | define double @f4(float %f1, float *%base) { |
| 44 | ; CHECK: f4: |
| 45 | ; CHECK: aghi %r2, 4096 |
| 46 | ; CHECK: mdeb %f0, 0(%r2) |
| 47 | ; CHECK: br %r14 |
| 48 | %ptr = getelementptr float *%base, i64 1024 |
| 49 | %f2 = load float *%ptr |
| 50 | %f1x = fpext float %f1 to double |
| 51 | %f2x = fpext float %f2 to double |
| 52 | %res = fmul double %f1x, %f2x |
| 53 | ret double %res |
| 54 | } |
| 55 | |
| 56 | ; Check negative displacements, which also need separate address logic. |
| 57 | define double @f5(float %f1, float *%base) { |
| 58 | ; CHECK: f5: |
| 59 | ; CHECK: aghi %r2, -4 |
| 60 | ; CHECK: mdeb %f0, 0(%r2) |
| 61 | ; CHECK: br %r14 |
| 62 | %ptr = getelementptr float *%base, i64 -1 |
| 63 | %f2 = load float *%ptr |
| 64 | %f1x = fpext float %f1 to double |
| 65 | %f2x = fpext float %f2 to double |
| 66 | %res = fmul double %f1x, %f2x |
| 67 | ret double %res |
| 68 | } |
| 69 | |
| 70 | ; Check that MDEB allows indices. |
| 71 | define double @f6(float %f1, float *%base, i64 %index) { |
| 72 | ; CHECK: f6: |
| 73 | ; CHECK: sllg %r1, %r3, 2 |
| 74 | ; CHECK: mdeb %f0, 400(%r1,%r2) |
| 75 | ; CHECK: br %r14 |
| 76 | %ptr1 = getelementptr float *%base, i64 %index |
| 77 | %ptr2 = getelementptr float *%ptr1, i64 100 |
| 78 | %f2 = load float *%ptr2 |
| 79 | %f1x = fpext float %f1 to double |
| 80 | %f2x = fpext float %f2 to double |
| 81 | %res = fmul double %f1x, %f2x |
| 82 | ret double %res |
| 83 | } |