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]

Patch for IA64 __sdiv3, etc.


Due to a change to optabs.c (version 1.163) IA64 has been using the DI
functions __divdi3, __udivdi3, __moddi3, and __umoddi3 instead of the SI
functions __divsi3, etc for 32 bit integer division and mod.  I did some
simple benchmarking and found that the 32 bit versions are faster.  They
calculate fewer bits of accuracy and thus do fewer fma instructions then
the 64 bit versions.  This change adds the use of those functions back
in to IA64 by setting TARGET_INIT_LIBFUNCS and calling
set_optab_libfunc.

Bootstrapped and tested on IA64 HP-UX and Linux with no regressions.


Steve Ellcey
sje@cup.hp.com

2004-03-10  Steve Ellcey  <sje@cup.hp.com>

	* config/ia64/hpux.h (TARGET_INIT_LIBFUNCS): Add undef.
	* config/ia64/ia64.h (TARGET_INIT_LIBFUNCS): Add define.
	* config/ia64/ia64.c (ia64_init_libfuncs): New.
	(ia64_hpux_init_libfuncs): Add call to ia64_init_libfuncs.


*** gcc.orig/gcc/gcc/config/ia64/hpux.h	Wed Mar 10 15:56:50 2004
--- gcc/gcc/gcc/config/ia64/hpux.h	Wed Mar 10 15:55:36 2004
*************** do {								\
*** 200,205 ****
--- 200,206 ----
  #undef TARGET_C99_FUNCTIONS
  #define TARGET_C99_FUNCTIONS  1
  
+ #undef TARGET_INIT_LIBFUNCS
  #define TARGET_INIT_LIBFUNCS ia64_hpux_init_libfuncs
  
  #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
*** gcc.orig/gcc/gcc/config/ia64/ia64.h	Wed Mar 10 15:56:38 2004
--- gcc/gcc/gcc/config/ia64/ia64.h	Wed Mar 10 15:55:41 2004
*************** enum fetchop_code {
*** 2388,2393 ****
--- 2388,2397 ----
  #undef  PROFILE_BEFORE_PROLOGUE
  #define PROFILE_BEFORE_PROLOGUE 1
  
+ /* Initialize library function table. */
+ #undef TARGET_INIT_LIBFUNCS
+ #define TARGET_INIT_LIBFUNCS ia64_init_libfuncs
+ 
  
  
  /* Switch on code for querying unit reservations.  */
*** gcc.orig/gcc/gcc/config/ia64/ia64.c	Wed Mar 10 15:56:43 2004
--- gcc/gcc/gcc/config/ia64/ia64.c	Wed Mar 10 15:55:45 2004
*************** static void ia64_hpux_add_extern_decl (t
*** 261,266 ****
--- 261,268 ----
       ATTRIBUTE_UNUSED;
  static void ia64_hpux_file_end (void)
       ATTRIBUTE_UNUSED;
+ static void ia64_init_libfuncs (void)
+      ATTRIBUTE_UNUSED;
  static void ia64_hpux_init_libfuncs (void)
       ATTRIBUTE_UNUSED;
  static void ia64_vms_init_libfuncs (void)
*************** ia64_hpux_file_end (void)
*** 8747,8757 ****
--- 8749,8773 ----
    extern_func_head = 0;
  }
  
+ /* Set SImode div/mod functions, init_integral_libfuncs only initializes
+    modes of word_mode and larger.  */
+ 
+ static void
+ ia64_init_libfuncs (void)
+ {
+   set_optab_libfunc (sdiv_optab, SImode, "__divsi3");
+   set_optab_libfunc (udiv_optab, SImode, "__udivsi3");
+   set_optab_libfunc (smod_optab, SImode, "__modsi3");
+   set_optab_libfunc (umod_optab, SImode, "__umodsi3");
+ }
+ 
  /* Rename all the TFmode libfuncs using the HPUX conventions.  */
  
  static void
  ia64_hpux_init_libfuncs (void)
  {
+   ia64_init_libfuncs ();
+ 
    set_optab_libfunc (add_optab, TFmode, "_U_Qfadd");
    set_optab_libfunc (sub_optab, TFmode, "_U_Qfsub");
    set_optab_libfunc (smul_optab, TFmode, "_U_Qfmpy");


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