+2010-08-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/45336
+ * config/i386/emmintrin.h (_mm_extract_epi16): Cast to unsigned
+ short first.
+
+ * config/i386/smmintrin.h (_mm_extract_epi8): Cast to unsigned
+ char first.
+
2010-08-20 Jakub Jelinek <jakub@redhat.com>
PR target/45336
extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_extract_epi16 (__m128i const __A, int const __N)
{
- return __builtin_ia32_vec_ext_v8hi ((__v8hi)__A, __N);
+ return (unsigned short) __builtin_ia32_vec_ext_v8hi ((__v8hi)__A, __N);
}
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
}
#else
#define _mm_extract_epi16(A, N) \
- ((int) __builtin_ia32_vec_ext_v8hi ((__v8hi)(__m128i)(A), (int)(N)))
+ ((int) (unsigned short) __builtin_ia32_vec_ext_v8hi ((__v8hi)(__m128i)(A), (int)(N)))
#define _mm_insert_epi16(A, D, N) \
((__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)(__m128i)(A), \
(int)(D), (int)(N)))
extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_extract_epi8 (__m128i __X, const int __N)
{
- return __builtin_ia32_vec_ext_v16qi ((__v16qi)__X, __N);
+ return (unsigned char) __builtin_ia32_vec_ext_v16qi ((__v16qi)__X, __N);
}
extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
#endif
#else
#define _mm_extract_epi8(X, N) \
- ((int) __builtin_ia32_vec_ext_v16qi ((__v16qi)(__m128i)(X), (int)(N)))
+ ((int) (unsigned char) __builtin_ia32_vec_ext_v16qi ((__v16qi)(__m128i)(X), (int)(N)))
#define _mm_extract_epi32(X, N) \
((int) __builtin_ia32_vec_ext_v4si ((__v4si)(__m128i)(X), (int)(N)))
+2010-08-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/45336
+ * gcc.target/i386/pr45336-1.c: New.
+ * gcc.target/i386/pr45336-2.c: Likewise.
+ * gcc.target/i386/pr45336-3.c: Likewise.
+ * gcc.target/i386/pr45336-4.c: Likewise.
+
2010-08-20 Uros Bizjak <ubizjak@gmail.com>
PR testsuite/45361
--- /dev/null
+/* PR target/45336 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse4 -mtune=generic" } */
+/* { dg-final { scan-assembler-not "movsbl" } } */
+/* { dg-final { scan-assembler-not "movswl" } } */
+/* { dg-final { scan-assembler-not "movzbl" } } */
+/* { dg-final { scan-assembler-not "movzwl" } } */
+/* { dg-final { scan-assembler-not "cwtl" } } */
+/* { dg-final { scan-assembler "pextrb" } } */
+/* { dg-final { scan-assembler "pextrw" } } */
+/* { dg-final { scan-assembler "pextrd" } } */
+
+#include <smmintrin.h>
+unsigned int foo8(__m128i x) { return _mm_extract_epi8(x, 4); }
+unsigned int foo16(__m128i x) { return _mm_extract_epi16(x, 3); }
+unsigned int foo32(__m128i x) { return _mm_extract_epi32(x, 2); }
--- /dev/null
+/* PR target/45336 */
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -msse4 -mtune=generic" } */
+/* { dg-final { scan-assembler-not "movsbl" } } */
+/* { dg-final { scan-assembler-not "movswl" } } */
+/* { dg-final { scan-assembler-not "movzbl" } } */
+/* { dg-final { scan-assembler-not "movzwl" } } */
+/* { dg-final { scan-assembler-not "cwtl" } } */
+/* { dg-final { scan-assembler-not "cltq" } } */
+/* { dg-final { scan-assembler "pextrb" } } */
+/* { dg-final { scan-assembler "pextrw" } } */
+/* { dg-final { scan-assembler "pextrd" } } */
+
+#include <smmintrin.h>
+unsigned long long int foo8(__m128i x) { return _mm_extract_epi8(x, 4); }
+unsigned long long int foo16(__m128i x) { return _mm_extract_epi16(x, 3); }
+unsigned long long int foo32(__m128i x)
+{
+ return (unsigned int) _mm_extract_epi32(x, 2);
+}
--- /dev/null
+/* PR target/45336 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse4 -mtune=generic" } */
+/* { dg-final { scan-assembler "movsbl" } } */
+/* { dg-final { scan-assembler "(movswl|cwtl)" } } */
+/* { dg-final { scan-assembler "pextrb" } } */
+/* { dg-final { scan-assembler "pextrw" } } */
+/* { dg-final { scan-assembler "pextrd" } } */
+
+#include <smmintrin.h>
+int foo8(__m128i x) { return (char) _mm_extract_epi8(x, 4); }
+int foo16(__m128i x) { return (short) _mm_extract_epi16(x, 3); }
+int foo32(__m128i x) { return _mm_extract_epi32(x, 2); }
--- /dev/null
+/* PR target/45336 */
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -msse4 -mtune=generic" } */
+/* { dg-final { scan-assembler "movsbq" } } */
+/* { dg-final { scan-assembler "movswq" } } */
+/* { dg-final { scan-assembler "(cltq|movslq)" } } */
+/* { dg-final { scan-assembler "pextrb" } } */
+/* { dg-final { scan-assembler "pextrw" } } */
+/* { dg-final { scan-assembler "pextrd" } } */
+
+#include <smmintrin.h>
+long long int foo8(__m128i x) { return (char) _mm_extract_epi8(x, 4); }
+long long int foo16(__m128i x) { return (short) _mm_extract_epi16(x, 3); }
+long long int foo32(__m128i x) { return (int) _mm_extract_epi32(x, 2); }