Assembler optimization suggestion
Posted: Sat Jun 25, 2016 3:12 pm
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:
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.
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.