Variable-length loops. i.e. loop(n) {...}
Posted: Fri May 01, 2020 2:56 pm
I think I'm right in saying that DSP in FS3 doesn't allow variable-length loops. FS4 does, but as far as I can see there's nothing to prevent doing them in FS3 when you're in assembler. (If I'm wrong I'll head on back to Slack ...
)
So, I'm inputting an int 'loopLength' to define the loop. FS4 typically gives you this assem for a variable-length loop :
But today I accidentally hit on this as a nice simplification, using cvtss2si to directly get loopLength into eax, instead of all the fld/fistp stuff .. which I barely understand anyway! (Much of my so-called assembler coding has its origins in the accidental
)
Appears to work OK, but seems too easy. Can one of the code team tell me if it's generally OK to do this? I foresee pitfalls ...
H
So, I'm inputting an int 'loopLength' to define the loop. FS4 typically gives you this assem for a variable-length loop :
Code: Select all
streamin loopLength;
float _temp_;
// Start of Loop {
movaps xmm0,loopLength;
movaps _temp_,xmm0;
fld _temp_[0]; fistp _temp_[0]; mov eax,_temp_[0];
loop1:
push eax;
// ...
// my code
// ...
pop eax;
dec eax;
jg loop1;
// } End of LoopBut today I accidentally hit on this as a nice simplification, using cvtss2si to directly get loopLength into eax, instead of all the fld/fistp stuff .. which I barely understand anyway! (Much of my so-called assembler coding has its origins in the accidental
Code: Select all
streamin loopLength;
// Start of Loop {
cvtss2si eax,loopLength;
loop1:
push eax;
// ...
// my code
// ...
pop eax;
dec eax;
jg loop1;
// } End of LoopAppears to work OK, but seems too easy. Can one of the code team tell me if it's generally OK to do this? I foresee pitfalls ...
H