extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_extract_pi16 (__m64 const __A, int const __N)
{
- return __builtin_ia32_vec_ext_v4hi ((__v4hi)__A, __N);
+ return (unsigned short) __builtin_ia32_vec_ext_v4hi ((__v4hi)__A, __N);
}
extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
}
#else
#define _mm_extract_pi16(A, N) \
- ((int) __builtin_ia32_vec_ext_v4hi ((__v4hi)(__m64)(A), (int)(N)))
+ ((int) (unsigned short) __builtin_ia32_vec_ext_v4hi ((__v4hi)(__m64)(A), (int)(N)))
#define _m_pextrw(A, N) _mm_extract_pi16(A, N)
#endif
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -mmmx -msse2 -mtune=generic" } */
+/* { dg-final { scan-assembler-not "movswl" } } */
+/* { dg-final { scan-assembler-not "movzwl" } } */
+/* { dg-final { scan-assembler-not "cwtl" } } */
+/* { dg-final { scan-assembler "pextrw" } } */
+
+#include <xmmintrin.h>
+
+unsigned int foo16(__m64 x) { return _mm_extract_pi16(x, 3); }
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mmmx -msse2 -mtune=generic" } */
+/* { dg-final { scan-assembler-not "movswl" } } */
+/* { dg-final { scan-assembler-not "movzwl" } } */
+/* { dg-final { scan-assembler-not "cwtl" } } */
+/* { dg-final { scan-assembler-not "cltq" } } */
+/* { dg-final { scan-assembler "pextrw" } } */
+
+#include <xmmintrin.h>
+
+unsigned long long int foo16(__m64 x) { return _mm_extract_pi16(x, 3); }
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -mmmx -msse2 -mtune=generic" } */
+/* { dg-final { scan-assembler "(movswl|cwtl)" } } */
+/* { dg-final { scan-assembler "pextrw" } } */
+
+#include <xmmintrin.h>
+
+int foo16(__m64 x) { return (short) _mm_extract_pi16(x, 3); }
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mmmx -msse2 -mtune=generic" } */
+/* { dg-final { scan-assembler "movswq" } } */
+/* { dg-final { scan-assembler "pextrw" } } */
+
+#include <xmmintrin.h>
+
+long long int foo16(__m64 x) { return (short) _mm_extract_pi16(x, 3); }
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -mmmx -msse2 -mtune=generic" } */
+/* { dg-final { scan-assembler-not "movswl" } } */
+/* { dg-final { scan-assembler-not "cwtl" } } */
+/* { dg-final { scan-assembler "pextrw" } } */
+
+#include <xmmintrin.h>
+
+unsigned int foo16(__m64 x) { return _mm_extract_pi16(x, 3); }