This is the mail archive of the
mailing list for the GCC project.
IA64 HP-UX patch for integer division
- From: Steve Ellcey <sje at hpsje dot cup dot hp dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 9 Nov 2006 10:12:50 -0800 (PST)
- Subject: IA64 HP-UX patch for integer division
- Reply-to: sje at cup dot hp dot com
The IA64 HP-UX platform currently uses the libgcc integer division
routines. This patch is to change it to use the HP provided millicode
routines. There is no significant performance improvement here, using
SPEC2000 integer tests, 6 tests were faster by around 1% and 6 were
slower by around 1%. The bigger reason for doing this is that using
millicode routines instead of libgcc routines makes it easier to mix and
match objects compiled with GCC and with the HP compiler (because the
GCC objects are less likely to need libgcc routines linked in).
I did hack GCC to see if using the SImode integer division routines from
the HP millicode library (with their non-standard calling convention
that requires DImode arguments) would help performance but it didn't
make much of a difference so I think the cleaner solution is to just
skip the SImode versions and use the DImode versions only.
Tested with no regressions, I will check in later today.
2006-11-09 Steve Ellcey <firstname.lastname@example.org>
* config/ia64/ia64.c (ia64_hpux_init_libfuncs): Use HP-UX millicode
routines for integer division.
--- config/ia64/ia64.c (revision 118609)
+++ config/ia64/ia64.c (working copy)
@@ -9272,6 +9272,22 @@ ia64_hpux_init_libfuncs (void)
+ /* The HP SI millicode division and mod functions expect DI arguments.
+ By turning them off completely we avoid using both libgcc and the
+ non-standard millicode routines and use the HP DI millicode routines
+ instead. */
+ set_optab_libfunc (sdiv_optab, SImode, 0);
+ set_optab_libfunc (udiv_optab, SImode, 0);
+ set_optab_libfunc (smod_optab, SImode, 0);
+ set_optab_libfunc (umod_optab, SImode, 0);
+ set_optab_libfunc (sdiv_optab, DImode, "__milli_divI");
+ set_optab_libfunc (udiv_optab, DImode, "__milli_divU");
+ set_optab_libfunc (smod_optab, DImode, "__milli_remI");
+ set_optab_libfunc (umod_optab, DImode, "__milli_remU");
+ /* HP-UX libc has TF min/max/abs routines in it. */
set_optab_libfunc (smin_optab, TFmode, "_U_Qfmin");
set_optab_libfunc (smax_optab, TFmode, "_U_Qfmax");
set_optab_libfunc (abs_optab, TFmode, "_U_Qfabs");