Files
clang-p2996/flang/test/Lower/Intrinsics/math-runtime-options.f90
Kiran Chandramohan c49af35a3d [Flang] Options to lower math intrinsics to relaxed, precise variants
Enable lowering to the relaxed and precise variants in the pgmath
library.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Peter Klausler <pklausler@nvidia.com>

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D122484
2022-03-28 17:17:51 +00:00

30 lines
1.1 KiB
Fortran

! RUN: bbc -emit-fir --math-runtime=fast %s -o - | FileCheck %s --check-prefixes="FIR,FAST"
! RUN: bbc -emit-fir --math-runtime=relaxed %s -o - | FileCheck %s --check-prefixes="FIR,RELAXED"
! RUN: bbc -emit-fir --math-runtime=precise %s -o - | FileCheck %s --check-prefixes="FIR,PRECISE"
! RUN: bbc -emit-fir --math-runtime=llvm %s -o - | FileCheck %s --check-prefixes="FIR,LLVM"
! CHECK-LABEL: cos_testr
subroutine cos_testr(a, b)
real :: a, b
! FIR: fir.call @fir.cos.f32.f32
b = cos(a)
end subroutine
! CHECK-LABEL: cos_testd
subroutine cos_testd(a, b)
real(kind=8) :: a, b
! FIR: fir.call @fir.cos.f64.f64
b = cos(a)
end subroutine
! FIR: @fir.cos.f32.f32(%arg0: f32) -> f32 attributes
! FAST: fir.call @__fs_cos_1(%arg0) : (f32) -> f32
! RELAXED: fir.call @__rs_cos_1(%arg0) : (f32) -> f32
! PRECISE: fir.call @__ps_cos_1(%arg0) : (f32) -> f32
! LLVM: fir.call @llvm.cos.f32(%arg0) : (f32) -> f32
! FIR: @fir.cos.f64.f64(%arg0: f64) -> f64
! FAST: fir.call @__fd_cos_1(%arg0) : (f64) -> f64
! RELAXED: fir.call @__rd_cos_1(%arg0) : (f64) -> f64
! PRECISE: fir.call @__pd_cos_1(%arg0) : (f64) -> f64
! LLVM: fir.call @llvm.cos.f64(%arg0) : (f64) -> f64