Hello,
I would like to get some feedback on the following patches:
https://reviews.llvm.org/D129809
https://reviews.llvm.org/D129810
https://reviews.llvm.org/D129811
https://reviews.llvm.org/D129812
The intention is to have operations for representing Fortran exponentiation operator (**
) in FIR/MLIR after Flang
lowering. Currently Math dialect has PowFOp
that has both base and power operands of floating-point-like
types. Fortran exponentiation may take the following operand types (fp, fp)
, (fp, sint)
, (sint, sint)
, and the same for complex data types, but this is for future work.
The fp
operands may be 16, 32, 64, 80, 128-bit wide. The sint
operands may be 8, 16, 32, 64 and 128-bit wide.
I propose adding IPowSI and FPowSI operations to support representing the exponentiation. The reason for distinguishing IPowSI
from the operations with the FP base is that it has no floating point related effects whatsoever. The reason for distinguishing the existing PowF
and FPowSI
is that their constant folding and conversions to LLVM dialect are somewhat different, but I do not reallty have a strong a point here.
@kiranchandramohan noted that having SI
suffix does not make much sense unless we are going to have a UI
version. So I think I am going to change SI
to just I
.
I have some questions about the FPowSI
lowering to LLVM dialect in Login
- It turns out that
llvm.powi.*
intrinsic supports onlyi32
power operand (see verification in LegalizeDAG.cpp), even though the “corresponding” LLVM dialectPowIOp
is defined quite loosely allowing any operand type. Which one is right? - Does it make sense to lower Math’s
FPowSI
into LLVM’sPowIOp
for the supported cases and use an alternative implementation (like here) otherwise?
Thank you,
Slava