1+ ! REQUIRES: flang-supports-f128-math
12! RUN: bbc -emit-fir %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-FAST"
23! RUN: bbc --math-runtime=precise -emit-fir %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-PRECISE"
34! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s --check-prefixes="CHECK,CHECK-FAST"
@@ -8,8 +9,7 @@ function test_real4(x)
89end function
910
1011! CHECK-LABEL: @_QPtest_real4
11- ! CHECK: %[[dfactor:.*]] = arith.constant 0.017453292519943295 : f64
12- ! CHECK: %[[factor:.*]] = fir.convert %[[dfactor]] : (f64) -> f32
12+ ! CHECK: %[[factor:.*]] = arith.constant 0.0174532924 : f32
1313! CHECK: %[[arg:.*]] = arith.mulf %{{[A-Za-z0-9._]+}}, %[[factor]] fastmath<contract> : f32
1414! CHECK-PRECISE: %{{.*}} = fir.call @cosf(%[[arg]]) fastmath<contract> : (f32) -> f32
1515! CHECK-FAST: %{{.*}} = math.cos %[[arg]] fastmath<contract> : f32
@@ -24,3 +24,13 @@ function test_real8(x)
2424! CHECK: %[[arg:.*]] = arith.mulf %{{[A-Za-z0-9._]+}}, %[[factor]] fastmath<contract> : f64
2525! CHECK-PRECISE: %{{.*}} = fir.call @cos(%[[arg]]) fastmath<contract> : (f64) -> f64
2626! CHECK-FAST: %{{.*}} = math.cos %[[arg]] fastmath<contract> : f64
27+
28+ function test_real16 (x )
29+ real (16 ) :: x, test_real16
30+ test_real16 = cosd(x)
31+ end function
32+
33+ ! CHECK-LABEL: @_QPtest_real16
34+ ! CHECK: %[[factor:.*]] = arith.constant 0.0174532925199432957692369076848861{{.*}} : f128
35+ ! CHECK: %[[arg:.*]] = arith.mulf %{{[A-Za-z0-9._]+}}, %[[factor]] fastmath<contract> : f128
36+ ! CHECK: %[[result:.*]] = fir.call @_FortranACosF128({{.*}}) fastmath<contract> : (f128) -> f128
0 commit comments