<div class="gmail_quote">On 11 March 2012 18:50, Robert Jacques <span dir="ltr"><<a href="mailto:sandford@jhu.edu">sandford@jhu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Sun, 11 Mar 2012 05:57:05 -0500, Manu <<a href="mailto:turkeyman@gmail.com" target="_blank">turkeyman@gmail.com</a>> wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 11 March 2012 04:35, Sean Cavanaugh <<a href="mailto:WorksOnMyMachine@gmail.com" target="_blank">WorksOnMyMachine@gmail.com</a>> wrote:<br>
<br>
</div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 3/10/2012 8:08 PM, Mantis wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Tuple!(float, float) callee() {<br>
do something to achieve result in st0,st1<br>
fst st0, st1 into stack<br>
load stack values into EAX, EDX<br>
ret<br>
}<br>
<br>
void caller() {<br>
call callee()<br>
push EAX, EDX into a stack<br>
fld stack values into st0, st1<br>
do something with st0, st1<br>
}<br>
<br>
As opposed to:<br>
<br>
Tuple!(float, float) callee() {<br>
do something to achieve result in st0,st1<br>
ret<br>
}<br>
<br>
void caller() {<br>
call callee()<br>
do something with st0, st1<br>
}<br>
<br>
Is there something I miss here?<br>
<br>
</blockquote>
<br>
Yes, the fact the FPU stack is deprecated :)<br>
<br>
</blockquote>
<br></div></div><div class="im">
Don't dismiss the point, the same still stands true with XMM regs.<br>
<br>
</div></blockquote>
<br>
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.<br>
</blockquote></div><br><div>Well you can't build these sorts of tightly packed structs in XMM registers... and even for the GPR's, it's very inefficient to do so. I haven't done tests, but I suspect this feature is probably a de-optimisation in all cases other than an int-pair struct (ranges, delegates? I suspect that's why this was invented). Structure packing/unpacking code will likely be slower than a store/load.</div>
<div><br></div><div>We just need proper multiple return values, then this can go away. And the earlier any ABI breaking changes are implemented, the better, while there are still few(/none?) closed source, binary distributed D libraries.</div>