This is the mail archive of the
mailing list for the GCC project.
Re: Patch: IA64 inline integer division
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: rth at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 9 Mar 2004 15:15:55 -0800 (PST)
- Subject: Re: Patch: IA64 inline integer division
> 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.