[PATCH] D73978: [WIP][FPEnv] Don't transform FSUB(-0.0,X)->FNEG(X) when flushing denormals
Cameron McInally via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 31 08:49:29 PDT 2020
cameron.mcinally updated this revision to Diff 253871.
cameron.mcinally added a comment.
Herald added subscribers: kerbowa, nhaehnle, jvesely.
Rebase and AMDGPU test changes to elucidate a problem with this Diff.
@arsenm, The problem in the AMDGPU tests is that FSUB(-0.0, X) is not folding into the following instruction, as it would if it was transformed into an FNEG(X).
It's probably okay to fold some of these. E.g.
- %fneg.a = fsub float -0.000000e+00, %a
+ %fneg.a = fneg float %a
%add = fadd float %fneg.a, %b
If we're flushing input to zero, it's probably okay to fold a FSUB(-0,X) into the FADD, since the FADD will flush denorms. Although, if we're flushing output to zero, that probably is NOT ok, since something like FADD(largest_denorm, largest_denorm) would return a normal.
I guess what I'm really asking is how important is this to AMDGPU? It seems to be the only target that is upset about the changes in this Diff.
Would it be enough to update the CHECK lines to not expect a FSUB(-0,X) to fold? Or does this need more peeps to fold the cases where it's safe? And if the latter, should we move ahead with this Diff and optimize later?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73978/new/
https://reviews.llvm.org/D73978
Files:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
llvm/test/CodeGen/AMDGPU/fcanonicalize-elimination.ll
llvm/test/CodeGen/AMDGPU/fcanonicalize.f16.ll
llvm/test/CodeGen/AMDGPU/fcanonicalize.ll
llvm/test/CodeGen/AMDGPU/fdiv32-to-rcp-folding.ll
llvm/test/CodeGen/AMDGPU/fmuladd.f16.ll
llvm/test/CodeGen/AMDGPU/fmuladd.f32.ll
llvm/test/CodeGen/AMDGPU/fneg-combines.ll
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fmed3.ll
llvm/test/CodeGen/AMDGPU/selectcc-opt.ll
llvm/test/CodeGen/AMDGPU/set-dx10.ll
llvm/test/CodeGen/X86/fp-denormals.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73978.253871.patch
Type: text/x-patch
Size: 66357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200331/6694ecac/attachment-0001.bin>
More information about the llvm-commits
mailing list