[X86] Relax assert in broadcast-of-subvector lowering.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Wed, 5 Apr 2017 00:14:39 +0000 (00:14 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Wed, 5 Apr 2017 00:14:39 +0000 (00:14 +0000)
commitec8b1fb5398f57b233e6b07bf5f3cc8a57e94ba0
treeb87a6b7820e4e74d2af69016ff6b73a2d4b9c335
parent9645a6290a983ec0d34e8d82f6b1044a71766996
[X86] Relax assert in broadcast-of-subvector lowering.

Before r294774, there was a problem when lowering broadcasts to use
128-bit subvectors.

When we looked through a bitcast to find the broadcast input, we'd keep
using the original type, so you'd end up with things like:
  (v8f32 (broadcast
    (v4f32 (extract_subvector
      (v8i32 V),
      ...))
    ))

r294774 fixed it to always emit subvectors with the scalar type of the
original source.

It also introduced some asserts, to check that we use scalars with
the same size, and vectors with the same number of elements.

The scalar size equality is checked earlier when looking through bitcasts,
and is a useful assert.

However, the number of elements don't have to be identical: we're always
going to extract a 128-bit subvector, and we can have different size
inputs if we looked through a concat_vector to find a 256-bit source.

Relax the overzealous assert.

Replace it with a check of the original source vector being 256 or 512
bits.  If it's 128 bits, we can't extract_subvector from it.

Fixes PR32371.

llvm-svn: 299490
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll
llvm/test/CodeGen/X86/vector-shuffle-512-v8.ll