diff options
author | Tim Northover <tnorthover@apple.com> | 2014-04-18 12:50:58 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2014-04-18 12:50:58 +0000 |
commit | 7b4b522ec8d5b9fc947435f4eb15928aad2bce45 (patch) | |
tree | 43f1f1a8498f2ff820ac7361bc52a58a4fd3faf5 /lib | |
parent | f19e3273190e020c70a92724bd7a3af58c589cbf (diff) | |
download | llvm-7b4b522ec8d5b9fc947435f4eb15928aad2bce45.tar.gz llvm-7b4b522ec8d5b9fc947435f4eb15928aad2bce45.tar.bz2 llvm-7b4b522ec8d5b9fc947435f4eb15928aad2bce45.tar.xz |
AArch64/ARM64: improve spotting of EXT instructions from VECTOR_SHUFFLE.
We couldn't cope if the first mask element was UNDEF before, which
isn't ideal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206588 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM64/ARM64ISelLowering.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Target/ARM64/ARM64ISelLowering.cpp b/lib/Target/ARM64/ARM64ISelLowering.cpp index efd979b5e2..503e44b0dc 100644 --- a/lib/Target/ARM64/ARM64ISelLowering.cpp +++ b/lib/Target/ARM64/ARM64ISelLowering.cpp @@ -3945,11 +3945,13 @@ static bool isEXTMask(ArrayRef<int> M, EVT VT, bool &ReverseEXT, unsigned NumElts = VT.getVectorNumElements(); ReverseEXT = false; - // Assume that the first shuffle index is not UNDEF. Fail if it is. - if (M[0] < 0) - return false; - - Imm = M[0]; + // Look for the first non-undef choice and count backwards from + // that. E.g. <-1, -1, 3, ...> means that an EXT must start at 3 - 2 = 1. This + // guarantees that at least one index is correct. + const int *FirstRealElt = + std::find_if(M.begin(), M.end(), [](int Elt) { return Elt >= 0; }); + assert(FirstRealElt != M.end() && "Completely UNDEF shuffle? Why bother?"); + Imm = *FirstRealElt - (FirstRealElt - M.begin()); // If this is a VEXT shuffle, the immediate value is the index of the first // element. The other shuffle indices must be the successive elements after |