SSE asm with functions

Byron bheads at emich.edu
Thu Jun 16 10:20:53 PDT 2011


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


-Byron
begin 644 db.d
M:6UP;W)T('-T9"YS=&1I;SL*"F%L:6%S(&9L;V%T6S1=('9E8W1O<CL*"F-O
M;G-T*'9E8W1O<BD@=&5S=#$H(')E9B!C;VYS="AV96-T;W(I('8@*0I["B`@
M("!V96-T;W(@<CL*("`@(&%S;0H@("`@>PH@("`@("`@(&UO=B!%05 at L('8[
M"B`@("`@("`@;6]V=7!S(%A-33`L(%M%05A=.PH@("`@("`@(&UO=G5P<R!R
M+"!834TP.PH@("`@?0H@("`@=W)I=&5L;B@@(G1E<W0Q('(Z("(L('(@*3L*
M("`@(')E='5R;B!R.PI]"@IC;VYS="AV96-T;W(I('1E<W0R*"!R968 at 8V]N
M<W0H=F5C=&]R*2!V("D*>PH@("`@=F5C=&]R('(L(',["B`@("!A<VT*("`@
M('L*("`@("`@("!M;W8 at 14%8+"!V.PH@("`@("`@(&UO=G5P<R!834TP+"!;
M14%873L*("`@("`@("!M;W9U<',@<BP at 6$U-,#L*("`@('T*("`@('=R:71E
M;&XH(")T97-T,B!R.B`B+"!R("D["B`@("!S(#T@<CL*("`@(')E='5R;B!S
M.PI]"@IV;VED(&UA:6XH*0I["B`@("!V96-T;W(@=B`](%LQ+#(L,RPT73L*
M("`@('=R:71E;&XH(")V.B`B+"!V("D["B`@("!W<FET96QN*"`B=&5S=#$Z
M("(L('1E<W0Q*'8I*3L*("`@('=R:71E;&XH(")T97-T,CH@(BP@=&5S=#(H
)=BDI.PI]"@H*
`
end


More information about the Digitalmars-d mailing list