Re: [PATCH] Fix MINUS_EXPR vect reduction handling (PR tree-optimization/54877)

2012-10-10 Thread Jakub Jelinek
On Wed, Oct 10, 2012 at 10:42:10AM +0200, Richard Biener wrote: > Ah, no, make_ssa_name (TREE_TYPE (rhs), NULL) is even better. On > the 4.7 branch you need to create a new temp var ... Ok, here is what I've committed to trunk after bootstrap/regtest: 2012-10-10 Jakub Jelinek PR tree

Re: [PATCH] Fix MINUS_EXPR vect reduction handling (PR tree-optimization/54877)

2012-10-10 Thread Jakub Jelinek
On Wed, Oct 10, 2012 at 10:42:10AM +0200, Richard Biener wrote: > Yeah, I meant we can negate all constants by doing > > tem = - CONSTANT; Yeah, that is what I meant. tem = - INT_MIN; is undefined overflow. > > right? Or wait ... even if we have > > red = x - y; > > if y is INT_MIN then t

Re: [PATCH] Fix MINUS_EXPR vect reduction handling (PR tree-optimization/54877)

2012-10-10 Thread Richard Biener
On Wed, 10 Oct 2012, Jakub Jelinek wrote: > On Wed, Oct 10, 2012 at 10:21:59AM +0200, Richard Biener wrote: > > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > > > Err, why? Can't we negate a constant, too? > > Not all of them, say INT_MIN can't be negated. > Though,

Re: [PATCH] Fix MINUS_EXPR vect reduction handling (PR tree-optimization/54877)

2012-10-10 Thread Jakub Jelinek
On Wed, Oct 10, 2012 at 10:21:59AM +0200, Richard Biener wrote: > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > Err, why? Can't we negate a constant, too? Not all of them, say INT_MIN can't be negated. Though, int foo (int n) { int i, d; for (i = 0, d = 0; i < n;

Re: [PATCH] Fix MINUS_EXPR vect reduction handling (PR tree-optimization/54877)

2012-10-10 Thread Richard Biener
On Wed, 10 Oct 2012, Jakub Jelinek wrote: > Hi! > > As the testcase shows, a REAL_CST can appear in MINUS_EXPR as second operand > (that is not canonicalized to PLUS_EXPR of negated value, unlike integer > constants (with exception of minimum value)). The following patch handles > constants ther

[PATCH] Fix MINUS_EXPR vect reduction handling (PR tree-optimization/54877)

2012-10-09 Thread Jakub Jelinek
Hi! As the testcase shows, a REAL_CST can appear in MINUS_EXPR as second operand (that is not canonicalized to PLUS_EXPR of negated value, unlike integer constants (with exception of minimum value)). The following patch handles constants there and punts if it isn't SSA_NAME or a constant that can