[PATCH] D37139: [x86] Extend the manual ISel of `add` and `sub` with both RMW memory operands and used flags to support matching immediate operands.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 05:02:07 PDT 2017


chandlerc created this revision.
Herald added subscribers: mcrosier, sanjoy.

This is a bit trickier than register operands, and we still want to fall
back on a register operands even for things that appear to be
"immediates" when they won't actually select into the operation's
immediate operand. This also requires us to handle things like selecting
`sub` vs. `add` to minimize the number of bits needed to represent the
immediate, and picking the shortest immediate encoding.

The end result seems very nice though, and we're now generating
optimal instruction sequences for these patterns IMO.

A follow-up patch will further expand this to other operations with RMW
memory operands. But handing `add` and `sub` are useful starting points
to flesh out the machinery and make sure interesting and complex cases
can be handled.

Depends on https://reviews.llvm.org/D37130.


https://reviews.llvm.org/D37139

Files:
  lib/Target/X86/X86ISelDAGToDAG.cpp
  test/CodeGen/X86/add.ll
  test/CodeGen/X86/fold-rmw-ops.ll
  test/CodeGen/X86/peephole-na-phys-copy-folding.ll
  test/CodeGen/X86/pr32659.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37139.112679.patch
Type: text/x-patch
Size: 38317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170825/bfea9a76/attachment.bin>


More information about the llvm-commits mailing list