[PATCH] Fix bug in xmmintrin.h

Akira Hatanaka ahatanak at gmail.com
Thu May 22 16:50:41 PDT 2014


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.

<rdar://problem/16873717>

The following program miscompiles without the fix:

#include <xmmintrin.h>

#include <stdio.h>


int main(int argc, char **argv)

{

  __m128 test2 = _mm_setr_ps(10.0f, 100.0f, 200.0f, 300.0f);

  __m64 result = _mm_cvtps_pi16(test2);


  // wrong value: 0x007f007f0064000a

  // proper value: 0x012c00c80064000a

  printf("%llx\n", result);


  return 0;

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140522/591fb1e3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xmmintrin1.patch
Type: application/octet-stream
Size: 418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140522/591fb1e3/attachment.obj>


More information about the cfe-commits mailing list