This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Fold fsub [+-0] into fneg when folding source modifiers
ClosedPublic

Authored by arsenm on Jul 18 2023, 3:35 PM.

Details

Reviewers
foad
rampitec
Pierre-vh
b-sumner
Group Reviewers
Restricted Project
Summary

This isn't always folded to fneg for a freestanding fsub depending on
the denormal mode. When matching source modifiers, we're implicitly
canonicalizing the input so we can fold it here.

Doesn't bother handling the VOP3P case since it's only relevant with
DAZ, which nobody really uses with f16.

For f64, tests show an existing bug where DAGCombiner tries to respect
the denormal mode for fsub -0, x, but not after it's lowered to
fadd -0, (fneg x).

Diff Detail

Event Timeline

arsenm created this revision.Jul 18 2023, 3:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2023, 3:35 PM
arsenm requested review of this revision.Jul 18 2023, 3:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2023, 3:35 PM
Herald added a subscriber: wdng. · View Herald Transcript
rampitec accepted this revision.Jul 18 2023, 3:38 PM
This revision is now accepted and ready to land.Jul 18 2023, 3:38 PM

This is broken if the source modifier user is a select, need to filter out the non-canonicalizing cases

arsenm updated this revision to Diff 541966.Jul 19 2023, 5:14 AM

Filter out non-canonicalizing operations (class and select)

arsenm requested review of this revision.Jul 19 2023, 5:14 AM
arsenm edited the summary of this revision. (Show Details)
rampitec accepted this revision.Jul 19 2023, 12:50 PM
This revision is now accepted and ready to land.Jul 19 2023, 12:50 PM