title: How can I convert an XMM register of single-precision floats to integers?
body: <p>I have a bunch of packed floats inside an XMM register (using SSE intrinsics):</p>
  
  <pre><code>__m128 xmm = _mm_set_ps(4.0f, 3.0f, 2.0f, 1.0f);
  </code></pre>
  
  <p>I'd like to convert all of these to integers in one go. I found an intrinsic, that does what I want (<code>_mm_cvtps_pi16()</code>), but it yields 4x16-bit <em>short</em> instead of full-blown <em>int</em>. An intrinsic called <code>_mm_cvtps_pi32()</code> yields <em>int</em>, but only for the two lower values in <code>xmm</code>. I can use it, extract the values, move things around and use it again, but is there a simpler way? Why wouldn't there be a straightforward 32bit packed float -> 32bit integer instruction? Surely both fit in the same space of an XMM register?</p>
  
  <p><b>EDIT:</b> Okay, I see now that <code>_mm_cvtps_pi32()</code> returns __m64 instead of __m128, which means it operates on a MMX-style MM... register. That would explain why it returns just two ints, but now I'm wondering:</p>
  
  <ul>
  <li>Will I have trouble when compiling for x64? Reportedly, __m64 isn't supported there...  </li>
  <li>Why didn't they extend this instruction when SSE rolled out?</li>
  </ul>
  
  <p>Thanks!</p>