On Sun, May 12, 2013 at 02:04:52PM +0200, Marc Glisse wrote:
> this patch passes bootstrap+testsuite on x86_64-linux-gnu. When
> moving uniform_vector_p, I only added the gcc_assert. Note that the
> fold_binary patch helps for constant vectors, but not for {n,n,n,n},
> which will require some help in forwprop for instance. This
> transformation is already done by the vector lowering pass, but
> that's too late in my opinion.
>
> 2013-05-13 Marc Glisse <[email protected]>
>
> gcc/
> * tree-vect-generic.c (uniform_vector_p): Move ...
> * tree.c (uniform_vector_p): ... here.
> * tree.h (uniform_vector_p): Declare it.
> * fold-const.c (fold_binary_loc) <shift>: Turn the second argument
> into a scalar.
>
> gcc/testsuite/
> * gcc.dg/vector-shift-2.c: New testcase.
The testcase is UNSUPPORTED everywhere, because ccp1 dump isn't produced at
-O0. Did you mean to add -O2 (or -O or -O3 etc.) to dg-options?
> --- gcc/testsuite/gcc.dg/vector-shift-2.c (revision 0)
> +++ gcc/testsuite/gcc.dg/vector-shift-2.c (revision 0)
> @@ -0,0 +1,13 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fdump-tree-ccp1" } */
> +
> +typedef unsigned vec __attribute__ ((vector_size (16)));
> +void
> +f (vec *a)
> +{
> + vec s = { 5, 5, 5, 5 };
> + *a = *a << s;
> +}
> +
> +/* { dg-final { scan-tree-dump "<< 5" "ccp1" } } */
> +/* { dg-final { cleanup-tree-dump "ccp1" } } */
Jakub