[flang-commits] [PATCH] D139351: Lowering and runtime support for F08 transformational intrinsics: BESSEL_JN and BESSEL_YN
Tarun Prabhu via Phabricator via flang-commits
flang-commits at lists.llvm.org
Mon Dec 5 11:27:09 PST 2022
tarunprabhu created this revision.
tarunprabhu added reviewers: kiranchandramohan, jeanPerier, klausler, PeteSteinfeld, vzakhari, vdonaldson, clementval.
tarunprabhu added a project: Flang.
Herald added subscribers: mehdi_amini, jdoerfert.
Herald added a project: All.
tarunprabhu requested review of this revision.
This patch implements lowering and adds runtime support for F08 transformational variants of BESSEL_JN and BESSEL_YN.
The runtime implementation uses the recurrence relations
`J(n-1, x) = (2.0 / x) * n * J(n, x) - J(n+1, x)`
`Y(n+1, x) = (2.0 / x) * n * Y(n, x) - Y(n-1, x)`
(see https://dlmf.nist.gov/10.74.iv and https://dlmf.nist.gov/10.6.E1).
The special case for x == 0 in `BESSEL_JN(N1, N2, x)` and `BESSEL_YN(N1, N2, x)` are handled in the same runtime function although the check for x == 0 is carried out in FIR. Similarly, the anchor points for the recursion are also calculated in FIR and passed explicitly to the runtime function.
Tests have been added for the new runtime functions and the lowering.
The existing tests for lowering were modified so the tests for the elemental and transformational variants are stylistically more consistent.
Possible alternatives:
- Pass the elemental Bessel function that is used to calculate the anchor points of the recursion to the runtime instead of calculating it in FIR.
- Split the runtime implementation for the x == 0 and x != 0 cases.
https://reviews.llvm.org/D139351
Files:
flang/include/flang/Optimizer/Builder/Runtime/Transformational.h
flang/include/flang/Runtime/transformational.h
flang/lib/Lower/IntrinsicCall.cpp
flang/lib/Optimizer/Builder/Runtime/Transformational.cpp
flang/runtime/transformational.cpp
flang/test/Lower/Intrinsics/bessel_jn.f90
flang/test/Lower/Intrinsics/bessel_yn.f90
flang/unittests/Runtime/Transformational.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139351.480170.patch
Type: text/x-patch
Size: 47935 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20221205/afd4d806/attachment-0001.bin>
More information about the flang-commits
mailing list