Suggestion for new extended code component

DSP related issues, mathematics, processing and techniques
Post Reply
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Suggestion for new extended code component

Post by KG_is_back »

Current DSP code component is optimized to work for sse 4channel streams. Some instructions that would cause problems in mono4 and poly signals are ruled out from DSP code, but are still available in assembler primitive. I think it would be reasonable to have a separate "extended" DSP code component that would be able to process only mono (maybe mono4) signals and would contain several new functions reganding code branching and looping.
This article is both an suggestion for DSPR and a tutorial for users how to implement the stuff in assembler until it's implemented in the code component directly.

First of all "If else" instruction... the syntax would look like this:

Code: Select all


if(a,0) //a is a variable or conditional statement containing boolean mask
// 0-3 is an index of SSE channel to take the mask from
 {
//code1
}
else
{
//code2
}

the assembly generated code would be

Code: Select all

movaps xmm0,a; //in case of statement this would be the statement calculation
movaps smIntVarTemp,xmm0;
push eax;
mov eax,smIntVarTemp[0]; //0-3 from the parameter;
cmp eax,0;
jz else1;

//code1

jmp skipelse1; //jmp is not implemented, so following code might be used instead:
// mov eax,0;cmp eax,0;jz elsecode1;
else1:

//code2

skipelse1:
pop eax;

The if else branching can currently be replaced by flag based statements, but conditional loops can't...
Conditional loops would be implemented in similar fashion...
while loop

Code: Select all

while (a,1)
{
//code
}

generated assembly:

Code: Select all

push eax;
while1:
movaps xmm0,a; //in case of statement this would be the statement calculation
movaps smIntVarTemp,xmm0;
mov eax,smIntVarTemp[1]; //0-3 from the parameter;
cmp eax,0;
jz notwhile1;


//code

jmp while1; //jmp is not implemented, so following code might be used instead:
// mov eax,0;cmp eax,0;jz while1;
notwhile1:
pop eax;


other branching like do-while loops are possible too...(I'm just too lazy to write them down at the time :oops: )
Post Reply