[X86][SSE] Avoid scalarization of v2i64 vector shifts
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 18 Mar 2015 19:35:31 +0000 (19:35 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 18 Mar 2015 19:35:31 +0000 (19:35 +0000)
commit0ee70a15540217d483dcabf9a32f5b6a76b8f352
treed9b9e88468a9553d957b5956dd42b2b89e4cd033
parentdb4d40136441a962913842d84ba4c49498855b39
[X86][SSE] Avoid scalarization of v2i64 vector shifts

Currently v2i64 vectors shifts (non-equal shift amounts) are scalarized, costing 4 x extract, 2 x x86-shifts and 2 x insert instructions - and it gets even more awkward on 32-bit targets.

This patch separately shifts the vector by both shift amounts and then shuffles the partial results back together, costing 2 x shuffles and 2 x sse-shifts instructions (+ 2 movs on pre-AVX hardware).

Note - this patch only improves the SHL / LSHR logical shifts as only these are supported in SSE hardware.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232660 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/vshift-4.ll
test/CodeGen/X86/x86-shifts.ll