]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/46419 (_mm_cvtpu16_ps (and hence _mm_cvtpu8_ps) returns false result)
authorUros Bizjak <ubizjak@gmail.com>
Wed, 10 Nov 2010 23:28:03 +0000 (00:28 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Wed, 10 Nov 2010 23:28:03 +0000 (00:28 +0100)
PR middle-end/46419
* config/i386/xmmintrin.h (_mm_cvtpi16_ps): Swap __hisi and __losi.
(_mm_cvtpu16_ps): Ditto.

testsuite/ChangeLog:

PR target/46419
* gcc-target/i386/pr46419.c: New test.

From-SVN: r166572

gcc/ChangeLog
gcc/config/i386/xmmintrin.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr46419.c [new file with mode: 0644]

index 73ce585d92b2fca36bd5f1b5495d2f3236cff7a9..8c766dea7bb5dc7341c3a3b1038c75b22762c445 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-10  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR middle-end/46419
+       * config/i386/xmmintrin.h (_mm_cvtpi16_ps): Swap __hisi and __losi.
+       (_mm_cvtpu16_ps): Ditto.
+
 2010-11-04  Uros Bizjak  <ubizjak@gmail.com>
 
        Revert:
index 544577ecaf085e966bb054d7ef4782c24cf9e4b6..8bec37440357f15b6611b1e642eeaccc53470ca9 100644 (file)
@@ -626,13 +626,13 @@ _mm_cvtpi16_ps (__m64 __A)
   __sign = __builtin_ia32_pcmpgtw ((__v4hi)0LL, (__v4hi)__A);
 
   /* Convert the four words to doublewords.  */
-  __hisi = (__v2si) __builtin_ia32_punpckhwd ((__v4hi)__A, __sign);
   __losi = (__v2si) __builtin_ia32_punpcklwd ((__v4hi)__A, __sign);
+  __hisi = (__v2si) __builtin_ia32_punpckhwd ((__v4hi)__A, __sign);
 
   /* Convert the doublewords to floating point two at a time.  */
   __zero = (__v4sf) _mm_setzero_ps ();
-  __ra = __builtin_ia32_cvtpi2ps (__zero, __hisi);
-  __rb = __builtin_ia32_cvtpi2ps (__ra, __losi);
+  __ra = __builtin_ia32_cvtpi2ps (__zero, __losi);
+  __rb = __builtin_ia32_cvtpi2ps (__ra, __hisi);
 
   return (__m128) __builtin_ia32_movlhps (__ra, __rb);
 }
@@ -645,13 +645,13 @@ _mm_cvtpu16_ps (__m64 __A)
   __v4sf __zero, __ra, __rb;
 
   /* Convert the four words to doublewords.  */
-  __hisi = (__v2si) __builtin_ia32_punpckhwd ((__v4hi)__A, (__v4hi)0LL);
   __losi = (__v2si) __builtin_ia32_punpcklwd ((__v4hi)__A, (__v4hi)0LL);
+  __hisi = (__v2si) __builtin_ia32_punpckhwd ((__v4hi)__A, (__v4hi)0LL);
 
   /* Convert the doublewords to floating point two at a time.  */
   __zero = (__v4sf) _mm_setzero_ps ();
-  __ra = __builtin_ia32_cvtpi2ps (__zero, __hisi);
-  __rb = __builtin_ia32_cvtpi2ps (__ra, __losi);
+  __ra = __builtin_ia32_cvtpi2ps (__zero, __losi);
+  __rb = __builtin_ia32_cvtpi2ps (__ra, __hisi);
 
   return (__m128) __builtin_ia32_movlhps (__ra, __rb);
 }
index 9aa5983c5562dbd437f19d91f38e9ac221ae4c16..12da78f95b13c118e14233f08a0eba87433a4da7 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-10  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/46419
+       * gcc-target/i386/pr46419.c: New test.
+
 2010-11-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        Backport from mainline:
diff --git a/gcc/testsuite/gcc.target/i386/pr46419.c b/gcc/testsuite/gcc.target/i386/pr46419.c
new file mode 100644 (file)
index 0000000..3b72228
--- /dev/null
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -msse" } */
+/* { dg-require-effective-target sse } */
+
+#include "sse-check.h"
+
+#include <xmmintrin.h>
+
+void __attribute__((noinline))
+sse_test (void)
+{
+  char image[4];
+  __m128 image4;
+  float out[4] __attribute__ ((aligned (16)));
+  int i;
+
+  for (i = 0; i < 4; i++)
+    image[i] = i + 1;
+
+  image4 =
+    _mm_cvtpi8_ps (_mm_setr_pi8
+                  (image[0], image[1], image[2], image[3], 0, 0, 0, 0));
+  _mm_store_ps (out, image4);
+  _mm_empty ();
+
+  for (i = 0; i < 4; i++)
+    if (out[i] != (float) (i + 1))
+      abort ();
+
+  image4 =
+    _mm_cvtpu8_ps (_mm_setr_pi8
+                  (image[0], image[1], image[2], image[3], 0, 0, 0, 0));
+  _mm_store_ps (out, image4);
+  _mm_empty ();
+
+  for (i = 0; i < 4; i++)
+    if (out[i] != (float) (i + 1))
+      abort ();
+}