Search code examples
assemblycmpsseeflags

comparing a xmmX vector


So say you loaded an xmm1 vector with 4 single precision floating points {1.5, 1.5, 1.5, 1.5} and xmm2 with the same points, so xmm1 == xmm2. Now you want to compare them so you write in assembly:

movaps  %xmm1, %xmm2
cmpeqps %xmm0, %xmm2

Since cmpeqps doesn't set the eflags, how can one say:

jne somewhere

Does one really need to use ucomiss to compare the right most portion of the vector, then shift right and repeat 3 more times?

Thanks


Solution

  • You can use cmpeqps, you just have to extract the four flags. For example (not tested)

    cmpeqps xmm2, xmm1
    movmskps eax, xmm2
    cmp eax, 15
    je somewhere