2

I am writing a program using SSE instructions to multiply and add integer values. I did the same program with floats but I am missing an instruccion for my integer version.

With floats, after I have finished all my operations, I return de values back to a regular float array doing:

_mm_store_ps(temp4,temp3);

temp4 is a float *, and temp3 a __m128.

The problem is that I cannot find a similar intrinsic for intengers. How should I return the values back to a regular array?

Thanks a lot for your answers ;)

Thudor
  • 349
  • 2
  • 7

1 Answers1

4

See _mm_load_si128, _mm_store_si128 (aligned) and _mm_loadu_si128 _mm_storeu_si128 (unaligned).

You might have overlooked these because for some reason the types are different compared to the float intrinsics. These are what lower to the movdqa/movdqu that you want.

gsg
  • 9,167
  • 1
  • 21
  • 23
  • But _mm_store_si128 (__m128i *p, __m128i a) is moving data to a _128i type right? With _mm_store_ps data was moved to a float array. If I need the integers back in an array of integers, can I use _mm_store_si128? I think I could do a cast, but casting is pretty slow right? Thanks a lot ;) – Thudor Nov 04 '13 at 11:17
  • 1
    Yes, you would need to cast the pointer you were storing to. Casting of this type is entirely free (although you are obliged to get the cast right!). – gsg Nov 04 '13 at 12:04