| 1 |
// Test lowering of REAL operations from FIR to LLVM IR |
| 2 |
|
| 3 |
// RUN: tco %s | FileCheck %s |
| 4 |
|
| 5 |
// CHECK-LABEL: @bar |
| 6 |
func.func @bar(%a : f16, %b : f32, %c : f64, %d : f80, %e : f128) -> f80 { |
| 7 |
// CHECK: fpext half %{{.*}} to x86_fp80 |
| 8 |
%1 = fir.convert %a : (f16) -> f80 |
| 9 |
// CHECK: fpext float %{{.*}} to x86_fp80 |
| 10 |
%2 = fir.convert %b : (f32) -> f80 |
| 11 |
// CHECK: fpext double %{{.*}} to x86_fp80 |
| 12 |
%3 = fir.convert %c : (f64) -> f80 |
| 13 |
// CHECK-NOT: fpext |
| 14 |
// CHECK-NOT: fptrunc |
| 15 |
%4 = fir.convert %d : (f80) -> f80 |
| 16 |
// CHECK: fptrunc fp128 %{{.*}} to x86_fp80 |
| 17 |
%5 = fir.convert %e : (f128) -> f80 |
| 18 |
// CHECK-NEXT: call x86_fp80 |
| 19 |
%6 = fir.call @foop(%1, %2, %3, %4, %5) : (f80, f80, f80, f80, f80) -> f80 |
| 20 |
return %6 : f80 |
| 21 |
} |
| 22 |
|
| 23 |
// CHECK-LABEL: @foo |
| 24 |
func.func @foo(%a : f128, %b : f128, %c : f128, %d : f128, %e : f128) -> f128 { |
| 25 |
// CHECK: fadd fp128 |
| 26 |
%1 = arith.addf %a, %b : f128 |
| 27 |
// CHECK: fmul fp128 |
| 28 |
%2 = arith.mulf %1, %c : f128 |
| 29 |
// CHECK: fsub fp128 |
| 30 |
%3 = arith.subf %2, %d : f128 |
| 31 |
// CHECK: fdiv fp128 |
| 32 |
%4 = arith.divf %3, %e : f128 |
| 33 |
// CHECK: frem fp128 |
| 34 |
%5 = arith.remf %4, %a : f128 |
| 35 |
return %5 : f128 |
| 36 |
} |
| 37 |
|
| 38 |
// CHECK-LABEL: @foop |
| 39 |
func.func @foop(%a : f80, %b : f80, %c : f80, %d : f80, %e : f80) -> f80 { |
| 40 |
// CHECK: fadd x86_fp80 |
| 41 |
%1 = arith.addf %a, %b : f80 |
| 42 |
// CHECK: fmul x86_fp80 |
| 43 |
%2 = arith.mulf %1, %c : f80 |
| 44 |
// CHECK: fsub x86_fp80 |
| 45 |
%3 = arith.subf %2, %d : f80 |
| 46 |
// CHECK: fdiv x86_fp80 |
| 47 |
%4 = arith.divf %3, %e : f80 |
| 48 |
// CHECK: frem x86_fp80 |
| 49 |
%5 = arith.remf %4, %a : f80 |
| 50 |
return %5 : f80 |
| 51 |
} |