This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: short int and conversions
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Andrea <amichelo at gmail dot com>
- Cc: gcc at gcc dot gnu dot org, m dot hayes at elec dot canterbury dot ac dot nz
- Date: Thu, 17 Mar 2005 17:45:29 +0000 (UTC)
- Subject: Re: short int and conversions
- References: <7b65b8f70503170857851c1da@mail.gmail.com>
On Thu, 17 Mar 2005, Andrea wrote:
> I'm trying to port gcc 4.1 for an architecture that has the following
> memory layout BITS_PER_UNIT=32 and UNITS_PER_WORD=1.
Support for systems with bytes wider than 8 bits is somewhat bitrotten at
present, as it seems little has been done on the c4x port lately and it is
the only such port we currently have; various PRs indicate it simply
doesn't work (won't build libgcc) at present. I have however CC:ed the
maintainer of the c4x port in case he should wish to improve the state of
this port and the general support for such ports.
> It has support (16bit registers and operators) for 16bit signed
> atithmetic used mainly for addressing. There are also operators for 32
> bit integer and floating point support.
> I set SHORT_TYPE_SIZE=POINTER_SIZE=(BITS_PER_WORD/2).
short needs to have at least the precision of char in C. (C99 made
explicit various aspects of the ordering rules for type precision which
C90 was insufficiently complete about.)
However, types narrower than char do work in the compiler - we have them
for bit-fields. As required by the C standard, types narrower that int
are promoted to int in arithmetic. Bit-field types don't have their own
modes, but in principle you should be able to have a special type with its
own mode narrower than char: however, you may need to implement
optimizations which convert operations on promoted types to operations on
narrow types for targets with such types.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)