summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-20 20:57:56 +0000
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-20 20:57:56 +0000
commitc9b3a2b94bc62096bed59cceeb5b09021f030410 (patch)
tree3fdebaa5aeacce0c4fd97369c27c1bb07d91c5d5 /gcc/config
parent2d1f5289b503a82bc23e56f88e9652972f68bd4a (diff)
downloadgcc-c9b3a2b94bc62096bed59cceeb5b09021f030410.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163421 138bc75d-0d04-0410-961f-82ee72b054a4
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 9467fe0f925..596d28ff8e8 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 170fae589b9..357b527367c 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)))