[PATCH] [ARM64]Fix a bug when lowing shuffle vector to EXT instruction

Tim Northover t.p.northover at gmail.com
Mon Apr 28 02:37:25 PDT 2014


Hi Hao,

> BTW, there is a minor issue for this line
>     "Imm = ExpectedElt;"
> It is only true when there is UNDEF in the beginning. If the mask starts from non-undef index, it should be
>     "Imm = M[0]"
> For example, "shuffle V0, V1, <6, 7, 0, 1>" (V0, V1 are vectors of 4 elements), Imm should be "6" not "2".

Ah yes, I see. Well spotted! Actually, doesn't that apply even if M[0]
*is* -1: <-1 7, 0, 1> say? I think I'd been assuming the mask was 2 *
NumElts long for some reason.

So the logic we really want is to count back from *FirstRealElt.
Either of these look like they'd work:
1. *FirstRealElt - (FirstRealElt - M.begin())
2. ExpectedElt - NumElts

Cheers.

Tim.



More information about the llvm-commits mailing list