This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Try to push fneg as integer into select
ClosedPublic

Authored by arsenm on Jan 25 2023, 2:58 PM.

Details

Reviewers
rampitec
foad
Pierre-vh
sebastian-ne
Group Reviewers
Restricted Project
Summary

I initially attempted to select the source modifier from xor of
a sign mask. This proved to be more difficult since
foldBinOpIntoSelect does not consider free fneg of integers
and undoes the combine.

Diff Detail

Event Timeline

arsenm created this revision.Jan 25 2023, 2:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2023, 2:58 PM
arsenm requested review of this revision.Jan 25 2023, 2:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2023, 2:58 PM
Herald added a subscriber: wdng. · View Herald Transcript

Do we have/want something similar in GISel?

llvm/lib/Target/AMDGPU/SIISelLowering.cpp
9983

Where is this function defined? In a parent diff?

Also would the transform still be profitable if the SELECT has >1 user and won't be deleted after the combine runs?

arsenm added inline comments.Jan 26 2023, 6:22 AM
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
9983

Yes, I added it to the stack. The hasOneUse condition is covered under shouldFoldFNegIntoSrc, it's more complicated than normal because we can move modifiers up and down

Do we have/want something similar in GISel?

Yes, this will have to be ported

Pierre-vh accepted this revision.Feb 8 2023, 3:05 AM
Pierre-vh added inline comments.
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
9984

Please add a small comment like in D142746 to show what the combine does

This revision is now accepted and ready to land.Feb 8 2023, 3:05 AM
arsenm marked an inline comment as done.Feb 17 2023, 3:46 AM