Is the following:
psrad xmm0, 31 ; arithmetic (sign-extend) shift right
equivalent to:
xorps xmm1, xmm1 ; zero
cmpps xmm0, xmm1, 1 ; less than
I am interested to know, because the shift instruction has lower latency (1 instead of usually 4), at least on Intel chips (somehow a certain table says that Zen cmpps has latency 1).
Are there any reasons not to use the shift instruction?
I suppose psrad will not handle NaNs correctly and maybe will not raise floating point exceptions? (Not that this is a huge concern).
I have heard that switching between floating point and integer operations (still on simd unit) can have an impact, but never could verify that. Would that be a concern?