xref: /llvm-project/flang/test/Lower/Intrinsics/asind.f90 (revision cba1b64099a0558499c7a355db4c59bb5851b6aa)
1! RUN: bbc -emit-fir %s -o - | FileCheck %s --check-prefixes="CHECK"
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"
4
5function test_real4(x)
6  real :: x, test_real4
7  test_real4 = asind(x)
8end 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 @asinf(%[[arg]]) fastmath<contract> : (f32) -> f32
15
16function test_real8(x)
17  real(8) :: x, test_real8
18  test_real8 = asind(x)
19end function
20
21! CHECK-LABEL: @_QPtest_real8
22! CHECK: %[[factor:.*]] = arith.constant 0.017453292519943295 : f64
23! CHECK: %[[arg:.*]] = arith.mulf %{{[A-Za-z0-9._]+}}, %[[factor]] fastmath<contract> : f64
24! CHECK-PRECISE: %{{.*}} = fir.call @asin(%[[arg]]) fastmath<contract> : (f64) -> f64
25