<div dir="ltr"><div>The attached patch changes the last step of _mm_cvtps_pi16, which is a function that converts four single precision floating point values into four signed 16-bit integers, to use _mm_packs_pi32 instead of _mm_packs_pi16.</div>

<div><br></div><div><rdar://problem/16873717><br></div><div><br></div><div>The following program miscompiles without the fix:</div><div><br></div><div><p style="margin:0px;font-size:11px;font-family:Menlo">#include <xmmintrin.h></p>

<p style="margin:0px;font-size:11px;font-family:Menlo">#include <stdio.h></p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">int main(int argc, char **argv)</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">{</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">  __m128 test2 = _mm_setr_ps(10.0f, 100.0f, 200.0f, 300.0f);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">  __m64 result = _mm_cvtps_pi16(test2);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">  // wrong value: 0x007f007f0064000a</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">  // proper value: 0x012c00c80064000a</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">  printf("%llx\n", result);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">  return 0;</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">}</p></div><div><br></div><div><br></div></div>