Page 2 of 2

Re: Please evaluate my perception of these selectors in DSP/

PostPosted: Sat Mar 20, 2021 12:43 am
by guyman
So if we remove the xorps it takes it from 7 instructions to 6? We got it to 6? is that the most efficient for an instant switch?

Re: Please evaluate my perception of these selectors in DSP/

PostPosted: Sat Mar 20, 2021 5:18 pm
by HughBanton
I'm totally self-taught in the assembler arena - so anything I say should not to be taken as gospel! (Well, guided right here by FS Guru / Trog / MV / KG /MyCo etc. etc. in the main!) but as far as I can deduce xorps xmm0,xmm0 is only required when you're generating a bool variable within the code itself, where it's generally followed by a cmpps to determine the condition. (For the uninitiated the strange 'xorps xmm0,xmm0' instruction is the recognised guaranteed method to clear every bit in the xmm0 register).

Whereas here the bool is specified by 'switch' being on a streamboolin input type. So it certainly appears that we can legitamately loose that line. (In fact, had we needed xorps xmm0,xmm0 , I guess we'd logically also have needed xorps xmm1,xmm1 , because xmm1 is used in exactly the same way for in2).

I'll have to scour though all my code, see if I can make use of this one! Credit should go to Adam though; the latest Alpha still doesn't automatically offer andnps when compiling DSP code when you write ' &!<bool> '. I wasn't aware of it.

H