[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] GCC return register



Vincent Rivière wrote:

If I'm not wrong, AHCC (and maybe Pure C ?) returns pointers to a0.
What about floats ?

Pointers in A0
If compiled for FPU, floats in fp0


Software floating point:

Doubles are, from a function's perspective, treated as structures.
If a function must return a double, it receives a extra (implicit)
parameter which is a pointer to a temporary double in the local name
space of the caller.
The function must move the double to there via the pointer.
This is the same as the method used by Pure C and AHCC for returning
structures. Strong function typing is essential in all such cases where
a return value is not a integral.

Works fine for Pure C.
I have been too lazy and too busy to write a software floating
point library for AHCC. So although it is implemented compatable to
Pure C, it has not been tested for a long time.

I suspect that single precision floats (32bit) are returned in d0,
I am not sure, I have to look that up.

A Pure C program compiled for software fp can detect a FPU and thus
is able to be slightly more efficient. The calling procedure remains
the one described above for software fp.
Fpu detection in this case is governed by the software fp library.

A program compiled for the FPU just crashes if no FPU is present,
but is of course most efficient if there is a FPU.

FYI.

--
Groeten; Regards.
Henk Robbers. http://members.chello.nl/h.robbers
Interactive disassembler: TT-Digger;  http://digger.atari.org
A Home Cooked C compiler:      AHCC;  http://ahcc.atari.org