On Tue, 27 Nov 2012, Richard Biener wrote:

On Mon, Nov 12, 2012 at 2:31 PM, Marc Glisse <marc.gli...@inria.fr> wrote:
Hello,

this patch lets us fold a bit_field_ref of a constructor even when the
elements are vectors. Writing a testcase is not that convenient because of
the lack of a dead code elimination pass after forwprop4 (RTL doesn't always
remove everything either), but I see a clear difference on this test on
x86_64 without AVX.

typedef double vec __attribute__((vector_size(4*sizeof(double))));
void f(vec*x){
  *x+=*x+*x;
}
double g(vec*x){
  return (*x+*x)[3];
}
void h(vec*x, double a, double b, double c, double d){
  vec y={a,b,c,d};
  *x+=y;
}


I don't know if the patch (assuming it is ok) is suitable for stage 3, it
may have to wait. It passes bootstrap+testsuite.

... on x86_64-linux-gnu, sorry for the lack of precision (default languages, Xeon E5520, graphite enabled).

I am still not quite sure why we even have a valid_gimple_rhs_p function
(after which we usually give up if it says no) instead of gimplifying, so I
may have missed a reason why CONSTRUCTOR or BIT_FIELD_REF shouldn't be ok.

Boostrapped and tested on ... ?

Ok if bootstrap / testing passes.

Thanks, I'll retest it to make sure it still works.

2012-11-12  Marc Glisse  <marc.gli...@inria.fr>

        * fold-const.c (fold_ternary_loc) [BIT_FIELD_REF]: Handle
        CONSTRUCTOR with vector elements.
        * tree-ssa-propagate.c (valid_gimple_rhs_p): Handle CONSTRUCTOR
        and BIT_FIELD_REF.

--
Marc Glisse

Reply via email to