[PATCH] D102918: [RISCV] Avoid undef result due to promotion of FPOWI exponent

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 21 15:38:40 PDT 2021


bjope added a comment.

In D102918#2774155 <https://reviews.llvm.org/D102918#2774155>, @efriedma wrote:

> I don't think this is the right approach... in particular, messing with target-specific code means that every target that doesn't have 32-bit registers would need to explicitly handle this.
>
> What we should be doing is changing DAGTypeLegalizer::PromoteIntOp_FPOWI so it doesn't generate an FPOWI with a 64-bit operand, so we don't have an issue in the first place.  We can generate the powi libcall from there, I think.

Yes. After digging around a bit I think I got something that hopefully looks ok. Took me awhile to understand that I shouldn't need to care about legalization of the result and fp operand (because those should have been legalized already when we get to type legalizing the exponent operand). And I also realized that I can provide the original (not promoted) operand to TargetLowering::makeLibCall and then lowerCallTo will handle the situation according to the calling convention (such as promoting using sign-extend for 64-bit RISCV).

So I created D102950 <https://reviews.llvm.org/D102950> that hopefully can replace this patch by creating the libcall already in DAGTypeLegalizer::PromoteIntOp_FPOWI.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102918/new/

https://reviews.llvm.org/D102918



More information about the llvm-commits mailing list