This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/51074] No constant folding performed for VEC_PERM_EXPR, VEC_INTERLEAVE*EXPR, VEC_EXTRACT*EXPR


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51074

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-10 13:59:26 UTC ---
(In reply to comment #3)
> Created attachment 25784 [details]
> gcc47-pr51074.patch
> 
> Folding patch.  For __builtin_shuffle it works well.

Looks good.

> For the interleaved stores of addresses like:
> char *a[1024];
> extern char b[];
> 
> void
> foo ()
> {
>   int i;
>   for (i = 0; i < 1024; i += 16)
>     {
>       a[i] = b + 1;
>       a[i + 15] = b + 2;
>       a[i + 1] = b + 3;
>       a[i + 14] = b + 4;
>       a[i + 2] = b + 5;
>       a[i + 13] = b + 6;
>       a[i + 3] = b + 7;
>       a[i + 12] = b + 8;
>       a[i + 4] = b + 9;
>       a[i + 11] = b + 10;
>       a[i + 5] = b + 11;
>       a[i + 10] = b + 12;
>       a[i + 6] = b + 13;
>       a[i + 9] = b + 14;
>       a[i + 7] = b + 15;
>       a[i + 8] = b + 16;
>     }
> }
> 
> it doesn't help, I'd need to do something like:
> --- tree-ssa-propagate.c.jj 2011-09-29 14:25:46.000000000 +0200
> +++ tree-ssa-propagate.c 2011-11-10 14:33:55.923268422 +0100
> @@ -610,6 +610,8 @@ valid_gimple_rhs_p (tree expr)
>        return false;
> 
>      case tcc_exceptional:
> +      if (code == CONSTRUCTOR && TREE_CODE (TREE_TYPE (expr)) == VECTOR_TYPE)
> +        break;
>        if (code != SSA_NAME)
>          return false;
>        break;
> 
> but that isn't helpful either (because it puts the vector CONSTRUCTOR inside of
> loop and thus prevents vectorization - is expanded piecewise).

Still the above is a good thing anyway - it is a valid gimple RHS after all.
Loop IM should be able to hoist the constructor - why doesn't it do that?
(PRE, too)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]