[PATCH] D28747: [X86] Don't create VBROADCAST nodes with 256-bit or 512-bit input types

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 15 11:50:58 PST 2017


craig.topper created this revision.
craig.topper added reviewers: delena, zvi, RKSimon.
craig.topper added a subscriber: llvm-commits.

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.


https://reviews.llvm.org/D28747

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28747.84497.patch
Type: text/x-patch
Size: 8000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170115/db0b219b/attachment.bin>


More information about the llvm-commits mailing list