[PATCH] D147800: [SystemZ] Enable MachineCombiner for FP reassociation.
Jonas Paulsson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 2 03:31:43 PDT 2023
jonpa updated this revision to Diff 518670.
jonpa added a comment.
- Using a pseudo reg/reg that pretends to clobber CC to simplify the later reg/mem folding. This seems to work well.
- Handling all floating point add, sub and mul, which are the set of operations that depend on the reassociable/nsz flags.
- Having scheduler info for the _CCPseudo:s turned out to be important as MachineCombiner looks at the latencies.
- New target hook "processFunctionAfterPeepholeOpt()", which lets target do any post-processing after peephole optimizations. This is needed in order to substitute the _CCPseudo instructions that did not get optimized (into reg/mem), with the target instruction without the CC operand.
- Using a pattern for selecting the _CCPseudo instructions instead of doing it manually in select(). This change made it obvious that the NoFPExcept flag is to be added here, which the pattern based selector does. This looks ok to me, but not quite sure if it would make more sense to instead predicate the reg/mem patterns or not.
FMin, FMax and the integer instructions are the remaining instructions that need to be handled.
Preliminary benchmarking looks good - lbm improved another percent with the subtractions (now 21% improvement).
I have not yet looked further into any effects of this way of doing the instruction selection with later peephole folding of loads. One thing I noticed is some cases where MDEBR is not used, instead WLDEB + WFMDB. It seems two separate instructions is slower in this case. Not sure if it would be worth handling that in processFunctionAfterPeepholeOpt(), or if perhaps just not handling those cases with reassociation (relatively few cases):
main <> patched
mdebr : 170 16 -154
wldeb : 661 793 +132
ldebr : 8803 8790 -13
ldeb : 5599 5596 -3
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147800/new/
https://reviews.llvm.org/D147800
Files:
llvm/include/llvm/CodeGen/TargetInstrInfo.h
llvm/lib/CodeGen/PeepholeOptimizer.cpp
llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
llvm/lib/Target/SystemZ/SystemZInstrFormats.td
llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
llvm/lib/Target/SystemZ/SystemZInstrInfo.h
llvm/lib/Target/SystemZ/SystemZInstrVector.td
llvm/lib/Target/SystemZ/SystemZOperators.td
llvm/lib/Target/SystemZ/SystemZPatterns.td
llvm/lib/Target/SystemZ/SystemZScheduleZ13.td
llvm/lib/Target/SystemZ/SystemZScheduleZ14.td
llvm/lib/Target/SystemZ/SystemZScheduleZ15.td
llvm/lib/Target/SystemZ/SystemZScheduleZ16.td
llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/lib/Target/X86/X86InstrInfo.h
llvm/test/CodeGen/SystemZ/machine-combiner-reassoc-fp.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147800.518670.patch
Type: text/x-patch
Size: 57826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230502/d96ffc12/attachment.bin>
More information about the llvm-commits
mailing list