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)); }
@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
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