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