]> granicus.if.org Git - llvm/commit
[x86] narrow extract subvector of vector select
authorSanjay Patel <spatel@rotateright.com>
Fri, 7 Jun 2019 13:17:46 +0000 (13:17 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 7 Jun 2019 13:17:46 +0000 (13:17 +0000)
commit485262e3e559939d3c519685ec71cde116b8f0d7
tree50853c8bd421cd258f5a7e53b9fb581cd6039cf6
parent0ae4a51971eb97fe9b28891e83e4886e2527ec71
[x86] narrow extract subvector of vector select

This is a potentially large perf win for AVX1 targets because of the way we
auto-vectorize to 256-bit but then expect the backend to legalize/optimize
for the half-implemented AVX1 ISA.

On the motivating example from PR37428 (even though this patch doesn't solve
the vector shift issue):
https://bugs.llvm.org/show_bug.cgi?id=37428
...there's a 16% speedup when compiling with "-mavx" (perf tested on Haswell)
because we eliminate the remaining 256-bit vblendv ops.

I added comments on a couple of tests that require further work. If we have
256-bit logic ops separating the vselect and extract, we should probably narrow
everything to 128-bit, but that requires a larger pattern match.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362797 91177308-0d34-0410-b5e6-96231b3b80d8
25 files changed:
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/horizontal-reduce-smax.ll
test/CodeGen/X86/horizontal-reduce-smin.ll
test/CodeGen/X86/horizontal-reduce-umax.ll
test/CodeGen/X86/horizontal-reduce-umin.ll
test/CodeGen/X86/masked_store_trunc_ssat.ll
test/CodeGen/X86/masked_store_trunc_usat.ll
test/CodeGen/X86/midpoint-int-vec-256.ll
test/CodeGen/X86/psubus.ll
test/CodeGen/X86/uadd_sat_vec.ll
test/CodeGen/X86/usub_sat_vec.ll
test/CodeGen/X86/vector-reduce-smax-widen.ll
test/CodeGen/X86/vector-reduce-smax.ll
test/CodeGen/X86/vector-reduce-smin-widen.ll
test/CodeGen/X86/vector-reduce-smin.ll
test/CodeGen/X86/vector-reduce-umax-widen.ll
test/CodeGen/X86/vector-reduce-umax.ll
test/CodeGen/X86/vector-reduce-umin-widen.ll
test/CodeGen/X86/vector-reduce-umin.ll
test/CodeGen/X86/vector-trunc-packus-widen.ll
test/CodeGen/X86/vector-trunc-packus.ll
test/CodeGen/X86/vector-trunc-ssat-widen.ll
test/CodeGen/X86/vector-trunc-ssat.ll
test/CodeGen/X86/vector-trunc-usat-widen.ll
test/CodeGen/X86/vector-trunc-usat.ll