Ulrich Weigand | 2b3482f | 2017-07-17 17:41:11 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s |
| 2 | |
| 3 | declare double @llvm.fma.f64(double %f1, double %f2, double %f3) |
Ulrich Weigand | 33435c4 | 2017-07-17 17:42:48 +0000 | [diff] [blame] | 4 | declare float @llvm.fma.f32(float %f1, float %f2, float %f3) |
Ulrich Weigand | 2b3482f | 2017-07-17 17:41:11 +0000 | [diff] [blame] | 5 | |
| 6 | define double @f1(double %f1, double %f2, double %acc) { |
| 7 | ; CHECK-LABEL: f1: |
| 8 | ; CHECK: wfnmadb %f0, %f0, %f2, %f4 |
| 9 | ; CHECK: br %r14 |
| 10 | %res = call double @llvm.fma.f64 (double %f1, double %f2, double %acc) |
| 11 | %negres = fsub double -0.0, %res |
| 12 | ret double %negres |
| 13 | } |
| 14 | |
| 15 | define double @f2(double %f1, double %f2, double %acc) { |
| 16 | ; CHECK-LABEL: f2: |
| 17 | ; CHECK: wfnmsdb %f0, %f0, %f2, %f4 |
| 18 | ; CHECK: br %r14 |
| 19 | %negacc = fsub double -0.0, %acc |
| 20 | %res = call double @llvm.fma.f64 (double %f1, double %f2, double %negacc) |
| 21 | %negres = fsub double -0.0, %res |
| 22 | ret double %negres |
| 23 | } |
| 24 | |
Ulrich Weigand | 33435c4 | 2017-07-17 17:42:48 +0000 | [diff] [blame] | 25 | define float @f3(float %f1, float %f2, float %acc) { |
| 26 | ; CHECK-LABEL: f3: |
| 27 | ; CHECK: wfnmasb %f0, %f0, %f2, %f4 |
| 28 | ; CHECK: br %r14 |
| 29 | %res = call float @llvm.fma.f32 (float %f1, float %f2, float %acc) |
| 30 | %negres = fsub float -0.0, %res |
| 31 | ret float %negres |
| 32 | } |
| 33 | |
| 34 | define float @f4(float %f1, float %f2, float %acc) { |
| 35 | ; CHECK-LABEL: f4: |
| 36 | ; CHECK: wfnmssb %f0, %f0, %f2, %f4 |
| 37 | ; CHECK: br %r14 |
| 38 | %negacc = fsub float -0.0, %acc |
| 39 | %res = call float @llvm.fma.f32 (float %f1, float %f2, float %negacc) |
| 40 | %negres = fsub float -0.0, %res |
| 41 | ret float %negres |
| 42 | } |
| 43 | |