Multiple return values...

Robert Jacques sandford at jhu.edu
Sun Mar 11 09:50:20 PDT 2012


On Sun, 11 Mar 2012 05:57:05 -0500, Manu <turkeyman at gmail.com> wrote:

> On 11 March 2012 04:35, Sean Cavanaugh <WorksOnMyMachine at gmail.com> wrote:
>
>> On 3/10/2012 8:08 PM, Mantis wrote:
>>
>>> Tuple!(float, float) callee() {
>>> do something to achieve result in st0,st1
>>> fst st0, st1 into stack
>>> load stack values into EAX, EDX
>>> ret
>>> }
>>>
>>> void caller() {
>>> call callee()
>>> push EAX, EDX into a stack
>>> fld stack values into st0, st1
>>> do something with st0, st1
>>> }
>>>
>>> As opposed to:
>>>
>>> Tuple!(float, float) callee() {
>>> do something to achieve result in st0,st1
>>> ret
>>> }
>>>
>>> void caller() {
>>> call callee()
>>> do something with st0, st1
>>> }
>>>
>>> Is there something I miss here?
>>>
>>
>> Yes, the fact the FPU stack is deprecated :)
>>
>
> Don't dismiss the point, the same still stands true with XMM regs.
>

And Walter has talked about using the XMM registers to return floating point data for exactly this reason. But those optimization apply to all structs and all data types. There's nothing special about MRV. It has to return a set of data in a structured manner; this is identical to the case of returning a struct.


More information about the Digitalmars-d mailing list