I need some help on how to use the SSE logical instructions on Visual Studio. Based on the MSDN website,
__m128 _mm_and_ps(__m128 a , __m128 b );
ANDPS
can be used to perform logical AND on the operands a and b. But I couldn’t figure out the exact steps needed to get the results back (memory load and initialization, set, store, etc).
Specifically, I’d like to know how to:
- perform the operation,
- get the result back, and
- obtain the size of the result (number of significant bits).
Could someone please show me in an example how this can be done?
Thanks!
Here’s an example – inverting the sign of all the elements in a float vector using XOR:
So, supposing you wanted to negate all the values in an array, you could do it 4 elements at a time, like this: