D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6166 - Named return value optimization not dealt with in inline assembler
Summary: Named return value optimization not dealt with in inline assembler
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords: iasm, pull, wrong-code
Depends on:
Blocks:
 
Reported: 2011-06-16 14:24 UTC by Walter Bright
Modified: 2020-08-28 04:23 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2011-06-16 14:24:00 UTC
Byron writes:

I reduced the complexity of the problem, seems to be SSE and returning local copies.

$ dmd -run db.d
v: [1, 2, 3, 4]
test1 r: [nan, nan, nan, nan]
test1: [nan, nan, nan, nan]
test2 r: [1, 2, 3, 4]
test2: [1, 2, 3, 4]
halle109-251:asm byro


//db.d
import std.stdio;

alias float[4] vector;

const(vector) test1( ref const(vector) v )
{
    vector r;
    asm
    {
        mov EAX, v;
        movups XMM0, [EAX];
        movups r, XMM0;
    }
    writeln( "test1 r: ", r );
    return r;
}

const(vector) test2( ref const(vector) v )
{
    vector r, s;
    asm
    {
        mov EAX, v;
        movups XMM0, [EAX];
        movups r, XMM0;
    }
    writeln( "test2 r: ", r );
    s = r;
    return s;
}

void main()
{
    vector v = [1,2,3,4];
    writeln( "v: ", v );
    writeln( "test1: ", test1(v));
    writeln( "test2: ", test2(v));
}
Comment 1 Dlang Bot 2020-08-28 03:14:30 UTC
@WalterBright created dlang/dmd pull request #11636 "fix Issue 6166 - Named return value optimization not dealt with in in…" fixing this issue:

- fix Issue 6166 - Named return value optimization not dealt with in inline assembler

https://github.com/dlang/dmd/pull/11636
Comment 2 Dlang Bot 2020-08-28 04:23:46 UTC
dlang/dmd pull request #11636 "fix Issue 6166 - Named return value optimization not dealt with in in…" was merged into master:

- 75cb72d9c4d305c28bde1afcdebebbe44323f127 by Walter Bright:
  fix Issue 6166 - Named return value optimization not dealt with in inline assembler

https://github.com/dlang/dmd/pull/11636