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