[PATCH] D124463: [RISCV] Add isCommutable to scalar FMA instructions.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 10:37:35 PDT 2022
craig.topper added a comment.
In D124463#3475151 <https://reviews.llvm.org/D124463#3475151>, @reames wrote:
> Declaring a three operand opcode as commutative when only two of the arguments can be safely commuted feels rather suspect to me.
The commutable operands are determined by TargetInstrInfo::findCommutedOpIndices. The default implementation picks the first two source operands. X86 relies on this for commuting AMD's FMA4 instructions. For the FMA3 instructions, X86 overrides TargetInstrInfo::findCommutedOpIndices and calls X86InstrInfo::findThreeSrcCommutedOpIndices. An additional override of TargetInstrInfo::commuteInstructionImpl is used to change the opcode for FMA3.
Should I add more tests or more comments or both?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124463/new/
https://reviews.llvm.org/D124463
More information about the llvm-commits
mailing list