This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

IA64 HP-UX patch for integer division


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.

Steve Ellcey
sje@cup.hp.com

2006-11-09  Steve Ellcey  <sje@cup.hp.com>

	* config/ia64/ia64.c (ia64_hpux_init_libfuncs):  Use HP-UX millicode
	routines for integer division.

Index: config/ia64/ia64.c
===================================================================
--- config/ia64/ia64.c	(revision 118609)
+++ config/ia64/ia64.c	(working copy)
@@ -9272,6 +9272,22 @@ ia64_hpux_init_libfuncs (void)
 {
   ia64_init_libfuncs ();
 
+  /* 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");


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]