Assembler optimization suggestion

For general discussion related FlowStone
Post Reply
User avatar
TrojakEW
Posts: 111
Joined: Sat Dec 25, 2010 10:12 am
Location: Slovakia

Assembler optimization suggestion

Post by TrojakEW »

Hi there,
I need some help here from assembler gurus. Have two mono4 inputs. I need to combine them together into:
1 input channel [0]+[2] = out[0]
1 input channel [1]+[3] = out[2]
2 input channel [0]+[2] = out[1]
2 input channel [1]+[3] = out[2]

Here is how I have it now:

Code: Select all

streamin l;
streamin r;
streamout out;

movaps xmm0,l;movaps xmm1,xmm0;
shufps xmm1,xmm1,14;
addps xmm0,xmm1;movaps l,xmm0;

movaps xmm0,r;movaps xmm1,xmm0;
shufps xmm1,xmm1,14;
addps xmm0,xmm1;movaps r,xmm0;

mov eax,l[0];mov out[0],eax;
mov eax,l[1];mov out[2],eax;
mov eax,r[0];mov out[1],eax;
mov eax,r[1];mov out[3],eax;

See also attached schematic.

My question is - Is there better solution for this and avoid packing and using additonal variables? I need to use it few time in code and I want to avoid useless reading and writing to registers.
Attachments
mono4comb.fsm
(1.25 KiB) Downloaded 851 times
adamszabo
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Assembler optimization suggestion

Post by adamszabo »

perhaps like this?
Attachments
mono4comb_2.fsm
(1.23 KiB) Downloaded 883 times
User avatar
TrojakEW
Posts: 111
Joined: Sat Dec 25, 2010 10:12 am
Location: Slovakia

Re: Assembler optimization suggestion

Post by TrojakEW »

Yes this is it. Thank you.
Post Reply