public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: BITS_PER_UNIT larger than 8 -- word addressing
@ 2007-11-27 12:39 Ross Ridge
  2007-11-27 13:47 ` Michael Eager
  0 siblings, 1 reply; 12+ messages in thread
From: Ross Ridge @ 2007-11-27 12:39 UTC (permalink / raw)
  To: gcc

Miceal Eagar writes:
>I'm working with a target that has 32-bit word addressing,
>so there is a define of BITS_PER_UNIT = 32.

According to the documentation, this changes the size of a byte to 32
bits, instead of the more usual 8 bits.

>This causes a problem:  an error saying that there is
>no emulation for 'DI'.  DImode has a precision of 128 bits,
>which is clearly incorrect.  (All the other integer modes
>were incorrect as well.)

DImode is defined to be 8 bytes long so with a 32-bit byte I'd expect
it to be 256 bits.  Trying use QImode and HImode for 32-bit and 64-bit
operations respectively.

					Ross Ridge

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: BITS_PER_UNIT larger than 8 -- word addressing
@ 2007-12-05 20:08 Boris Boesler
  2007-12-05 21:32 ` Ian Lance Taylor
  0 siblings, 1 reply; 12+ messages in thread
From: Boris Boesler @ 2007-12-05 20:08 UTC (permalink / raw)
  To: GCC

On 2007-11-27 18:29, Michael Eager wrote:
 > Joseph S. Myers wrote:
 > > On Tue, 27 Nov 2007, Michael Eager wrote:
 > >
 > >> I think that there is a pervasive understanding that SImode is
 > >> single precision integer, 32-bits long.
 > >
 > > Only among contributors not considering non-8-bit bytes.  SImode  
is 4
 > > times QImode, 4*BITS_PER_UNIT bits, and may not exist (or at  
least not be
 > > particularly usable, much like the limitations on TImode on 32-bit
 > > targets) with large BITS_PER_UNIT.
 >
 > I think you just described the majority of contributors.  :-)
 >
 > It's human nature not to recognize one's tacit assumptions or their
 > consequences.

  I assume that GCC internals assume that memory can be byte (8 bits)  
addressed - for historical reasons. Therefore, the sizes of all types  
are multiples of a byte. The same is true for addressing values in  
memory. (Sizes of types and their addresses must be separated more  
precisely. A 32 bit value could be on a 4 bit boundary!) But this is  
changing. Addressable units are on 32 bit boundaries or even on 4 bit  
boundaries today. Well, this is the problem I'm running in right now.

Boris

^ permalink raw reply	[flat|nested] 12+ messages in thread
* BITS_PER_UNIT larger than 8 -- word addressing
@ 2007-11-27  9:27 Michael Eager
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Eager @ 2007-11-27  9:27 UTC (permalink / raw)
  To: GCC

I'm working with a target that has 32-bit word addressing,
so there is a define of BITS_PER_UNIT = 32.

This causes a problem:  an error saying that there is
no emulation for 'DI'.  DImode has a precision of 128 bits,
which is clearly incorrect.  (All the other integer modes
were incorrect as well.)

DI is defined in machmode.def as
   INT_MODE (DI, 8).

This is sort-of correct, DI is an 8 byte or 2 word value.

When this is used to generate insn-modes.c, its size is
generated as 8*BITS_PER_UNIT, not 2*BITS_PER_UNIT,
because, it seems, genmodes assumes that size in bits is
is bytesize*BITS_PER_UNIT.  In emit_mode_precision() in
genmodes.c the assumption is pretty clear.

I built the c4x target, since that's the only example of
a target with BITS_PER_UNIT set.  It looks like this target
is defunct and slated for removal.  It gets the same error.

If BITS_PER_UNIT should alway be bytesize, then it seems
unnecessary to have the definition of BITS_PER_UNIT.  Or
it looks like genmodes.c needs to have another define,
BYTES_PER_UNIT, so that it can correctly convert from
bytesize to the number of units for the target.  Or the
definition of integer sizes should be directly in bits,
without any reference to bytesize.

Is there a different way to define word-addressed targets?
Or should I just pretend it has byte addressing?

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

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

end of thread, other threads:[~2007-12-05 21:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-27 12:39 BITS_PER_UNIT larger than 8 -- word addressing Ross Ridge
2007-11-27 13:47 ` Michael Eager
2007-11-27 13:56   ` Richard Sandiford
2007-11-27 16:30   ` Joseph S. Myers
2007-11-27 18:47     ` Michael Eager
2007-11-27 19:00       ` Joseph S. Myers
2007-11-27 19:51         ` Michael Eager
2007-12-01  0:56           ` Michael Eager
2007-12-01  1:32             ` Joseph S. Myers
  -- strict thread matches above, loose matches on Subject: below --
2007-12-05 20:08 Boris Boesler
2007-12-05 21:32 ` Ian Lance Taylor
2007-11-27  9:27 Michael Eager

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