This patch brings in code which can lower a Fortran intrinsic to a runtime call or an llvm intrinsic. For math intrinsics the runtime call is to the `math` or `pgmath` library. Non-math intrinsics are covered by the Flang runtime. A distance computation mechanism is introduced to find the runtime function that closely matches the types of the intrinsic call. In this patch, the `abs` intrinsic is lowered in the following way, -> Integer version is lowered as a group of MLIR/FIR operations -> Real version is lowered to llvm intrinsics -> Complex version is lowered to the `math_hypot` runtime function This patch is part of upstreaming from the fir-dev branch of https://github.com/flang-compiler/f18-llvm-project Reviewed By: clementval Differential Revision: https://reviews.llvm.org/D120403 Co-authored-by: Jean Perier <jperier@nvidia.com> Co-authored-by: Eric Schweitz <eschweitz@nvidia.com> Co-authored-by: zacharyselk <zrselk@gmail.com> Co-authored-by: V Donaldson <vdonaldson@nvidia.com> Co-authored-by: Valentin Clement <clementval@gmail.com>
11 lines
280 B
Fortran
11 lines
280 B
Fortran
! There is no quad math runtime available in lowering
|
|
! for now. Test that the TODO are emitted correctly.
|
|
! RUN: bbc -emit-fir %s -o /dev/null 2>&1 | FileCheck %s
|
|
|
|
complex(16) :: a
|
|
real(16) :: b
|
|
! CHECK: TODO: no math runtime available for 'hypot(f128, f128)'
|
|
b = abs(a)
|
|
end
|
|
|