[X86] Teach the backend how to fold target specific dag node for packed
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Sat, 28 Dec 2013 11:11:52 +0000 (11:11 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Sat, 28 Dec 2013 11:11:52 +0000 (11:11 +0000)
commit6ec3395335addb3d352881d84a93cae8a235af95
tree2247fdacb179150567ab6f25a3d6360ba9f377ea
parent14b42a1c92b47bced8e6b94a0213a8970d1c0edd
[X86] Teach the backend how to fold target specific dag node for packed
vector shift by immedate count (VSHLI/VSRLI/VSRAI) into a build_vector when
the vector in input to the shift is a build_vector of all constants or UNDEFs.

Target specific nodes for packed shifts by immediate count are in
general introduced by function 'getTargetVShiftByConstNode' (in
X86ISelLowering.cpp) when lowering shift operations, SSE/AVX immediate
shift intrinsics and (only in very few cases) SIGN_EXTEND_INREG dag
nodes.

This patch adds extra rules for simplifying vector shifts inside
function 'getTargetVShiftByConstNode'.

Added file test/CodeGen/X86/vec_shift5.ll to verify that packed
shifts by immediate are correctly folded into a build_vector when the
input vector to the shift dag node is a vector of constants or undefs.

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