[rfa:ppc] Fix PPC/NBSD struct return; Was: userdef.exp regression for ppc?
Jason R Thorpe
thorpej@wasabisystems.com
Sun Jun 2 18:42:00 GMT 2002
On Sun, Jun 02, 2002 at 09:20:43PM -0400, Kevin B. Hendricks wrote:
> 1. How are you currently handling the case when you call a function with
> more than 8 floating point (not double) values so that floating point
> values must be created on the outgoing parameter stack in the frame making
> the call?
>
> The sys v abi says these float parameters should be passed as double values
> on the outgoing stack with addresses aligned to 8.
>
> Currently ppc Linux does NOT follow this part of the abi and instead
> passing float parameters (after the 8 which are passed in f1-f8) as
> floating point (single) values aligned to 4.
>
> What does NetBSD ppc do here?
As far as I can tell, this is also what NetBSD does. Attached is:
float.c -- function which takes 10 float arguments, and
consumes them all.
float.s-2.95.3-native -- asm output from the 2.95.3-based
native compiler.
float.s-3.2 -- asm output from gcc-current.
Note the offsets used in the "lfs" insns.
> 2. What about returning unions (which would probably be exactly 8 bytes in
> size? Are they treated like small structures or something different?
Unions of <= 8 bytes are treated just like structures of <= 8 bytes,
in both the 2.95.3-based native compiler and in the fixed gcc 3.1/3.2
compiler.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
-------------- next part --------------
int
float_test(float f1, float f2, float f3, float f4, float f5,
float f6, float f7, float f8, float f9, float f10)
{
return f1 == f2 &&
f1 == f3 &&
f1 == f4 &&
f1 == f5 &&
f1 == f6 &&
f1 == f7 &&
f1 == f8 &&
f1 == f9 &&
f1 == f10;
}
-------------- next part --------------
.file "float.c"
gcc2_compiled.:
.section ".text"
.align 2
.globl float_test
.type float_test,@function
float_test:
fcmpu 6,1,2
fcmpu 7,1,3
li 3,0
mfcr 0
rlwinm 9,0,27,1
rlwinm 0,0,31,1
and. 11,9,0
bclr 12,2
fcmpu 7,1,4
fcmpu 6,1,5
mfcr 0
rlwinm 9,0,31,1
rlwinm 0,0,27,1
and. 11,9,0
bclr 12,2
fcmpu 7,1,6
fcmpu 6,1,7
mfcr 0
rlwinm 9,0,31,1
rlwinm 0,0,27,1
and. 11,9,0
bclr 12,2
lfs 0,8(1)
fcmpu 6,1,8
fcmpu 7,1,0
mfcr 0
rlwinm 9,0,27,1
rlwinm 0,0,31,1
and. 11,9,0
bclr 12,2
lfs 0,12(1)
fcmpu 7,1,0
mfcr 3
rlwinm 3,3,31,1
blr
.Lfe1:
.size float_test,.Lfe1-float_test
.ident "GCC: (GNU) 2.95.3 20010315 (release) (NetBSD nb1)"
-------------- next part --------------
.file "float.c"
.section ".text"
.align 2
.globl float_test
.type float_test,@function
float_test:
fcmpu 0,1,2
li 3,0
bnelr- 0
fcmpu 0,1,3
bnelr- 0
fcmpu 0,1,4
bnelr- 0
fcmpu 0,1,5
bnelr- 0
fcmpu 0,1,6
bnelr- 0
fcmpu 0,1,7
bnelr- 0
fcmpu 0,1,8
bnelr- 0
lfs 0,8(1)
fcmpu 0,1,0
bnelr- 0
lfs 0,12(1)
fcmpu 0,1,0
bnelr- 0
li 3,1
blr
.Lfe1:
.size float_test,.Lfe1-float_test
.ident "GCC: (GNU) 3.2 20020602 (experimental)"
More information about the Gcc
mailing list