On Fri, Jun 21, 2013 at 12:53 AM, Alan Modra <amo...@gmail.com> wrote:
> A number of places in the rs6000 backend assume the value for a vec
> splat can be found at element nunits-1 of a vector constant, which is
> wrong for little-endian.  This patch fixes them and the ICE found
> when running altivec-consts.c on powerpc64le.
>
> I've also updated the testcase so that it passes for little-endian.
> vspltish() and vspltisw() don't do the right thing little-endian, nor
> is it easy to make the function work.  Consider
>   v16qi v = { 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15 };
>   vspltish (w, 15);
> vs
>   v8hi v = { 15, 15, 15, 15, 15, 15, 15, 15 };
>   vspltish (w, 15);
> So rather than write two or three variants to build constants the
> right way, I just simply use static arrays.  I've also added a
> scan-assembler-not to make sure none of the vector constants are
> loaded from memory, and a new test that has constants appropriate for
> little-endian optimisation.
>
> Bootstrapped and regression tested powerpc64-linux.  OK for mainline
> and 4.8?
>
> gcc/
>         * config/rs6000/rs6000.c (vspltis_constant): Correct for 
> little-endian.
>         (gen_easy_altivec_constant): Likewise.
>         * config/rs6000/predicates.md (easy_vector_constant_add_self,
>         easy_vector_constant_msb): Likewise.
> gcc/testsuite/
>         * gcc.target/powerpc/altivec-consts.c: Correct for little-endian.
>         Add scan-assembler-not "lvx".
>         * gcc.target/powerpc/le-altivec-consts.c: New.

Okay.

Thanks, David

Reply via email to