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: Rob Landley
Subject: Re: [Tinycc-devel] More fun with comparison between pointer and integer...
Date: Thu, 6 Sep 2007 02:13:53 -0500
User-agent: KMail/1.9.6

On Wednesday 05 September 2007 9:55:43 pm Dave Dodge wrote:
> 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.

Does Linux run on them?

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

The assumption I've been told is never assume anything but aligned writes of 
the platform's word size are atomic.

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

Again, does Linux run there?

>                                                    -Dave Dodge

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.




reply via email to

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