Fix return type of _mm_extract_epi8 etc.

PR17300.

llvm-svn: 191120
This commit is contained in:
Eli Friedman 2013-09-21 00:05:25 +00:00
parent 9cd26af8b6
commit 9b04f41899
2 changed files with 10 additions and 2 deletions

View File

@ -230,9 +230,10 @@ _mm_max_epu32 (__m128i __V1, __m128i __V2)
* as a zero extended value, so it is unsigned.
*/
#define _mm_extract_epi8(X, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \
(unsigned char)__a[(N)];}))
(int)(unsigned char) \
__a[(N)];}))
#define _mm_extract_epi32(X, N) (__extension__ ({ __v4si __a = (__v4si)(X); \
(unsigned)__a[(N)];}))
__a[(N)];}))
#ifdef __x86_64__
#define _mm_extract_epi64(X, N) (__extension__ ({ __v2di __a = (__v2di)(X); \
__a[(N)];}))

View File

@ -55,3 +55,10 @@ unsigned long test_epi16(__m128i x) { return _mm_extract_epi16(x, 3); }
// CHECK: @test_epi16
// CHECK: extractelement <8 x i16> {{.*}}, i32 3
// CHECK: zext i16 {{.*}} to i32
void extractinttypes() {
extern int check_extract_result_int;
extern __typeof(_mm_extract_epi8(_mm_setzero_si128(), 3)) check_result_int;
extern __typeof(_mm_extract_epi16(_mm_setzero_si128(), 3)) check_result_int;
extern __typeof(_mm_extract_epi32(_mm_setzero_si128(), 3)) check_result_int;
}