[all-commits] [llvm/llvm-project] c99000: [flang] Add -fcomplex-arithmetic= option and selec...

Shunsuke Watanabe via All-commits all-commits at lists.llvm.org
Tue Jul 8 21:44:16 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c9900015a9a0bc2ccadae5e24b63ddbfe4d508fd
      https://github.com/llvm/llvm-project/commit/c9900015a9a0bc2ccadae5e24b63ddbfe4d508fd
  Author: Shunsuke Watanabe <watanabe.shu-06 at fujitsu.com>
  Date:   2025-07-09 (Wed, 09 Jul 2025)

  Changed paths:
    M clang/include/clang/Driver/CommonArgs.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/lib/Driver/ToolChains/Flang.cpp
    M flang/docs/ComplexOperations.md
    M flang/include/flang/Frontend/CodeGenOptions.def
    M flang/include/flang/Frontend/CodeGenOptions.h
    M flang/include/flang/Lower/LoweringOptions.def
    M flang/include/flang/Optimizer/Builder/FIRBuilder.h
    M flang/include/flang/Optimizer/CodeGen/CodeGen.h
    M flang/include/flang/Tools/CrossToolHelpers.h
    M flang/lib/Frontend/CompilerInvocation.cpp
    M flang/lib/Frontend/FrontendActions.cpp
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Lower/ConvertExprToHLFIR.cpp
    M flang/lib/Optimizer/CodeGen/CodeGen.cpp
    M flang/lib/Optimizer/Passes/Pipelines.cpp
    A flang/test/Driver/complex-range.f90
    A flang/test/Integration/complex-div-to-llvm-kind10.f90
    A flang/test/Integration/complex-div-to-llvm-kind16.f90
    A flang/test/Integration/complex-div-to-llvm.f90
    A flang/test/Lower/HLFIR/complex-div-to-hlfir-kind10.f90
    A flang/test/Lower/HLFIR/complex-div-to-hlfir-kind16.f90
    A flang/test/Lower/HLFIR/complex-div-to-hlfir.f90
    M flang/tools/bbc/bbc.cpp

  Log Message:
  -----------
  [flang] Add -fcomplex-arithmetic= option and select complex division algorithm (#146641)

This patch adds an option to select the method for computing complex
number division. It uses `LoweringOptions` to determine whether to lower
complex division to a runtime function call or to MLIR's `complex.div`,
and `CodeGenOptions` to select the computation algorithm for
`complex.div`. The available option values and their corresponding
algorithms are as follows:
- `full`: Lower to a runtime function call. (Default behavior)
- `improved`: Lower to `complex.div` and expand to Smith's algorithm.
- `basic`: Lower to `complex.div` and expand to the algebraic algorithm.

See also the discussion in the following discourse post:
https://discourse.llvm.org/t/optimization-of-complex-number-division/83468

---------

Co-authored-by: Tarun Prabhu <tarunprabhu at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list