xref: /llvm-project/flang/test/Lower/Intrinsics/atan2pi.f90 (revision 1d3d8936baf9f15e23603bbb1cfe0a5610d458d3)
1! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-FAST"
2! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-FAST"
3
4
5function test_real4(y,x)
6  real(4) :: x, y, test_real4
7  test_real4 = atan2pi(y,x)
8end function
9
10! CHECK-LABEL: @_QPtest_real4
11! CHECK-FAST: %[[atan2:.*]] = math.atan2 %{{.*}}, %{{.*}}: f32
12! CHECK: %[[dpi:.*]] = arith.constant 0.31830988618379069 : f64
13! CHECK: %[[inv_pi:.*]] = fir.convert %[[dpi]] : (f64) -> f32
14! CHECK: %{{.*}} = arith.mulf %[[atan2]], %[[inv_pi]] fastmath<contract> : f32
15
16function test_real8(y,x)
17  real(8) :: x, y, test_real8
18  test_real8 = atan2pi(y,x)
19end function
20
21! CHECK-LABEL: @_QPtest_real8
22! CHECK-FAST: %[[atan2:.*]] = math.atan2 %{{.*}}, %{{.*}}: f64
23! CHECK: %[[inv_pi:.*]] = arith.constant 0.31830988618379069 : f64
24! CHECK: %{{.*}} = arith.mulf %[[atan2]], %[[inv_pi]] fastmath<contract> : f64
25