[PATCH] D59522: [X86] Don't avoid folding multiple use sign extended 8-bit immediate into instructions under optsize.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 16:58:35 PDT 2019


craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon.

Under optsize we try to avoid folding immediates into instructions under optsize. But if the immediate is 16-bits or 32 bits, but can be encoded as an 8-bit immediate we don't save enough from disabling the folding unless the immediate has enough uses to make up for the size of the move which is either 3 bytes or 5 bytes since there are no sign extended 8-bit moves. We would also save something if the immediate was a live out of the basic block and thus a move was unavoidable, but that would require a more advanced heuristic than just counting uses.

Note we only avoid folding multiple use immediates into the patterns that use X86ISD::ADD/SUB/XOR/OR/AND/CMP/ADC/SBB nodes and not the more common ISD::ADD/SUB/XOR/OR/AND nodes.


https://reviews.llvm.org/D59522

Files:
  lib/Target/X86/X86InstrArithmetic.td
  lib/Target/X86/X86InstrCompiler.td
  lib/Target/X86/X86InstrInfo.td
  test/CodeGen/X86/immediate_merging.ll
  test/CodeGen/X86/immediate_merging64.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59522.191211.patch
Type: text/x-patch
Size: 4083 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190318/e709cfd4/attachment.bin>


More information about the llvm-commits mailing list