packed float to int rounding SSE

0ab1e9a89c4e0018f85b0edea50cd024
0
thebigT 101 May 24, 2010 at 05:28

I am implementing texturing in SSE and am coming up against a lack of packed float to int conversion instructions. The only remotely useful one I can find ( _mm_cvtss_si32 ) just converts the lowest float in the vector and writes the result out. However I want to convert all four elements and retain them in the xmm register to continue operating on them. Any suggestions would be appreciated. I am quite new to SSE programming and can’t help feeling I am missing something obvious.

4 Replies

Please log in or register to post a reply.

0ab1e9a89c4e0018f85b0edea50cd024
0
thebigT 101 May 24, 2010 at 06:09

The embarrassment of premature posting. I have found the instruction I was after, just wasn’t in the section of the intrinsic reference guide I expected it to be in.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 May 25, 2010 at 09:10

So, for future reference, what was the instruction? ;)

99f6aeec9715bb034bba93ba2a7eb360
0
Nick 102 May 25, 2010 at 09:27

cvtps2dq, if my memory serves me right.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 May 25, 2010 at 10:42

Alas, it was cvtps2pi ;)