* PPC Compiler Problem?
@ 1999-12-01 16:11 Alois Fertl
1999-12-01 16:27 ` Kevin Hendricks
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Alois Fertl @ 1999-12-01 16:11 UTC (permalink / raw)
To: linuxppc-dev
Given the following lines of C, I'd expect that the 4th argument
is placed into register 6 and 7. As the assembler listing tells,
register 6 is omitted and the argument goes into r7/r8.
I have seen this with egcs-2.91.66 and with a version conmpiled
from gcc-2.95.2-2a.
----------------------------------------------------
extern int foo(long, long, long, long long, long);
doo()
{
int result;
result = foo( 11, 12, 13, 14, 15 );
}
----------------------------------------------------
.file "z.c"
gcc2_compiled.:
.section ".text"
.align 2
.globl doo
.type doo,@function
doo:
stwu 1,-32(1)
mflr 0
stw 31,28(1)
stw 0,36(1)
mr 31,1
li 3,11
li 4,12
li 5,13
li 7,0
li 8,14
li 9,15
bl foo
mr 0,3
stw 0,8(31)
.L1:
lwz 11,0(1)
lwz 0,4(11)
mtlr 0
lwz 31,-4(11)
mr 1,11
blr
.Lfe1:
.size doo,.Lfe1-doo
.ident "GCC: (GNU) egcs-2.91.66 19990314 (egcs-1.1.2 release)"
--
Regards,
Alois
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: PPC Compiler Problem?
1999-12-01 16:11 PPC Compiler Problem? Alois Fertl
@ 1999-12-01 16:27 ` Kevin Hendricks
1999-12-01 16:32 ` Gabriel Paubert
1999-12-01 16:47 ` VALETTE Eric
2 siblings, 0 replies; 7+ messages in thread
From: Kevin Hendricks @ 1999-12-01 16:27 UTC (permalink / raw)
To: Alois Fertl, linuxppc-dev
Hi,
The ABI says that long longs are passed in register pairs with the first
register of the pair to being an odd numbered register.
so r3 gets param 1
r4 gets param 2
r5 gets param 3
r6 is an even numbered register and can't be used as the first number of
register pair and therefore is skipped over
r7 and r8 get param 4
Check out the sys ABI spec for ppc. This is correct given the spec.
By the way, we have one of the more wierd specs I have ever seen.
And I have no idea why this is used unless there is a physical datapath
contraint in the cpu that prevents simultaneous loading of r6,r7 pairs but
allows simultaneous loading of r7,r8 pairs?
Does anyone know?
> I have seen this with egcs-2.91.66 and with a version conmpiled
> from gcc-2.95.2-2a.
>
> ----------------------------------------------------
> extern int foo(long, long, long, long long, long);
>
> doo()
> {
> int result;
>
> result = foo( 11, 12, 13, 14, 15 );
> }
> ----------------------------------------------------
> .file "z.c"
> gcc2_compiled.:
> .section ".text"
> .align 2
> .globl doo
> .type doo,@function
> doo:
> stwu 1,-32(1)
> mflr 0
> stw 31,28(1)
> stw 0,36(1)
> mr 31,1
> li 3,11
> li 4,12
> li 5,13
> li 7,0
> li 8,14
> li 9,15
> bl foo
> mr 0,3
> stw 0,8(31)
> .L1:
> lwz 11,0(1)
> lwz 0,4(11)
> mtlr 0
> lwz 31,-4(11)
> mr 1,11
> blr
> .Lfe1:
> .size doo,.Lfe1-doo
> .ident "GCC: (GNU) egcs-2.91.66 19990314 (egcs-1.1.2 release)"
>
> --
> Regards,
> Alois
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: PPC Compiler Problem?
1999-12-01 16:11 PPC Compiler Problem? Alois Fertl
1999-12-01 16:27 ` Kevin Hendricks
@ 1999-12-01 16:32 ` Gabriel Paubert
1999-12-01 16:47 ` VALETTE Eric
2 siblings, 0 replies; 7+ messages in thread
From: Gabriel Paubert @ 1999-12-01 16:32 UTC (permalink / raw)
To: Alois Fertl; +Cc: linuxppc-dev
On Wed, 1 Dec 1999, Alois Fertl wrote:
>
> Given the following lines of C, I'd expect that the 4th argument
> is placed into register 6 and 7. As the assembler listing tells,
> register 6 is omitted and the argument goes into r7/r8.
No, that's normal but it has been fluctuating and I clearly remember a
version of gcc in which the caller and the callee did not agree in this
case...
The standard now is that 8 byte int parameters are "naturally" aligned
(for example when stored in a vararg list) which imposes occasional
skipping of a register (and makes the alignment requirement
counterintuitive since the first parameter register has an odd number)...
Regards,
Gabriel.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PPC Compiler Problem?
1999-12-01 16:11 PPC Compiler Problem? Alois Fertl
1999-12-01 16:27 ` Kevin Hendricks
1999-12-01 16:32 ` Gabriel Paubert
@ 1999-12-01 16:47 ` VALETTE Eric
1999-12-01 17:50 ` Gary Thomas
2 siblings, 1 reply; 7+ messages in thread
From: VALETTE Eric @ 1999-12-01 16:47 UTC (permalink / raw)
To: alois_fertl; +Cc: linuxppc-dev
>>>>> "Alois" == Alois Fertl <alois_fertl@muenchen.europe.mcd.mot.com> writes:
Alois> Given the following lines of C, I'd expect that the 4th argument
Alois> is placed into register 6 and 7. As the assembler listing tells,
Alois> register 6 is omitted and the argument goes into r7/r8.
I indeed checked the "PowerPC Processor ABI Supplement" dated September 95
(SVR4 PowerPC ABI) and on 3-18 I see :
For PowerPC, up to eight words are passed in general purpose registers, loaded
sequentially into general purpose registers r3 through r10.
It is clear that this breaks the SVR4 ABI... So you can probably open a bug
report...
The PPC EABI does not differ on that aspect... If someone can point me
to the last spec if I'm wrong...
--
__
/ ` Eric Valette
/-- __ o _. Canon CRF - Communication Dept
(___, / (_(_(__ Rue de la touche lambert
35517 Cesson-Sevigne Cedex
FRANCE
Tel: +33 (0)2 99 87 68 91 Fax: +33 (0)2 99 84 11 30
E-mail: valette@crf.canon.fr http://www.crf.canon.fr
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PPC Compiler Problem?
1999-12-01 16:47 ` VALETTE Eric
@ 1999-12-01 17:50 ` Gary Thomas
1999-12-01 17:56 ` VALETTE Eric
0 siblings, 1 reply; 7+ messages in thread
From: Gary Thomas @ 1999-12-01 17:50 UTC (permalink / raw)
To: VALETTE Eric; +Cc: linuxppc-dev, alois_fertl
On 01-Dec-99 VALETTE Eric wrote:
>
>>>>>> "Alois" == Alois Fertl <alois_fertl@muenchen.europe.mcd.mot.com> writes:
>
> Alois> Given the following lines of C, I'd expect that the 4th argument
> Alois> is placed into register 6 and 7. As the assembler listing tells,
> Alois> register 6 is omitted and the argument goes into r7/r8.
>
> I indeed checked the "PowerPC Processor ABI Supplement" dated September 95
> (SVR4 PowerPC ABI) and on 3-18 I see :
>
> For PowerPC, up to eight words are passed in general purpose registers, loaded
> sequentially into general purpose registers r3 through r10.
>
> It is clear that this breaks the SVR4 ABI... So you can probably open a bug
> report...
>
If you read carefully, on page 3-18 of the SYSV ABI report, for a long long
argument being placed in register 'gr':
" if gr is even, set gr to gr+1. Load the lower addressed word into gr and
the higher addressed word into gr+1."
Thus, the implementation _is_ correct. long long arguments always occupy
an odd/even pair of registers.
------------------------------------------------------------------------
Gary Thomas |
email: gdt@linuxppc.org | "Fine wine is a necessity of
... opinions expressed here are mine | life for me"
and no one else would claim them! |
| Thomas Jefferson
------------------------------------------------------------------------
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: PPC Compiler Problem?
1999-12-01 17:50 ` Gary Thomas
@ 1999-12-01 17:56 ` VALETTE Eric
1999-12-01 21:59 ` Tony Mantler
0 siblings, 1 reply; 7+ messages in thread
From: VALETTE Eric @ 1999-12-01 17:56 UTC (permalink / raw)
To: gdt; +Cc: linuxppc-dev, alois_fertl
>>>>> "Gary" == Gary Thomas <gdt@linuxppc.org> writes:
Gary> On 01-Dec-99 VALETTE Eric wrote:
>>
>>>>>>> "Alois" == Alois Fertl <alois_fertl@muenchen.europe.mcd.mot.com> writes:
>>
Alois> Given the following lines of C, I'd expect that the 4th argument
Alois> is placed into register 6 and 7. As the assembler listing tells,
Alois> register 6 is omitted and the argument goes into r7/r8.
>>
>> I indeed checked the "PowerPC Processor ABI Supplement" dated September 95
>> (SVR4 PowerPC ABI) and on 3-18 I see :
>>
>> For PowerPC, up to eight words are passed in general purpose registers, loaded
>> sequentially into general purpose registers r3 through r10.
>>
>> It is clear that this breaks the SVR4 ABI... So you can probably open a bug
>> report...
>>
Gary> If you read carefully, on page 3-18 of the SYSV ABI report, for a long long
Gary> argument being placed in register 'gr':
Gary> " if gr is even, set gr to gr+1. Load the lower addressed word into gr and
Gary> the higher addressed word into gr+1."
Gary> Thus, the implementation _is_ correct. long long arguments always occupy
Gary> an odd/even pair of registers.
Where do you see long long in the example???
--
__
/ ` Eric Valette
/-- __ o _. Canon CRF - Communication Dept
(___, / (_(_(__ Rue de la touche lambert
35517 Cesson-Sevigne Cedex
FRANCE
Tel: +33 (0)2 99 87 68 91 Fax: +33 (0)2 99 84 11 30
E-mail: valette@crf.canon.fr http://www.crf.canon.fr
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PPC Compiler Problem?
1999-12-01 17:56 ` VALETTE Eric
@ 1999-12-01 21:59 ` Tony Mantler
0 siblings, 0 replies; 7+ messages in thread
From: Tony Mantler @ 1999-12-01 21:59 UTC (permalink / raw)
To: VALETTE Eric; +Cc: linuxppc-dev, alois_fertl
At 11:56 AM -0600 12/1/99, VALETTE Eric wrote:
[... snip ...]
>
>Where do you see long long in the example???
Watch the commas:
>extern int foo(long, long, long, long long, long);
5 args, not 6. arg 4 is a long long.
--
Tony Mantler Renaissance Nerd Extraordinaire eek@escape.ca
Winnipeg, Manitoba, Canada http://www.escape.ca/~eek
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1999-12-01 21:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-12-01 16:11 PPC Compiler Problem? Alois Fertl
1999-12-01 16:27 ` Kevin Hendricks
1999-12-01 16:32 ` Gabriel Paubert
1999-12-01 16:47 ` VALETTE Eric
1999-12-01 17:50 ` Gary Thomas
1999-12-01 17:56 ` VALETTE Eric
1999-12-01 21:59 ` Tony Mantler
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 NNTP newsgroup(s).