This is an archive of the discontinued LLVM Phabricator instance.

[X86] Improve nnan fmin/fmax vector reduction
ClosedPublic

Authored by nikic on Sep 13 2020, 12:57 AM.

Details

Summary

Use +/-Inf or +/-Largest as neutral element for nnan fmin/fmax reductions. Using NaN requires dropping the nnan flag, which is important to get a good lowering on X86.

Diff Detail

Event Timeline

nikic created this revision.Sep 13 2020, 12:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 13 2020, 12:57 AM
nikic requested review of this revision.Sep 13 2020, 12:57 AM
craig.topper accepted this revision.Sep 13 2020, 12:05 PM

LGTM

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
4804

Are there tabs heres?

4805

Same here

This revision is now accepted and ready to land.Sep 13 2020, 12:05 PM
nikic updated this revision to Diff 291645.Sep 14 2020, 12:19 PM
nikic edited the summary of this revision. (Show Details)

Now that D87571 also handles the FLT_MAX case, adjust this patch to use either NaN, Inf or FLT_MAX as the neutral element for fminnum (and same negative for fmaxnum). This means we never have to drop FMF.

This revision was automatically updated to reflect the committed changes.