OSDN Git Service

[X86] Don't create VBROADCAST nodes with 256-bit or 512-bit input types
authorCraig Topper <craig.topper@gmail.com>
Wed, 15 Feb 2017 06:58:47 +0000 (06:58 +0000)
committerCraig Topper <craig.topper@gmail.com>
Wed, 15 Feb 2017 06:58:47 +0000 (06:58 +0000)
commit53bbf700f8d99102aac132d85ab4ab866b1b0ac6
tree7f4b188241435c12ee90efd9af1d4723812d49a6
parentfc3e8436201537bbd694e1990f3b0a6a88017c73
[X86] Don't create VBROADCAST nodes with 256-bit or 512-bit input types

Summary:
We don't seem to have great rules on what a valid VBROADCAST node looks like. And as a consequence we end up with a lot of patterns to try to catch everything. We have patterns with scalar inputs, 128-bit vector inputs, 256-bit vector inputs, and 512-bit vector inputs.

As you can see from the things improved here we are currently missing patterns for 128-bit loads being extended to 256-bit before the vbroadcast.

I'd like to propose that VBROADCAST should always take a 128-bit vector type as input. As a first step towards that this patch adds an EXTRACT_SUBVECTOR in front of VBROADCAST when the input is 256 or 512-bits. In the future I would like to add scalar_to_vector around all the scalar operations. And maybe we should consider adding a VBROADCAST+load node to avoid separating loads from the broadcasting operation when the load itself isn't foldable.

This requires an additional change in target shuffle combining to look for the extract subvector and look through it to find the original operand. I'm sure this change isn't perfect but was enough to fix a few test failures that were being caused.

Another interesting thing I noticed is that the changes in masked_gather_scatter.ll show cases were we don't remove a useless insert into element 1 before broadcasting element 0.

Reviewers: delena, RKSimon, zvi

Reviewed By: zvi

Subscribers: igorb, llvm-commits

Differential Revision: https://reviews.llvm.org/D28747

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295155 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/masked_gather_scatter.ll
test/CodeGen/X86/vector-shuffle-avx512.ll
test/CodeGen/X86/widened-broadcast.ll