1
+ ! REQUIRES: flang-supports-f128-math
1
2
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-FAST"
2
3
! RUN: bbc --math-runtime=precise -emit-fir -hlfir=false %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-PRECISE"
3
4
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-FAST"
@@ -10,8 +11,7 @@ function test_real4(x)
10
11
! CHECK-LABEL: @_QPtest_real4
11
12
! CHECK-PRECISE: %[[atan:.*]] = fir.call @atanf({{%[A-Za-z0-9._]+}}) fastmath<contract> : (f32) -> f32
12
13
! CHECK-FAST: %[[atan:.*]] = math.atan %{{.*}} : f32
13
- ! CHECK: %[[dpi:.*]] = arith.constant 0.31830988618379069 : f64
14
- ! CHECK: %[[inv_pi:.*]] = fir.convert %[[dpi]] : (f64) -> f32
14
+ ! CHECK: %[[inv_pi:.*]] = arith.constant 0.318309873 : f32
15
15
! CHECK: %{{.*}} = arith.mulf %[[atan]], %[[inv_pi]] fastmath<contract> : f32
16
16
17
17
function test_real8 (x )
@@ -25,23 +25,42 @@ function test_real8(x)
25
25
! CHECK: %[[inv_pi:.*]] = arith.constant 0.31830988618379069 : f64
26
26
! CHECK: %{{.*}} = arith.mulf %[[atan]], %[[inv_pi]] fastmath<contract> : f64
27
27
28
- function test_real4_yx (y ,x )
28
+ function test_real16 (x )
29
+ real (16 ) :: x, test_real16
30
+ test_real16 = atanpi(x)
31
+ end function
32
+
33
+ ! CHECK-LABEL: @_QPtest_real16
34
+ ! CHECK: %[[atan:.*]] = fir.call @_FortranAAtanF128({{.*}}) fastmath<contract> : (f128) -> f128
35
+ ! CHECK: %[[inv_pi:.*]] = arith.constant 0.3183098861837906715377675267450{{.*}} : f128
36
+ ! CHECK: %{{.*}} = arith.mulf %[[atan]], %[[inv_pi]] fastmath<contract> : f128
37
+
38
+ function test_real4_yx (y , x )
29
39
real (4 ) :: x, y, test_real4
30
- test_real4 = atanpi(y,x)
40
+ test_real4 = atanpi(y, x)
31
41
end function
32
42
33
43
! CHECK-LABEL: @_QPtest_real4_yx
34
44
! CHECK: %[[atan2:.*]] = math.atan2 %{{.*}}, %{{.*}}: f32
35
- ! CHECK: %[[dpi:.*]] = arith.constant 0.31830988618379069 : f64
36
- ! CHECK: %[[inv_pi:.*]] = fir.convert %[[dpi]] : (f64) -> f32
45
+ ! CHECK: %[[inv_pi:.*]] = arith.constant 0.318309873 : f32
37
46
! CHECK: %{{.*}} = arith.mulf %[[atan2]], %[[inv_pi]] fastmath<contract> : f32
38
47
39
- function test_real8_yx (y ,x )
48
+ function test_real8_yx (y , x )
40
49
real (8 ) :: x, y, test_real8
41
- test_real8 = atanpi(y,x)
50
+ test_real8 = atanpi(y, x)
42
51
end function
43
52
44
53
! CHECK-LABEL: @_QPtest_real8_yx
45
54
! CHECK: %[[atan2:.*]] = math.atan2 %{{.*}}, %{{.*}}: f64
46
55
! CHECK: %[[inv_pi:.*]] = arith.constant 0.31830988618379069 : f64
47
56
! CHECK: %{{.*}} = arith.mulf %[[atan2]], %[[inv_pi]] fastmath<contract> : f64
57
+
58
+ function test_real16_yx (y , x )
59
+ real (16 ) :: x, y, test_real16
60
+ test_real16 = atanpi(y, x)
61
+ end function
62
+
63
+ ! CHECK-LABEL: @_QPtest_real16_yx
64
+ ! CHECK: %[[atan2:.*]] = math.atan2 %{{.*}}, %{{.*}}: f128
65
+ ! CHECK: %[[inv_pi:.*]] = arith.constant 0.3183098861837906715377675267450{{.*}} : f128
66
+ ! CHECK: %{{.*}} = arith.mulf %[[atan2]], %[[inv_pi]] fastmath<contract> : f128
0 commit comments