aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2010-08-20 20:57:56 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2010-08-20 13:57:56 -0700
commit410841c6d58b3d96245b564d1af8449164543956 (patch)
tree3fdebaa5aeacce0c4fd97369c27c1bb07d91c5d5 /gcc/config
parent50d724a75026efc61783b772dae0f12a823fb720 (diff)
downloadgcc-410841c6d58b3d96245b564d1af8449164543956.zip
gcc-410841c6d58b3d96245b564d1af8449164543956.tar.gz
gcc-410841c6d58b3d96245b564d1af8449164543956.tar.bz2
Cast to unsigned short/char first for _mm_extract_epi16/_mm_extract_epi8.
gcc/ 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. gcc/testsuite/ 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. From-SVN: r163421
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/i386/emmintrin.h4
-rw-r--r--gcc/config/i386/smmintrin.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/gcc/config/i386/emmintrin.h b/gcc/config/i386/emmintrin.h
index 9467fe0..596d28f 100644
--- a/gcc/config/i386/emmintrin.h
+++ b/gcc/config/i386/emmintrin.h
@@ -1309,7 +1309,7 @@ _mm_cmpgt_epi32 (__m128i __A, __m128i __B)
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__))
@@ -1319,7 +1319,7 @@ _mm_insert_epi16 (__m128i const __A, int const __D, int const __N)
}
#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)))
diff --git a/gcc/config/i386/smmintrin.h b/gcc/config/i386/smmintrin.h
index 170fae5..357b527 100644
--- a/gcc/config/i386/smmintrin.h
+++ b/gcc/config/i386/smmintrin.h
@@ -439,7 +439,7 @@ _mm_insert_epi64 (__m128i __D, long long __S, const 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__))
@@ -457,7 +457,7 @@ _mm_extract_epi64 (__m128i __X, const int __N)
#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)))