[PATCH] D13988: [X86][SSE] Add general memory folding for (V)INSERTPS instruction

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 10:27:31 PDT 2015


RKSimon created this revision.
RKSimon added reviewers: qcolombet, filcab, andreadb, spatel.
RKSimon added a subscriber: llvm-commits.
RKSimon set the repository for this revision to rL LLVM.

This patch improves the memory folding of the inserted float element for the (V)INSERTPS instruction.

The existing implementation occurs in the DAGCombiner and relies on the narrowing of a whole vector load into a scalar load (into a vector) to then allow folding to occur later on. Not only has this proven problematic for debug builds, but it also prevents other memory folds (notably stack reloads) from happening.

This patch removes the old implementation and moves the folding code to the X86 foldMemoryOperand handler. A new private 'special case' function - foldMemoryOperandSpecial - has been added to deal with memory folding of instructions that can't just use the lookup tables (insertps is the first of several that could be done).

It also tweaks the memory operand folding code with an additional pointer offset that allows existing memory addresses to be modified, in this case to convert the vector address to the explicit address of the scalar element that will be inserted.

Unlike the previous implementation we now set the insertion source index to zero, this is ignored for the (V)INSERTPSrm version, so this mainly beneficial so shuffle decodes don't show a pointer offset.

Repository:
  rL LLVM

http://reviews.llvm.org/D13988

Files:
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86InstrInfo.cpp
  lib/Target/X86/X86InstrInfo.h
  test/CodeGen/X86/avx.ll
  test/CodeGen/X86/sse41.ll
  test/CodeGen/X86/stack-folding-fp-avx1.ll
  test/CodeGen/X86/stack-folding-fp-sse42.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13988.38145.patch
Type: text/x-patch
Size: 16011 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151022/8f6b2d06/attachment-0001.bin>


More information about the llvm-commits mailing list