This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Support promotion of the FPOWI integer operand
ClosedPublic

Authored by asb on Nov 15 2018, 4:00 AM.

Details

Summary

For targets where i32 is not a legal type (e.g. 64-bit RISC-V), LegalizeIntegerTypes must promote the integer operand of ISD::FPOWI. As this is a signed value, this should be sign-extended.

This patch enables all tests in float-intrinsics.ll, as prior to this patch that file couldn't be compiled for RV64 due to an assertion when performing codegen for fpowi.

Diff Detail

Repository
rL LLVM

Event Timeline

asb created this revision.Nov 15 2018, 4:00 AM
efriedma accepted this revision.Nov 15 2018, 11:27 AM
efriedma added a subscriber: efriedma.

Probably worth putting a note in ISDOpcodes.h that the behavior is undefined if the integer doesn't fit in 32 bits. Otherwise LGTM.

This revision is now accepted and ready to land.Nov 15 2018, 11:27 AM

can you rebase this one as well, patch not applying cleanly

asb updated this revision to Diff 176079.EditedNov 30 2018, 3:59 AM

Updated to add note about FPOWI being undefined if integer operand is > 32-bits, as suggested by @efriedma

@apazos: The patch applies with minimal fuzz once you've applied the RV64F codegen patch (which is marked as a dependency). I think I'd incorrectly indicated to you that you'd want to apply this patch for RV64I testing - that was incorrect. rL346034 is sufficient for FPOWI on RV64I. Sorry for the confusion!

asb updated this revision to Diff 180081.Jan 3 2019, 8:09 AM

Refreshing patch, no functional changes.

asb updated this revision to Diff 183620.Jan 25 2019, 2:20 PM

Refreshing patch. No changes. This is just waiting for a LGTM on the RV64F patch.

asb updated this revision to Diff 184255.Jan 30 2019, 1:45 AM

Refreshing patch due to fabs codegen changes thanks to the dagcombine added to the RV64F patch.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2019, 7:46 PM