tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] More fun with comparison between pointer and integer.


From: Dave Dodge
Subject: Re: [Tinycc-devel] More fun with comparison between pointer and integer...
Date: Wed, 5 Sep 2007 22:55:43 -0400
User-agent: Mutt/1.5.13 (2006-08-11)

On Wed, Sep 05, 2007 at 06:17:38PM -0500, Rob Landley wrote:
> On Wednesday 05 September 2007 5:32:06 pm Dave Dodge wrote:
> > For Linux certainly.  My understanding is that there are current
> > architectures in the embedded market that use a 32-bit char, though.
> 
> I haven't heard of them, and am not interested in supporting them.

Just FYI looking into it, this is mostly to do with DSP chips.
There's some SHARC device(s) with 32-bit bytes, and the TI TMS32F28xx
family reportedly uses 16-bit bytes.

> (I know that arm hasn't got instructions to manipulate bytes, but
> char is still 8 bits on arm linux.  The compiler emits code to mask
> and shift to make it work, which is why you never want to use a char
> as a loop index on arm.)

If I recall the story correctly, early Alpha chips only had full
64-bit loads and stores, and simulated 8-bit loads and stores by means
of shifts and masks.  One of the subtle effects of this scheme was
that single-char stores were not atomic, and this could badly break a
shared-memory application which assumed otherwise.

Cray had some architectures with 64-bit bytes, but simulated 8-bit
bytes in userspace by using otherwise-unused high bits in a pointer to
track which 8 of the 64 bits it was supposed to be pointing at.
Applications using tagged pointers (such as emacs) had to be careful
to preserve those bits.  char was the only type that they handled
specially; all of the other types including short were 64 bits.

                                                   -Dave Dodge




reply via email to

[Prev in Thread] Current Thread [Next in Thread]