[llvm] r279435 - [X86] Only accept SM_SentinelUndef (-1) as an undefined shuffle mask in range

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 01:40:42 PDT 2016


On 22 Aug 2016, at 16:34, Craig Topper <craig.topper at gmail.com> wrote:
> 
> Checking for any negative number results in slightly less code than an explicit comparison with -1 as it doesn't require an immediate.

True, but we need to make this only match the -1 Undef sentinel so we can safely use it target shuffle masks that include the -2 Zero sentinel as well.

> On Mon, Aug 22, 2016 at 6:18 AM, Simon Pilgrim via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> Author: rksimon
> Date: Mon Aug 22 08:18:56 2016
> New Revision: 279435
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=279435&view=rev <http://llvm.org/viewvc/llvm-project?rev=279435&view=rev>
> Log:
> [X86] Only accept SM_SentinelUndef (-1) as an undefined shuffle mask in range
> 
> As discussed on D23027 we should be trying to be more strict on what is an undefined mask value.
> 
> Modified:
>     llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> 
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=279435&r1=279434&r2=279435&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=279435&r1=279434&r2=279435&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 22 08:18:56 2016
> @@ -4201,7 +4201,7 @@ bool X86TargetLowering::hasAndNotCompare
>    return true;
>  }
> 
> -/// Val is either less than zero (undef) or equal to the specified value.
> +/// Val is the undef sentinel value or equal to the specified value.
>  static bool isUndefOrEqual(int Val, int CmpVal) {
>    return ((Val == SM_SentinelUndef) || (Val == CmpVal));
>  }
> @@ -4212,10 +4212,10 @@ static bool isUndefOrZero(int Val) {
>  }
> 
>  /// Return true if every element in Mask, beginning
> -/// from position Pos and ending in Pos+Size is undef.
> +/// from position Pos and ending in Pos+Size is the undef sentinel value.
>  static bool isUndefInRange(ArrayRef<int> Mask, unsigned Pos, unsigned Size) {
>    for (unsigned i = Pos, e = Pos + Size; i != e; ++i)
> -    if (0 <= Mask[i])
> +    if (Mask[i] != SM_SentinelUndef)
>        return false;
>    return true;
>  }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160823/3211a7bd/attachment.html>


More information about the llvm-commits mailing list