[all-commits] [llvm/llvm-project] bef2bb: [flang] Lowering and runtime support for F08 trans...

Tarun Prabhu via All-commits all-commits at lists.llvm.org
Mon Dec 19 07:00:44 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bef2bb34bfadd61cf399a15f096c84980121279f
      https://github.com/llvm/llvm-project/commit/bef2bb34bfadd61cf399a15f096c84980121279f
  Author: Tarun Prabhu <tarun at lanl.gov>
  Date:   2022-12-19 (Mon, 19 Dec 2022)

  Changed paths:
    M flang/include/flang/Optimizer/Builder/Runtime/Transformational.h
    M flang/include/flang/Runtime/transformational.h
    M flang/lib/Lower/IntrinsicCall.cpp
    M flang/lib/Optimizer/Builder/Runtime/Transformational.cpp
    M flang/runtime/transformational.cpp
    M flang/test/Lower/Intrinsics/bessel_jn.f90
    M flang/test/Lower/Intrinsics/bessel_yn.f90
    M flang/unittests/Optimizer/Builder/Runtime/TransformationalTest.cpp
    M flang/unittests/Runtime/Transformational.cpp

  Log Message:
  -----------
  [flang] Lowering and runtime support for F08 transformational intrinsics: 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).

Although the standard requires that `N1` and `N2` in `BESSEL_JN(N1, N2, x)`
and `BESSEL_YN(N1, N2, x)` be non-negative, this is not checked in the
runtime functions. This is in keeping with some other compilers which also
return some results when `N1` and/or `N2` are negative.

The special case for `x == 0` is  handled in different runtime functions
for each of `BESSEL_JN` and `BESSEL_YN`. The lowering code checks for this
case and inserts the checks and the appropriate runtime calls in FIR.

The existing tests for the two intrinsics was modified to keep the style
consistent with the additional lowering tests that were added.




More information about the All-commits mailing list