[all-commits] [llvm/llvm-project] c3a0df: [Flang] Change complex divide lowering
kiranchandramohan via All-commits
all-commits at lists.llvm.org
Thu May 11 05:04:47 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c3a0df1903bb29352d3661fe6e943f811e57c1ed
https://github.com/llvm/llvm-project/commit/c3a0df1903bb29352d3661fe6e943f811e57c1ed
Author: Kiran Chandramohan <kiran.chandramohan at arm.com>
Date: 2023-05-11 (Thu, 11 May 2023)
Changed paths:
M flang/include/flang/Optimizer/Builder/IntrinsicCall.h
M flang/lib/Lower/ConvertExpr.cpp
M flang/lib/Lower/ConvertExprToHLFIR.cpp
M flang/lib/Optimizer/Builder/IntrinsicCall.cpp
M flang/test/Lower/HLFIR/binary-ops.f90
M flang/test/Lower/assignment.f90
M flang/test/Lower/complex-operations.f90
Log Message:
-----------
[Flang] Change complex divide lowering
Currently complex division is lowered to a fir.divc operation and the
fir.divc is later converted to a sequence of llvm operations to perform
complex division, however this causes issues for extreme values when
the calculations overflow.
This patch changes the lowering of complex division to use the Intrinsic
Call functionality to lower into library calls (for single, double,
extended and quad precisions) or an MLIR complex dialect division operation
(for half and bfloat precisions).
A new wrapper function `genLibSplitComplexArgsCall` is written to handle
the case of the arguments of the Complex Library calls being split to
its real and imaginary real components.
Note 1: If the Complex To Standard conversion of division operation
matures then we can use it for all precisions. Currently it has the
same issues as the conversion of fir.divc.
Note 2: A previous patch (D145808) did the same but during conversion of
the fir.divc operation. But using function calls at that stage leads to
ABI issues since the conversion to LLVM is not aware of the complex target
rewrite.
Note 3: If the patch is accepted, fir.divc can be removed from FIR. We
can use the complex.div operation where any transformation is required.
Reviewed By: vzakhari, PeteSteinfeld, DavidTruby, jeanPerier
Differential Revision: https://reviews.llvm.org/D149546
More information about the All-commits
mailing list