Tejas Belagod <[email protected]> writes:
> + /* This is big-endian-safe because the elements are kept in target
> + memory order. So, for eg. PARALLEL element value of 2 is the same in
> + either endian-ness. */
> + if (GET_CODE (src) == VEC_SELECT
> + && REG_P (XEXP (src, 0)) && REG_P (dst)
> + && REGNO (XEXP (src, 0)) == REGNO (dst))
> + {
> + rtx par = XEXP (src, 1);
> + int i;
> +
> + for (i = 0; i < XVECLEN (par, 0); i++)
> + {
> + rtx tem = XVECEXP (par, 0, i);
> + if (!CONST_INT_P (tem) || INTVAL (tem) != i)
> + return 0;
> + }
> + return 1;
> + }
> +
I think for big endian it needs to be:
INTVAL (tem) != i + base
where base is something like:
int base = GET_MODE_NUNITS (GET_MODE (XEXP (src, 0))) - XVECLEN (par, 0);
E.g. a big-endian V4HI looks like:
msb lsb
0000111122223333
and shortening it to say V2HI only gives the low 32 bits:
msb lsb
22223333
Thanks,
Richard