[X86] Determine if target shuffle can contain zero elements
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 6 Jan 2016 23:24:40 +0000 (23:24 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 6 Jan 2016 23:24:40 +0000 (23:24 +0000)
commit0cf42872621a2f0f4bf36da2e2f2c668981b40a9
tree70fbdb0c7bff51c96fdda3db5bc0c1d8934efcbb
parent72788bf2e7b5d48ecc690478cbacc3dbb6c6b1a8
[X86] Determine if target shuffle can contain zero elements

getTargetShuffleMask may return shuffle masks with SM_SentinelZero (-2) values (currently just for PSHUFB but VPERM2X128 as well with this patch). Although some calling functions can make use of this (mainly for shuffle combining), others can not and their inclusion makes shuffle mask comparisons more difficult.

This patch adds a flag to getTargetShuffleMask to indicate if the calling function can't handle SM_SentinelZero; getTargetShuffleMask will then return false if it occurs to make handling much easier.

I've tidied up some uses of getTargetShuffleMask to better indicate what is going on - more could be done but at present I don't have test cases to demonstrate it.

Some upcoming patches will make use of this to both support more uses where SM_SentinelZero is not permitted (e.g. combineShuffleToAddSub), and also will allow us to add INSERTPS support to getTargetShuffleMask as part of better zero handling discussed in D14261.

Differential Revision: http://reviews.llvm.org/D15378

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256992 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp