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]

[spu, commit] Enable TImode vs. float conversion routines in libgcc


Hello,

on the SPU, we have the peculiar situation that while word size is
128 bit (since this is actually the register size), we're still
bascially a 32-bit architecture as far as ISA and ABI are concerned.

This has the effect that the back-end must generally support TImode
arithmetic (since many parts of the compiler expect arithmetic to
work at least up to the word size), but this is not just twice, but
four times the size of what most arithmetic instructions support.

While we mostly do support TImode arithmetic, there are a couple of
gaps.  In particular, we have so far not yet supported conversions
between TImode integers and floating-point.  However, this now
causes test suite failures as the Fortran run-time library expects
just such conversions to work; the compiler generates calls to the
appropriate TImode libgcc routines, but those simply are not present.

To fix this, the patch below adds TImode conversion routines to
libgcc, using the existing LIB2_SIDITI_CONV_FUNC mechanism.

This exposed a secondary problem in that spu.h did not use the
LIBGCC2_UNITS_PER_WORD define to choose to build a 32-bit libgcc,
but instead (ab)used MIN_UNITS_PER_WORD to do so.  This breaks
when enabling LIB2_SIDITI_CONV_FUNC, so the patch changes this
as well.

Tested on spu-elf with no regressions.

Committed to mainline.

Bye,
Ulrich


ChangeLog:

	* config/spu/t-spu-elf (LIB2_SIDITI_CONV_FUNC): Define.
	* config/spu/spu.h (MIN_UNITS_PER_WORD): Do not define.
	(LIBGCC2_UNITS_PER_WORD): Define if not already defined.

Index: gcc/config/spu/t-spu-elf
===================================================================
*** gcc/config/spu/t-spu-elf	(revision 167696)
--- gcc/config/spu/t-spu-elf	(working copy)
*************** fp-bit.c: $(srcdir)/config/fp-bit.c $(sr
*** 63,68 ****
--- 63,72 ----
  	echo '#undef US_SOFTWARE_GOFAST' >> fp-bit.c
  	cat $(srcdir)/config/fp-bit.c >> fp-bit.c
  
+ # Build TImode conversion routines to support Fortran 128-bit
+ # integer data types.
+ LIB2_SIDITI_CONV_FUNCS=yes
+ 
  # Don't let CTOR_LIST end up in sdata section.
  CRTSTUFF_T_CFLAGS =
  
Index: gcc/config/spu/spu.h
===================================================================
*** gcc/config/spu/spu.h	(revision 167696)
--- gcc/config/spu/spu.h	(working copy)
*************** extern GTY(()) int spu_tune;
*** 65,73 ****
  
  #define UNITS_PER_WORD (BITS_PER_WORD/BITS_PER_UNIT)
  
! /* We never actually change UNITS_PER_WORD, but defining this causes
!    libgcc to use some different sizes of types when compiling. */
! #define MIN_UNITS_PER_WORD 4
  
  #define POINTER_SIZE 32
  
--- 65,80 ----
  
  #define UNITS_PER_WORD (BITS_PER_WORD/BITS_PER_UNIT)
  
! /* When building libgcc, we need to assume 4 words per units even
!    though UNITS_PER_WORD is 16, because the SPU has basically a 32-bit
!    instruction set although register size is 128 bits.  In particular,
!    this causes libgcc to contain __divdi3 instead of __divti3 etc.
!    However, we allow this default to be re-defined on the command
!    line, so that we can use the LIB2_SIDITI_CONV_FUNCS mechanism
!    to get (in addition) TImode versions of some routines.  */
! #ifndef LIBGCC2_UNITS_PER_WORD
! #define LIBGCC2_UNITS_PER_WORD 4
! #endif
  
  #define POINTER_SIZE 32
  
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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