* MIPS ABI changes in GCC 3.4
@ 2003-12-03 22:06 Daniel Jacobowitz
2003-12-03 23:03 ` Richard Sandiford
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Jacobowitz @ 2003-12-03 22:06 UTC (permalink / raw)
To: gcc; +Cc: rsandifo
I've been going through and verifying the MIPS ABI changes in GCC 3.4 over
the past couple of days, for an internal port. I came across an
inconsistency.... this is not a problem with the compiler but with the
change notes, I think, but I wanted to get your opinion.
mips-abi.html says:
==========
C. Large aggregate arguments
Affected ABIs n32 and n64
Endianness either
Conditions
* An aggregate argument is passed to a function;
* the aggregate's size is not a multiple of 8 bytes; and
* there are enough argument registers to hold some of the aggregate, but
not enough to hold all of it.
Old behavior The argument was passed by reference.
New behavior The argument is passed by value.
Example
struct s { int i[17]; };
void f (struct s x);
It would take 9 registers to hold x, but only 8 argument registers are
available. Since x's size is not a multiple of 8, previous releases passed
it by reference (that is, they passed a pointer to x in $4).
The new behavior is to pass x by value. The first 8 words are passed in
argument registers and the last is passed on the stack.
================
But that doesn't match what I see. If I use a 3.3-branch compiler and this
testcase:
struct s { int i[17]; };
int f (struct s x)
{
return x.i[16];
}
then the struct is passed by value for little endian and by reference for
big endian. This is because MUST_PASS_IN_STACK returns a different result;
I can't follow the 3.3 macro at all but I assume it's internally consistent.
So this fix only affects big-endian targets (like IRIX).
Not that it really matters since 3.3 didn't support any other widely used
n32/n64 targets.
Let me know if I'm right and I'll fix the web page.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: MIPS ABI changes in GCC 3.4
2003-12-03 22:06 MIPS ABI changes in GCC 3.4 Daniel Jacobowitz
@ 2003-12-03 23:03 ` Richard Sandiford
0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2003-12-03 23:03 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gcc
Daniel Jacobowitz <drow@mvista.com> writes:
> If I use a 3.3-branch compiler and this testcase:
>
> struct s { int i[17]; };
> int f (struct s x)
> {
> return x.i[16];
> }
>
> then the struct is passed by value for little endian and by reference for
> big endian.
You're right, sorry, the entry should read "Endianness: big"
not "Endiannes: either".
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-12-03 22:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-03 22:06 MIPS ABI changes in GCC 3.4 Daniel Jacobowitz
2003-12-03 23:03 ` Richard Sandiford
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).