Re: [PATCH] widening_mul: Do cost check when propagating mult into plus/minus expressions

2011-07-15 Thread Andreas Krebbel
On 07/14/2011 11:40 AM, Richard Guenther wrote: > (look how the vectorizer > for example uses new target hooks instead of generating vectorized RTL > and then using rtx_cost). But wouldn't we then end up with just a bunch of special purpose tree_cost functions again?! Then we would again be doome

Re: [PATCH] widening_mul: Do cost check when propagating mult into plus/minus expressions

2011-07-14 Thread Steven Bosscher
On Thu, Jul 14, 2011 at 11:40 AM, Richard Guenther wrote: > Generating RTL from GIMPLE passes just to be able to use rtx_cost is, > well ... gross. Indeed. And it is one of the major blockers for fully separating the RTL, GIMPLE and target code off into separate modules. It would be great to get

Re: [PATCH] widening_mul: Do cost check when propagating mult into plus/minus expressions

2011-07-14 Thread Andreas Krebbel
On Wed, Jul 13, 2011 at 09:58:08AM -0700, Richard Henderson wrote: > Why the force_operand? You've got register inputs. Either the target > is going to support the operation or it isn't. I agree that it doesn't seem to be necessary. I've used force_operand since ivopts (add_cost) is doing it wit

Re: [PATCH] widening_mul: Do cost check when propagating mult into plus/minus expressions

2011-07-14 Thread Richard Guenther
On Wed, Jul 13, 2011 at 11:49 PM, Steven Bosscher wrote: > On Wed, Jul 13, 2011 at 4:34 PM, Richard Guenther > wrote: >> On Wed, Jul 13, 2011 at 3:13 PM, Andreas Krebbel >> wrote: >>> Hi, >>> >>> the widening_mul pass might increase the number of multiplications in >>> the code by transforming >

Re: [PATCH] widening_mul: Do cost check when propagating mult into plus/minus expressions

2011-07-14 Thread Andreas Krebbel
On 07/13/2011 06:58 PM, Richard Henderson wrote: > Why the force_operand? You've got register inputs. Either the target > is going to support the operation or it isn't. > Seems to me you can check the availability of the operation in the > optab and pass that gen_rtx_fmt_ee result to rtx_cost di

Re: [PATCH] widening_mul: Do cost check when propagating mult into plus/minus expressions

2011-07-14 Thread Andreas Krebbel
On 07/13/2011 04:34 PM, Richard Guenther wrote: > On Wed, Jul 13, 2011 at 3:13 PM, Andreas Krebbel > wrote: >> Hi, >> >> the widening_mul pass might increase the number of multiplications in >> the code by transforming >> >> a = b * c >> d = a + 2 >> e = a + 3 >> >> into: >> >> d = b * c + 2 >> e

Re: [PATCH] widening_mul: Do cost check when propagating mult into plus/minus expressions

2011-07-13 Thread Steven Bosscher
On Wed, Jul 13, 2011 at 4:34 PM, Richard Guenther wrote: > On Wed, Jul 13, 2011 at 3:13 PM, Andreas Krebbel > wrote: >> Hi, >> >> the widening_mul pass might increase the number of multiplications in >> the code by transforming >> >> a = b * c >> d = a + 2 >> e = a + 3 >> >> into: >> >> d = b * c

Re: [PATCH] widening_mul: Do cost check when propagating mult into plus/minus expressions

2011-07-13 Thread Richard Henderson
On 07/13/2011 06:13 AM, Andreas Krebbel wrote: > + force_operand (gen_rtx_fmt_ee (code, mode, > +gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 1), > +gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 2)), > + NULL_RTX); > + break; > + c

Re: [PATCH] widening_mul: Do cost check when propagating mult into plus/minus expressions

2011-07-13 Thread Georg-Johann Lay
Richard Guenther wrote: > On Wed, Jul 13, 2011 at 3:13 PM, Andreas Krebbel > wrote: >> Hi, >> >> the widening_mul pass might increase the number of multiplications in >> the code by transforming >> >> a = b * c >> d = a + 2 >> e = a + 3 >> >> into: >> >> d = b * c + 2 >> e = b * c + 3 >> >> under

Re: [PATCH] widening_mul: Do cost check when propagating mult into plus/minus expressions

2011-07-13 Thread Richard Guenther
On Wed, Jul 13, 2011 at 3:13 PM, Andreas Krebbel wrote: > Hi, > > the widening_mul pass might increase the number of multiplications in > the code by transforming > > a = b * c > d = a + 2 > e = a + 3 > > into: > > d = b * c + 2 > e = b * c + 3 > > under the assumption that an FMA instruction is n

[PATCH] widening_mul: Do cost check when propagating mult into plus/minus expressions

2011-07-13 Thread Andreas Krebbel
Hi, the widening_mul pass might increase the number of multiplications in the code by transforming a = b * c d = a + 2 e = a + 3 into: d = b * c + 2 e = b * c + 3 under the assumption that an FMA instruction is not more expensive than a simple add. This certainly isn't always true. While e.g