| 1 |
! RUN: bbc -emit-fir %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-FAST" |
| 2 |
! RUN: bbc --math-runtime=precise -emit-fir %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-PRECISE" |
| 3 |
! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-FAST" |
| 4 |
|
| 5 |
function test_real4(x) |
| 6 |
real :: x, test_real4 |
| 7 |
test_real4 = cosd(x) |
| 8 |
end function |
| 9 |
|
| 10 |
! CHECK-LABEL: @_QPtest_real4 |
| 11 |
! CHECK: %[[dfactor:.*]] = arith.constant 0.017453292519943295 : f64 |
| 12 |
! CHECK: %[[factor:.*]] = fir.convert %[[dfactor]] : (f64) -> f32 |
| 13 |
! CHECK: %[[arg:.*]] = arith.mulf %{{[A-Za-z0-9._]+}}, %[[factor]] fastmath<contract> : f32 |
| 14 |
! CHECK-PRECISE: %{{.*}} = fir.call @cosf(%[[arg]]) fastmath<contract> : (f32) -> f32 |
| 15 |
! CHECK-FAST: %{{.*}} = math.cos %[[arg]] fastmath<contract> : f32 |
| 16 |
|
| 17 |
function test_real8(x) |
| 18 |
real(8) :: x, test_real8 |
| 19 |
test_real8 = cosd(x) |
| 20 |
end function |
| 21 |
|
| 22 |
! CHECK-LABEL: @_QPtest_real8 |
| 23 |
! CHECK: %[[factor:.*]] = arith.constant 0.017453292519943295 : f64 |
| 24 |
! CHECK: %[[arg:.*]] = arith.mulf %{{[A-Za-z0-9._]+}}, %[[factor]] fastmath<contract> : f64 |
| 25 |
! CHECK-PRECISE: %{{.*}} = fir.call @cos(%[[arg]]) fastmath<contract> : (f64) -> f64 |
| 26 |
! CHECK-FAST: %{{.*}} = math.cos %[[arg]] fastmath<contract> : f64 |