[PATCH] D96614: [AMDGPU][GlobalISel] Transform (fsub (fmul x, y), z) -> (fma x, y, -z)
Mateja Marjanovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 2 08:17:47 PST 2021
matejam added a comment.
Thanks for the suggestions!
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4088
+ // Floating-point multiply-add with intermediate rounding.
+ bool HasFMAD = (LegalOperations && TLI.isFMADLegal(MI, DstType));
+ // Floating-point multiply-add without intermediate rounding.
----------------
arsenm wrote:
> Don't see where isFMADLegal is fedined
In the other revision (the parent): [[ https://reviews.llvm.org/D93305 | D93305 ]]
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4107-4119
+ unsigned SwapPriority = 0;
+ if (isContractableFMUL(*MI0, AllowFusionGlobally) &&
+ isContractableFMUL(*MI1, AllowFusionGlobally)) {
+ if (std::distance(
+ MRI.use_instr_nodbg_begin(MI0->getOperand(0).getReg()),
+ MRI.use_instr_nodbg_end()) >
+ std::distance(
----------------
arsenm wrote:
> I'm not sure I follow this heuristic, or what SwapPriority means
If SwapPriority is equal to 0 that means that the first and second operands aren't both fmul instructions, if it's equal to 2 it means that both of the arguments are fmul and that the second arg has fewer uses so we pick him for folding, vice versa if it's equal to 1. I will make it more simple in the next version.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96614/new/
https://reviews.llvm.org/D96614
More information about the llvm-commits
mailing list