public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [spu, commit] Enable TImode vs. float conversion routines in libgcc
@ 2010-12-16 19:46 Ulrich Weigand
  2010-12-16 20:07 ` Joseph S. Myers
  2010-12-17 15:18 ` [spu, commit] Fix TImode->SFmode conversions " Ulrich Weigand
  0 siblings, 2 replies; 6+ messages in thread
From: Ulrich Weigand @ 2010-12-16 19:46 UTC (permalink / raw)
  To: gcc-patches

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-17 18:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-16 19:46 [spu, commit] Enable TImode vs. float conversion routines in libgcc Ulrich Weigand
2010-12-16 20:07 ` Joseph S. Myers
2010-12-17 15:31   ` [patch] Enable TImode tests (Re: Enable TImode vs. float conversion routines in libgcc) Ulrich Weigand
2010-12-17 16:26     ` Joseph S. Myers
2010-12-17 19:31       ` Ulrich Weigand
2010-12-17 15:18 ` [spu, commit] Fix TImode->SFmode conversions " Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).