| 1 |
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-FAST" |
| 2 |
! RUN: bbc --math-runtime=precise -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-PRECISE" |
| 3 |
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-FAST" |
| 4 |
|
| 5 |
function test_real4(x) |
| 6 |
real :: x, test_real4 |
| 7 |
test_real4 = atand(x) |
| 8 |
end function |
| 9 |
|
| 10 |
! CHECK-LABEL: @_QPtest_real4 |
| 11 |
! CHECK-PRECISE: %[[atan:.*]] = fir.call @atanf({{%[A-Za-z0-9._]+}}) fastmath<contract> : (f32) -> f32 |
| 12 |
! CHECK-FAST: %[[atan:.*]] = math.atan %{{.*}} : f32 |
| 13 |
! CHECK: %[[dfactor:.*]] = arith.constant 57.295779513082323 : f64 |
| 14 |
! CHECK: %[[factor:.*]] = fir.convert %[[dfactor]] : (f64) -> f32 |
| 15 |
! CHECK: %{{.*}} = arith.mulf %[[atan]], %[[factor]] fastmath<contract> : f32 |
| 16 |
|
| 17 |
function test_real8(x) |
| 18 |
real(8) :: x, test_real8 |
| 19 |
test_real8 = atand(x) |
| 20 |
end function |
| 21 |
|
| 22 |
! CHECK-LABEL: @_QPtest_real8 |
| 23 |
! CHECK-PRECISE: %[[atan:.*]] = fir.call @atan({{%[A-Za-z0-9._]+}}) fastmath<contract> : (f64) -> f64 |
| 24 |
! CHECK-FAST: %[[atan:.*]] = math.atan %{{.*}} : f64 |
| 25 |
! CHECK: %[[factor:.*]] = arith.constant 57.295779513082323 : f64 |
| 26 |
! CHECK: %{{.*}} = arith.mulf %[[atan]], %[[factor]] fastmath<contract> : f64 |
| 27 |
|
| 28 |
function test_real4_yx(y,x) |
| 29 |
real(4) :: x, y, test_real4 |
| 30 |
test_real4 = atand(y,x) |
| 31 |
end function |
| 32 |
|
| 33 |
! CHECK-LABEL: @_QPtest_real4_yx |
| 34 |
! CHECK: %[[atan2:.*]] = math.atan2 %{{.*}}, %{{.*}}: f32 |
| 35 |
! CHECK: %[[dfactor:.*]] = arith.constant 57.295779513082323 : f64 |
| 36 |
! CHECK: %[[factor:.*]] = fir.convert %[[dfactor]] : (f64) -> f32 |
| 37 |
! CHECK: %{{.*}} = arith.mulf %[[atan2]], %[[factor]] fastmath<contract> : f32 |
| 38 |
|
| 39 |
function test_real8_yx(y,x) |
| 40 |
real(8) :: x, y, test_real8 |
| 41 |
test_real8 = atand(y,x) |
| 42 |
end function |
| 43 |
|
| 44 |
! CHECK-LABEL: @_QPtest_real8_yx |
| 45 |
! CHECK: %[[atan2:.*]] = math.atan2 %{{.*}}, %{{.*}}: f64 |
| 46 |
! CHECK: %[[factor:.*]] = arith.constant 57.295779513082323 : f64 |
| 47 |
! CHECK: %{{.*}} = arith.mulf %[[atan2]], %[[factor]] fastmath<contract> : f64 |