[PATCH] D112004: [SystemZ] Improve codegen for memset
Jonas Paulsson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 4 04:27:16 PDT 2021
jonpa updated this revision to Diff 384702.
jonpa added a comment.
Patch updated per suggenstion.
I tried to also avoid folding just Dest so that two registers would not be used when SrcDisp is 4095, like:
+ auto foldDisplIfNeeded = [&](MachineOperand &Base, uint64_t &Disp,
+ bool Force = false) -> void {
+ if (Disp > 0xfff || Force) {
...
+ if (DestDisp > 0xfff) {
+ // Make sure only one base register is used.
+ foldDisplIfNeeded(SrcBase, SrcDisp, true/*Force*/);
+ DestBase = SrcBase;
+ DestDisp = 1;
+ }
This however did not change benchmarks at all, so I removed it (it did however improve memset-01.ll:f17,f18...). I also tried generalizing this idea to all operations, but again there was no cases of this in benchmarks.
Also some other minor fixing:
- Changed the variable names in insertMemMemOp() to avoid using the same names already used (DestBase, SrcBase, ...)
- add ByteMO directly also with STC in insertMemMemOp() and make sure to call earlyUseOperand() to clear any kill flag.
- For the PFD I decided it was simplest to subtract IsMemset compared to using both ThisSrcReg and SrcDisp.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112004/new/
https://reviews.llvm.org/D112004
Files:
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
llvm/lib/Target/SystemZ/SystemZISelLowering.h
llvm/lib/Target/SystemZ/SystemZInstrFormats.td
llvm/lib/Target/SystemZ/SystemZInstrInfo.td
llvm/lib/Target/SystemZ/SystemZOperators.td
llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp
llvm/test/CodeGen/SystemZ/memset-01.ll
llvm/test/CodeGen/SystemZ/memset-02.ll
llvm/test/CodeGen/SystemZ/memset-04.ll
llvm/test/CodeGen/SystemZ/memset-07.ll
llvm/test/CodeGen/SystemZ/tail-call-mem-intrinsics.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112004.384702.patch
Type: text/x-patch
Size: 30830 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211104/6fc6fa94/attachment.bin>
More information about the llvm-commits
mailing list