[X86][SSE] Improve support for 128-bit vector sign extension
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 21 May 2015 10:05:03 +0000 (10:05 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 21 May 2015 10:05:03 +0000 (10:05 +0000)
commit87d1836793831974f4dc1b1e030b37d43beba223
tree8603403f38264cb10699581c004e17eaffff1afd
parentcebe8f8b05cb598e716a1b63088372bb83b64bb7
[X86][SSE] Improve support for 128-bit vector sign extension

This patch improves support for sign extension of the lower lanes of vectors of integers by making use of the SSE41 pmovsx* sign extension instructions where possible, and optimizing the sign extension by shifts on pre-SSE41 targets (avoiding the use of i64 arithmetic shifts which require scalarization).

It converts SIGN_EXTEND nodes to SIGN_EXTEND_VECTOR_INREG where necessary, that more closely matches the pmovsx* instruction than the default approach of using SIGN_EXTEND_INREG which splits the operation (into an ANY_EXTEND lowered to a shuffle followed by shifts) making instruction matching difficult during lowering. Necessary support for SIGN_EXTEND_VECTOR_INREG has been added to the DAGCombiner.

Differential Revision: http://reviews.llvm.org/D9848

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237885 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/pr15267.ll
test/CodeGen/X86/vec_cast2.ll
test/CodeGen/X86/vector-sext.ll
test/CodeGen/X86/vselect-avx.ll