fix gofast.h typo with int to double conversions

Jim Wilson wilson@specifixinc.com
Sun Jul 11 07:35:00 GMT 2004


A customer reported that a mip64-elf toolchain configured with --enable-gofast
generates bad code for int to double conversions with -msoft-float.

The problem is in config/gofast.h.  In gcc-3.3.x, we have the line
  floatsidf_libfunc = init_one_libfunc ("litodp"); \
In gcc-3.4.x we have the line
  set_conv_libfunc (sfloat_optab, DFmode, DImode, "litodp");
Note that the SImode got changed into a DImode.  This appears to be a simple
typo in a large mode-related rewrite patch from Zack.
    http://gcc.gnu.org/ml/gcc-patches/2003-10/msg00466.html
Note also that config/fp-bit.h has
#		define si_to_float 	litodp
so the clear intent here is that litodp take SImode input.

The patch below fixes this by changing the DImode back to SImode.

This was tested with a mips64-elf toolchain built from gcc-3.4.0 sources,
with the multilibs enabled.  Running the gcc testsuite with -msoft-float, I get
178 failures without this patch, 86 failures with this patch.

I have added the patch to mainline and the gcc-3.4.x branch.

2004-07-10  James E Wilson  <wilson@specifixinc.com>

	* config/gofast.h (gofast_maybe_init_libfuncs): Use SImode for litodp.

Index: gofast.h
===================================================================
RCS file: /services/cvs/cvsroot/sources/stable/gcc-3.4.0/gcc/config/gofast.h,v
retrieving revision 1.1.1.1
diff -p -r1.1.1.1 gofast.h
*** gofast.h	26 May 2004 09:32:47 -0000	1.1.1.1
--- gofast.h	11 Jul 2004 01:12:41 -0000
*************** gofast_maybe_init_libfuncs (void)
*** 75,80 ****
    set_conv_libfunc (ufix_optab,   SImode, DFmode, "dptoul");
  
    set_conv_libfunc (sfloat_optab, SFmode, SImode, "sitofp");
!   set_conv_libfunc (sfloat_optab, DFmode, DImode, "litodp");
  #endif
  }
--- 75,80 ----
    set_conv_libfunc (ufix_optab,   SImode, DFmode, "dptoul");
  
    set_conv_libfunc (sfloat_optab, SFmode, SImode, "sitofp");
!   set_conv_libfunc (sfloat_optab, DFmode, SImode, "litodp");
  #endif
  }
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc-patches mailing list