Skip to content

[flang][runtime] Moved support for some REAL(16) intrinsics to Float128Math. #83383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions flang/runtime/Float128Math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ set(sources
erf.cpp
erfc.cpp
exp.cpp
exponent.cpp
floor.cpp
fraction.cpp
hypot.cpp
j0.cpp
j1.cpp
Expand All @@ -69,11 +71,18 @@ set(sources
log.cpp
log10.cpp
lround.cpp
mod-real.cpp
modulo-real.cpp
nearest.cpp
norm2.cpp
pow.cpp
round.cpp
rrspacing.cpp
scale.cpp
set-exponent.cpp
sin.cpp
sinh.cpp
spacing.cpp
sqrt.cpp
tan.cpp
tanh.cpp
Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/acos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(AcosF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Acos<RTNAME(AcosF128)>::invoke(x);
return Acos<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/acosh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(AcoshF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Acosh<RTNAME(AcoshF128)>::invoke(x);
return Acosh<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/asin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(AsinF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Asin<RTNAME(AsinF128)>::invoke(x);
return Asin<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/asinh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(AsinhF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Asinh<RTNAME(AsinhF128)>::invoke(x);
return Asinh<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/atan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(AtanF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Atan<RTNAME(AtanF128)>::invoke(x);
return Atan<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/atan2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern "C" {
CppTypeFor<TypeCategory::Real, 16> RTDEF(Atan2F128)(
CppTypeFor<TypeCategory::Real, 16> x,
CppTypeFor<TypeCategory::Real, 16> y) {
return Atan2<RTNAME(Atan2F128)>::invoke(x, y);
return Atan2<true>::invoke(x, y);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/atanh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(AtanhF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Atanh<RTNAME(AtanhF128)>::invoke(x);
return Atanh<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/cabs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
// NOTE: Flang calls the runtime APIs using C _Complex ABI
CppTypeFor<TypeCategory::Real, 16> RTDEF(CAbsF128)(CFloat128ComplexType x) {
return CAbs<RTNAME(CAbsF128)>::invoke(x);
return CAbs<true>::invoke(x);
}
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/ceil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(CeilF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Ceil<RTNAME(CeilF128)>::invoke(x);
return Ceil<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/cos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(CosF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Cos<RTNAME(CosF128)>::invoke(x);
return Cos<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/cosh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(CoshF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Cosh<RTNAME(CoshF128)>::invoke(x);
return Cosh<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/erf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(ErfF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Erf<RTNAME(ErfF128)>::invoke(x);
return Erf<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/erfc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(ErfcF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Erfc<RTNAME(ErfcF128)>::invoke(x);
return Erfc<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/exp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(ExpF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Exp<RTNAME(ExpF128)>::invoke(x);
return Exp<true>::invoke(x);
}
#endif

Expand Down
26 changes: 26 additions & 0 deletions flang/runtime/Float128Math/exponent.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//===-- runtime/Float128Math/exponent.cpp ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "math-entries.h"
#include "numeric-template-specs.h"

namespace Fortran::runtime {
extern "C" {

#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
// EXPONENT (16.9.75)
CppTypeFor<TypeCategory::Integer, 4> RTDEF(Exponent16_4)(F128Type x) {
return Exponent<CppTypeFor<TypeCategory::Integer, 4>>(x);
}
CppTypeFor<TypeCategory::Integer, 8> RTDEF(Exponent16_8)(F128Type x) {
return Exponent<CppTypeFor<TypeCategory::Integer, 8>>(x);
}
#endif

} // extern "C"
} // namespace Fortran::runtime
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/floor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(FloorF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Floor<RTNAME(FloorF128)>::invoke(x);
return Floor<true>::invoke(x);
}
#endif

Expand Down
21 changes: 21 additions & 0 deletions flang/runtime/Float128Math/fraction.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- runtime/Float128Math/fraction.cpp ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "math-entries.h"
#include "numeric-template-specs.h"

namespace Fortran::runtime {
extern "C" {

#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
// FRACTION (16.9.80)
F128Type RTDEF(Fraction16)(F128Type x) { return Fraction(x); }
#endif

} // extern "C"
} // namespace Fortran::runtime
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/hypot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern "C" {
CppTypeFor<TypeCategory::Real, 16> RTDEF(HypotF128)(
CppTypeFor<TypeCategory::Real, 16> x,
CppTypeFor<TypeCategory::Real, 16> y) {
return Hypot<RTNAME(HypotF128)>::invoke(x, y);
return Hypot<true>::invoke(x, y);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/j0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(J0F128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return J0<RTNAME(J0F128)>::invoke(x);
return J0<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/j1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(J1F128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return J1<RTNAME(J1F128)>::invoke(x);
return J1<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/jn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(JnF128)(
int n, CppTypeFor<TypeCategory::Real, 16> x) {
return Jn<RTNAME(JnF128)>::invoke(n, x);
return Jn<true>::invoke(n, x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/lgamma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(LgammaF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Lgamma<RTNAME(LgammaF128)>::invoke(x);
return Lgamma<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/llround.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Integer, 8> RTDEF(LlroundF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Llround<RTNAME(LlroundF128)>::invoke(x);
return Llround<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(LogF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Log<RTNAME(LogF128)>::invoke(x);
return Log<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/log10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Real, 16> RTDEF(Log10F128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Log10<RTNAME(Log10F128)>::invoke(x);
return Log10<true>::invoke(x);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/Float128Math/lround.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
CppTypeFor<TypeCategory::Integer, 4> RTDEF(LroundF128)(
CppTypeFor<TypeCategory::Real, 16> x) {
return Lround<RTNAME(LroundF128)>::invoke(x);
return Lround<true>::invoke(x);
}
#endif

Expand Down
Loading