[X86] Teach 'getTargetShuffleMask' how to look through ISD::WrapperRIP when decoding...
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Fri, 8 May 2015 15:11:07 +0000 (15:11 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Fri, 8 May 2015 15:11:07 +0000 (15:11 +0000)
commit405e5f276bde439f0c100f542c5ed854a929f1d9
treef0c19d54d69b30c23774450b4f7dc9de80ba519c
parent5081399663dc354dce6b64f0e5890802b7ac1bbc
[X86] Teach 'getTargetShuffleMask' how to look through ISD::WrapperRIP when decoding a PSHUFB mask.

The function 'getTargetShuffleMask' already knows how to deal with PSHUFB nodes
where the mask node is a load from constant pool, and the constant pool node
is wrapped by a X86ISD::Wrapper node. This patch extends that logic by teaching
it how to also look through X86ISD::WrapperRIP.

This helps function combineX86ShufflesRecusively to combine more shuffle
sequences containing PSHUFB nodes if we are in RIPRel PIC mode.

Before this change, llc (with -relocation-model=pic -march=x86-64) was unable
to decode a pshufb where the mask was loaded from a constant pool. For example,
the no-op shuffle from test 'x86-fold-pshufb.ll' was not folded into its
operand, so instead of generating a single 'movaps' the backend always
generated a sub-optimal 'movdqa + pshufb' sequence.

Added test x86-fold-pshufb.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236863 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/x86-fold-pshufb.ll [new file with mode: 0644]