Patch: IA64 inline integer division

Steve Ellcey sje@cup.hp.com
Tue Mar 9 23:15:00 GMT 2004


> On Tue, Mar 09, 2004 at 11:42:04AM -0800, Steve Ellcey wrote:
> > This patch fixes both problems by replacing a memory load of a floating
> > point constant with an immediate integer load and a setf_exp_xf
> > instruction.  This is faster and matches what the __divsi, etc.
> > functions already do in libgcc.
> 
> Please explain what would cause the incorrect results.

OK, after pushing some bits around to figure out the exact difference,
I see that the constant used in the libgcc version (that works) is
-(2^-34) and the constant used in the inline version (broken) uses
+(2^-34).  Otherwise the two algorithms look identical.

> If this is so much of a real speedup, then we should arrange
> for this transformation to happen for all fp constants.

You're right.  I hadn't thought about the more general case but a 'load
immediate' into a general register followed by a setf into a floating
point register is probably always going to be faster then a load from
memory.  That seems to be what the HP compiler does.  I'll look into
this some more.

Meanwhile I would still like to check this change in.

Steve Ellcey
sje@cup.hp.com



More information about the Gcc-patches mailing list