public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18887] New: libgcc2.h Improperly determines required built-in function size requirements.
@ 2004-12-08 13:04 schlie at comcast dot net
  2004-12-08 14:37 ` [Bug c/18887] " pinskia at gcc dot gnu dot org
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: schlie at comcast dot net @ 2004-12-08 13:04 UTC (permalink / raw)
  To: gcc-bugs

UNITS_PER_WORD is being improperly used as the sole basis for selecting built-in
function type sizes in libgcc2.h.

As definitions like:

#if MIN_UNITS_PER_WORD > 1
/* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1. */
typedef          int SItype     __attribute__ ((mode (SI)));
typedef unsigned int USItype    __attribute__ ((mode (SI)));
...

are basically wrong; an appropriate set of default built-in function definitions
should be generated for each unique target defined XXXX_TYPE_SIZE equal to or
larger than the targets's WORD_SIZE (which equals UNITS_PER_WORD * BITS_PER_UNIT).

Which isn't what the embedded logic does, it just happens to work for most larg
 platforms as their UNITS_PER_WORD is large enough not to expose it's faults, as
evedenced on 8-bit targets for exampe which would benefit from some word-size
(8-bit QI) defaults for mul/div for example, along with built-in definitions for each
of it's potentially defined multi-word defined types, which may include 16bit (HI),
32bit(SI), 64bit(DI), 16bit (HF), 32bit(SF), and 64bit(DF) types, which clearly wouldn't
be defined by inspection.

So suspect that the logic should look more like:

#define WORD_SIZE (UNITS_PER_WORD * BITS_PER_UNIT)

#if   CHAR_TYPE_SIZE ==  8 || SHORT_TYPE_SIZE ==  8
#define GENERATE_QI_MODE_DEFINITIONS
#  if WORD_SIZE == 8
#    define GENERATE_QI_MODE_BUILTIN_DEFAULTS_BASE
#  endif
#endif

#if   SHORT_TYPE_SIZE ==  16 || INT_TYPE_SIZE ==  16
#define GENERATE_HI_MODE_DEFINITIONS
#  if WORD_SIZE < 16
#    define GENERATE_HI_MODE_BUILTIN_DEFAULTS_ALL
#  elif WORD_SIZE == 16
#    define GENERATE_HI_MODE_BUILTIN_DEFAULTS_BASE
#  endif
#endif

#if   INT_TYPE_SIZE ==  32 || LONG_TYPE_SIZE ==  32
#define GENERATE_SI_MODE_DEFINITIONS
#  if WORD_SIZE < 32
#    define GENERATE_SI_MODE_BUILTIN_DEFAULTS_ALL
#  elif WORD_SIZE == 32
#    define GENERATE_SI_MODE_BUILTIN_DEFAULTS_BASE
#  endif
#endif

#if   LONG_TYPE_SIZE ==  64 || LONG_LONG_TYPE_SIZE ==  64
#define GENERATE_DI_MODE_DEFINITIONS
#  if WORD_SIZE < 64
#    define GENERATE_DI_MODE_BUILTIN_DEFAULTS_ALL
#  elif WORD_SIZE == 64
#    define GENERATE_DI_MODE_BUILTIN_DEFAULTS_BASE
#  endif
#endif

#if   LONG_LONG_TYPE_SIZE ==  128
#define GENERATE_TI_MODE_DEFINITIONS
#  if WORD_SIZE < 128
#    define GENERATE_TI_MODE_BUILTIN_DEFAULTS_ALL
#  elif WORD_SIZE == 128
#    define GENERATE_TI_MODE_BUILTIN_DEFAULTS_BASE
#  endif
#endif

#if   FLOAT_TYPE_SIZE ==  16
#define GENERATE_HF_MODE_DEFINITIONS
#define GENERATE_HF_MODE_BUILTIN_DEFAULTS_ALL
#endif

#if   FLOAT_TYPE_SIZE ==  32 || DOUBLE_TYPE_SIZE ==  32
#  define GENERATE_SF_MODE_DEFINITIONS
#  define GENERATE_SF_MODE_BUILTIN_DEFAULTS_ALL
#endif

#if   DOUBLE_TYPE_SIZE ==  64 || QUAD_TYPE_SIZE ==  64
#  define GENERATE_DF_MODE_DEFINITIONS
#  define GENERATE_DF_MODE_BUILTIN_DEFAULTS_ALL
#endif

#if   QUAD_TYPE_SIZE ==  128
#  define GENERATE_TF_MODE_DEFINITIONS
#  define GENERATE_TF_MODE_BUILTIN_DEFAULTS_ALL
#endif

or somthing like that, thereby all bultins as nessisary are properly defined by
default that are larger than the WORD_SIZE, with a few base defaults if equal
to the word size for functions typically not implemented in HW such as possiby
/ and %.

-- 
           Summary: libgcc2.h Improperly determines required built-in
                    function size requirements.
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schlie at comcast dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: any
  GCC host triplet: any
GCC target triplet: 8/16 bit targets


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18887


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

end of thread, other threads:[~2005-03-14 14:25 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-08 13:04 [Bug c/18887] New: libgcc2.h Improperly determines required built-in function size requirements schlie at comcast dot net
2004-12-08 14:37 ` [Bug c/18887] " pinskia at gcc dot gnu dot org
2004-12-08 15:24 ` schlie at comcast dot net
2004-12-08 20:25 ` schlie at comcast dot net
2004-12-11 16:37 ` [Bug c/18887] [4.0 Regression] " giovannibajo at libero dot it
2004-12-11 17:58 ` [Bug middle-end/18887] " pinskia at gcc dot gnu dot org
2004-12-12  3:09 ` pinskia at gcc dot gnu dot org
2004-12-12 13:52 ` bernie at develer dot com
2004-12-12 14:12 ` bernie at develer dot com
2004-12-12 14:22 ` bernie at develer dot com
2004-12-14 16:40 ` pinskia at gcc dot gnu dot org
2004-12-21 20:19 ` schlie at comcast dot net
2004-12-27 17:10 ` berndtrog at yahoo dot com
2004-12-27 18:34 ` schlie at comcast dot net
2004-12-29 19:39 ` berndtrog at yahoo dot com
2005-01-05 19:48 ` bjoern dot m dot haase at web dot de
2005-01-18 21:40 ` bjoern dot m dot haase at web dot de
2005-01-21 17:46 ` mmitchel at gcc dot gnu dot org
2005-01-22 18:28 ` schlie at comcast dot net
2005-03-05 19:52 ` [Bug middle-end/18887] [4.0/4.1 " pinskia at gcc dot gnu dot org
2005-03-13 15:04 ` giovannibajo at libero dot it
2005-03-14 14:25 ` schlie at comcast dot net

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).