thanks martin, your array version is the one i was looking for
about the optimizing, i think when doing it like i did in the previous versions it can be done pretty good, i think the best way would be to use integer inputs for the connection indexes.
i did this with saving them in a mem array, but like this they also have to be read from mem, single int inputs would be preferable then (also when this means that each connection has an input then)
but how could i prepare the int indexes for the asm code?
i tried to change KG's "int array to mem of 32 bit" into a int array to single int outputs for asm but it didn't work like this, is there a way to do this?
Code: Select all
def event i,v
@fromSource.each_with_index do |x,id|
output id,x.pack('l*').unpack('F*') #asm int in
end
end
this would be the optimized asm code for it.. but still with converting the indexes to integers..
and we also could get rid of the initializing the targets with 0 or?
Code: Select all
streamin source0; streamin source1;
streamin idxs0; streamin idxs1;
streamin idxt0; streamin idxt1;
streamout target0;streamout target1;
float t[2];float s[2];
float tmp=0;float idxs=0;float idxt=0;
int I0=0; int I1=1;
//init source array
movaps xmm0,source0; mov eax,I0[0]; shl eax,4; movaps s[eax],xmm0;
movaps xmm1,source1; mov eax,I1[0]; shl eax,4; movaps s[eax],xmm1;
// connection 0
movaps xmm0,idxs0;cvtps2dq xmm0,xmm0;movaps idxs,xmm0;//wanna get rid of this
movaps xmm1,idxt0;cvtps2dq xmm1,xmm1;movaps idxt,xmm1;//and use int idx inputs
mov eax,idxs[0]; shl eax,4; movaps xmm0,s[eax]; movaps tmp,xmm0;
mov eax,idxt[0]; shl eax,4; movaps t[eax],xmm0;
// connection 1
movaps xmm0,idxs1;cvtps2dq xmm0,xmm0;movaps idxs,xmm0;//wanna get rid of this
movaps xmm1,idxt1;cvtps2dq xmm1,xmm1;movaps idxt,xmm1;//and use int idx inputs
mov eax,idxs[0]; shl eax,4; movaps xmm0,s[eax];
mov eax,idxt[0]; shl eax,4; movaps xmm1,t[eax];
addps xmm0,xmm1;
movaps tmp,xmm0;
mov eax,idxt[0]; shl eax,4; movaps t[eax],xmm0;
//assign outputs
mov eax,I0[0]; shl eax,4; movaps xmm0,t[eax]; movaps target0,xmm0;
mov eax,I1[0]; shl eax,4; movaps xmm1,t[eax]; movaps target1,xmm1;