This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add no NaN support to lowerFMAXIMUM_FMINIMUM.
ClosedPublic

Authored by craig.topper on Jul 31 2023, 3:09 PM.

Details

Summary

Using the nonans FMF and the DAG.isKnownNeverNaN on the inputs.

Diff Detail

Event Timeline

craig.topper created this revision.Jul 31 2023, 3:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2023, 3:09 PM
craig.topper requested review of this revision.Jul 31 2023, 3:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2023, 3:09 PM
Herald added subscribers: eopXD, MaskRay. · View Herald Transcript

Add isKnownNeverNaN support too

craig.topper retitled this revision from [RISCV] Add nonans FMF support to lowerFMAXIMUM_FMINIMUM. to [RISCV] Add no NaN support to lowerFMAXIMUM_FMINIMUM..Jul 31 2023, 5:20 PM
craig.topper edited the summary of this revision. (Show Details)
fakepaper56 accepted this revision.Jul 31 2023, 8:09 PM

LGTM.

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
4675

How about to initialize NewY as Y and assign it to select node if Op->getFlags().hasNoNaNs() || DAG.isKnownNeverNaN(X) like,

SDValue NewY = Y;
if (Op->getFlags().hasNoNaNs() || DAG.isKnownNeverNaN(X)) {
    SDValue XIsNonNan = DAG.getSetCC(DL, XLenVT, X, X, ISD::SETOEQ);
    NewY = DAG.getSelect(DL, VT, XIsNonNan, Y, X); 
}
This revision is now accepted and ready to land.Jul 31 2023, 8:09 PM
This revision was landed with ongoing or failed builds.Aug 1 2023, 9:51 AM
This revision was automatically updated to reflect the committed changes.