OSDN Git Service

[x86] eliminate even more sign-bit tests with vector select
authorSanjay Patel <spatel@rotateright.com>
Wed, 13 Jun 2018 12:28:32 +0000 (12:28 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 13 Jun 2018 12:28:32 +0000 (12:28 +0000)
commit81eac77ab10767bfbdc7c413a07a4d8a0ae9b80f
treea2f6b2906a30950352069cfaa4728a6a55e690b4
parentd4b322beffb45fa6d2902fdce2010dda432a7cb0
[x86] eliminate even more sign-bit tests with vector select

This shortcoming was noted in D47330, and the test diffs show we already
had other examples where we failed to fold to a SHRUNKBLEND:

/// Dynamic (non-constant condition) vector blend where only the sign bits
/// of the condition elements are used. This is used to enforce that the
/// condition mask is not valid for generic VSELECT optimizations.

This patch implements an idea from D48043 and would obsolete that patch
because it catches more cases (notable the AVX1 case that was missed there).
All we're doing is allowing the existing transform to fire more often by
removing the post-legalize constraint. All of the relevant feature checks
and other predicates are left as-is.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334592 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/vsel-cmp-load.ll
test/CodeGen/X86/vselect-pcmp.ll