[X86] SRL non-LSB extracts when folding to truncating broadcasts.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Fri, 6 Nov 2015 23:16:43 +0000 (23:16 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Fri, 6 Nov 2015 23:16:43 +0000 (23:16 +0000)
commit3ba3c016463bc5a8e506aa06df9d08236cbf6f31
treefcab36c7e04c7602ec3691f0d1bdbd564a51bcd8
parentb1769420b8b081bfa3fe41555b78a9d57264b641
[X86] SRL non-LSB extracts when folding to truncating broadcasts.

Now that we recognize this, we can support it instead of bailing out.
That is, we can fold:
  (v8i16 (shufflevector
    (v8i16 (bitcast (v4i32 (build_vector X, Y, ...)))),
    <1,1,...,1>))
into:
  (v8i16 (vbroadcast (i16 (trunc (srl Y, 16)))))

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252362 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/vector-shuffle-128-v16.ll
test/CodeGen/X86/vector-shuffle-128-v8.ll
test/CodeGen/X86/vector-shuffle-256-v16.ll
test/CodeGen/X86/vector-shuffle-256-v32.ll