This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG][ARM][AArch64][Hexagon][RISCV][X86] Add SDNPCommutative to fma node in tablegen. Remove explicit commuted patterns from targets.
ClosedPublic

Authored by craig.topper on Nov 19 2020, 10:14 PM.

Details

Summary

X86 was already specially marking fma as commutable which allowed
tablegen to autogenerate commuted patterns. This moves it to the target
independent definition and fix up the targets to remove now
unneeded patterns.

Unfortunately, the tests change because the commuted version of
the patterns are generating operands in a different than the
explicit patterns.

Diff Detail

Event Timeline

craig.topper created this revision.Nov 19 2020, 10:14 PM
craig.topper requested review of this revision.Nov 19 2020, 10:14 PM
RKSimon added inline comments.Nov 20 2020, 3:29 AM
llvm/include/llvm/Target/TargetSelectionDAG.td
443–444

Can fmad be updated as well?

Make fmad commutable as well. Looks like only AMDGPU uses it and I don't think they have patterns that care.

RKSimon added subscribers: foad, arsenm.

LGTM - @arsenm @foad is the FMAD change OK for AMDGPU?

foad added a comment.Nov 23 2020, 1:20 AM

LGTM - @arsenm @foad is the FMAD change OK for AMDGPU?

It looks correct and I can't imagine how it would break anything.

RKSimon accepted this revision.Nov 23 2020, 2:14 AM
This revision is now accepted and ready to land.Nov 23 2020, 2:14 AM
This revision was landed with ongoing or failed builds.Nov 23 2020, 10:30 AM
This revision was automatically updated to reflect the committed changes.
thakis added a subscriber: thakis.Nov 23 2020, 10:38 AM

Looks like this needs updates over in clang land: http://45.33.8.238/linux/33569/step_7.txt