www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6166] New: Named return value optimization not dealt with in inline assembler

http://d.puremagic.com/issues/show_bug.cgi?id=6166

           Summary: Named return value optimization not dealt with in
                    inline assembler
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bugzilla digitalmars.com



14:24:00 PDT ---
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));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 16 2011