]> granicus.if.org Git - clang/commitdiff
Fix return type of _mm_extract_epi8 etc.
authorEli Friedman <eli.friedman@gmail.com>
Sat, 21 Sep 2013 00:05:25 +0000 (00:05 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sat, 21 Sep 2013 00:05:25 +0000 (00:05 +0000)
PR17300.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191120 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Headers/smmintrin.h
test/CodeGen/vector.c

index 498f6f0dcd86ec5b17e9ce1c71a9b19464406734..5b6db6c4456d85bb89e071dfa1ea1688cd429e64 100644 (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)];}))
index 3fa5f1441d2fd496117e9d554698e85f05123b40..6c14b7fa79ebf7b6791d8f99421b979a34b8c2b7 100644 (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;
+}