Skip to content

Commit 666df54

Browse files
[flang] Fold double bessel functions on Windows. (#130253)
There are no functions for `float`. see: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/bessel-functions-j0-j1-jn-y0-y1-yn
1 parent d8d561a commit 666df54

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

flang/lib/Evaluate/intrinsics-library.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,23 @@ struct HostRuntimeLibrary<long double, LibraryVersion::LibmExtensions> {
559559
#endif // HAS_FLOAT80 || HAS_LDBL128
560560
#endif //_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600
561561

562+
#ifdef _WIN32
563+
template <> struct HostRuntimeLibrary<double, LibraryVersion::LibmExtensions> {
564+
using F = FuncPointer<double, double>;
565+
using FN = FuncPointer<double, int, double>;
566+
static constexpr HostRuntimeFunction table[]{
567+
FolderFactory<F, F{::_j0}>::Create("bessel_j0"),
568+
FolderFactory<F, F{::_j1}>::Create("bessel_j1"),
569+
FolderFactory<FN, FN{::_jn}>::Create("bessel_jn"),
570+
FolderFactory<F, F{::_y0}>::Create("bessel_y0"),
571+
FolderFactory<F, F{::_y1}>::Create("bessel_y1"),
572+
FolderFactory<FN, FN{::_yn}>::Create("bessel_yn"),
573+
};
574+
static constexpr HostRuntimeMap map{table};
575+
static_assert(map.Verify(), "map must be sorted");
576+
};
577+
#endif
578+
562579
/// Define pgmath description
563580
#if LINK_WITH_LIBPGMATH
564581
// Only use libpgmath for folding if it is available.

0 commit comments

Comments
 (0)