Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Larry Sendlosky <larry@scrugs.lkg.dec.com>
To: axp-list@redhat.com
Subject: Re: Weird Compaq CCC / GCC interaction ?
Date: Tue, 26 Sep 2000 14:52:47 EDT	[thread overview]
Message-ID: <CMM.0.90.4.969994367.larry@scrugs.lkg.dec.com> (raw)
In-Reply-To: Your message of Tue, 26 Sep 2000 12:01:45 -0600 (MDT)

I don't have the original quote from the spec, but I believe it said:

Signed and unsigned 32bit integers should be signed extended into
a 64bit register. That is the example I gave in my previous message
(below). 

A function that returns an unsigned int, as far as the caller is
concerned, returns 32bits of data to be treated as an unsigned int.
One could argue that it doesn't matter what the "upper" 32bits
in the 64bit R0 contain as long as the compiler only uses the "lower"
32bits as an unsigned int in subsequent usage by the caller's code.

The signed extension is a must so that arithmetic ops on 32bit values
work as one would expect when done in 64bit registers. That's all
the standard/spec requires.


> Larry Sendlosky wrote:
> > 
> > 
> > I haven't seen any of this thread, but the quoted spec is correct and
> > makes sense. Given the example below
> > 
> > MAGIC is an unsigned int (32bits) with value 0xc00fc00f. The compiler
> > should generate 0x00000000c00fc00f for the register value. This is
> > "sign extending" an unsigned int (there is no sign bit or it's
> > "inferred" to be zero).


> 
> That was really the question.  The standard which we are talking about
> seems to imply that a return value from an unsigned int function should
> be 0xffffffffc00fc00f and not 0x00000000c00fc00f although you will
> notice that only after a cast to long.  gcc, save the latest stuff,
> does what you describe above and this is non-conforming, if I understand
> correctly what was said here.  I was curious about further implications.
> 

  I don't belive the spec attempts to specify the "format" of a 32bit
  value placed in R0 when returning from a function. As long as the
  compiler "does the right thing" with the "lower" 32bits in the
  caller's code. 

  However, the Alpha "calling standard" may specify the format.
  I've been talking about the Alpha SRM which describes the
  representation of 32bit values in 64bit registers.

  Can one of you send me the original problem privately? So I can
  see what started all this.

  thanks

  larry





______________________________________________________________________
 Larry Sendlosky			 	            ATS
 larry@scrugs.lkg.dec.com (978) 506-6640                    Compaq
----------------------------------------------------------------------




             reply	other threads:[~2000-09-26 18:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-26 18:52 Larry Sendlosky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-09-26 17:47 Weird Compaq CCC / GCC interaction ? David Addison
2000-09-26 17:25 Larry Sendlosky
2000-09-26 18:01 ` Michal Jaegermann
2000-09-27  3:17 ` Richard Henderson
2000-09-26 13:59 David Addison
2000-09-26 15:36 ` Ivan Kokshaysky
2000-09-26  8:55 David Addison
2000-09-26  9:41 ` Andrei A. Dergatchev
2000-09-26 10:12 ` Nikita Schmidt
2000-09-26 16:02   ` Michal Jaegermann
2000-09-26 12:23 ` Ivan Kokshaysky
2000-09-26 13:57 ` Ivan Kokshaysky
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox