]> granicus.if.org Git - llvm/commit
[X86] Add DAG combine to turn (vzmovl (insert_subvector undef, X, 0)) into (insert_su...
authorCraig Topper <craig.topper@intel.com>
Fri, 21 Jun 2019 19:10:21 +0000 (19:10 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 21 Jun 2019 19:10:21 +0000 (19:10 +0000)
commit182a55caf2398cac7b0e280a54fe15963816db66
tree08f4c46819a6e676df8299d747b3a3ce128af7a0
parent8a705c0b85fcd9dd2a5f260d09327b3377d6f6a6
[X86] Add DAG combine to turn (vzmovl (insert_subvector undef, X, 0)) into (insert_subvector allzeros, (vzmovl X), 0)

128/256 bit scalar_to_vectors are canonicalized to (insert_subvector undef, (scalar_to_vector), 0). We have isel patterns that try to match this pattern being used by a vzmovl to use a 128-bit instruction and a subreg_to_reg.

This patch detects the insert_subvector undef portion of this and pulls it through the vzmovl, creating a narrower vzmovl and an insert_subvector allzeroes. We can then match the insertsubvector into a subreg_to_reg operation by itself. Then we can fall back on existing (vzmovl (scalar_to_vector)) patterns.

Note, while the scalar_to_vector case is the motivating case I didn't restrict to just that case. I'm also wondering about shrinking any 256/512 vzmovl to an extract_subvector+vzmovl+insert_subvector(allzeros) but I fear that would have bad implications to shuffle combining.

I also think there is more canonicalization we can do with vzmovl with loads or scalar_to_vector with loads to create vzload.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364095 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86InstrAVX512.td
lib/Target/X86/X86InstrSSE.td
test/CodeGen/X86/avx-load-store.ll
test/CodeGen/X86/vec_extract-avx.ll
test/CodeGen/X86/vector-shuffle-256-v4.ll