forked from OSchip/llvm-project
Suppress useless -Wshadow warning when using _mm* macros from emmintrin.h
Fixes <rdar://problem/10679282>. I'm not completely satisfied with this patch. Sprinkling "diagnostic ignored" _Pragmas throughout this file is gross, but I couldn't suppress it for the entire file. llvm-svn: 192143
This commit is contained in:
parent
db78c7049e
commit
854cc293a7
clang
|
@ -826,7 +826,9 @@ _mm_xor_si128(__m128i __a, __m128i __b)
|
|||
}
|
||||
|
||||
#define _mm_slli_si128(a, count) __extension__ ({ \
|
||||
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
|
||||
__m128i __a = (a); \
|
||||
_Pragma("clang diagnostic pop"); \
|
||||
(__m128i)__builtin_ia32_pslldqi128(__a, (count)*8); })
|
||||
|
||||
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
|
||||
|
@ -891,7 +893,9 @@ _mm_sra_epi32(__m128i __a, __m128i __count)
|
|||
|
||||
|
||||
#define _mm_srli_si128(a, count) __extension__ ({ \
|
||||
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
|
||||
__m128i __a = (a); \
|
||||
_Pragma("clang diagnostic pop"); \
|
||||
(__m128i)__builtin_ia32_psrldqi128(__a, (count)*8); })
|
||||
|
||||
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
|
||||
|
@ -1280,20 +1284,26 @@ _mm_movemask_epi8(__m128i __a)
|
|||
}
|
||||
|
||||
#define _mm_shuffle_epi32(a, imm) __extension__ ({ \
|
||||
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
|
||||
__m128i __a = (a); \
|
||||
_Pragma("clang diagnostic pop"); \
|
||||
(__m128i)__builtin_shufflevector((__v4si)__a, (__v4si) _mm_set1_epi32(0), \
|
||||
(imm) & 0x3, ((imm) & 0xc) >> 2, \
|
||||
((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6); })
|
||||
|
||||
#define _mm_shufflelo_epi16(a, imm) __extension__ ({ \
|
||||
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
|
||||
__m128i __a = (a); \
|
||||
_Pragma("clang diagnostic pop"); \
|
||||
(__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi) _mm_set1_epi16(0), \
|
||||
(imm) & 0x3, ((imm) & 0xc) >> 2, \
|
||||
((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \
|
||||
4, 5, 6, 7); })
|
||||
|
||||
#define _mm_shufflehi_epi16(a, imm) __extension__ ({ \
|
||||
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
|
||||
__m128i __a = (a); \
|
||||
_Pragma("clang diagnostic pop"); \
|
||||
(__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi) _mm_set1_epi16(0), \
|
||||
0, 1, 2, 3, \
|
||||
4 + (((imm) & 0x03) >> 0), \
|
||||
|
@ -1386,8 +1396,10 @@ _mm_movemask_pd(__m128d __a)
|
|||
}
|
||||
|
||||
#define _mm_shuffle_pd(a, b, i) __extension__ ({ \
|
||||
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\""); \
|
||||
__m128d __a = (a); \
|
||||
__m128d __b = (b); \
|
||||
_Pragma("clang diagnostic pop"); \
|
||||
__builtin_shufflevector(__a, __b, (i) & 1, (((i) & 2) >> 1) + 2); })
|
||||
|
||||
static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// RUN: %clang_cc1 -verify -fsyntax-only -fblocks -Wshadow %s
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
int i; // expected-note 3 {{previous declaration is here}}
|
||||
|
||||
void foo() {
|
||||
|
@ -59,3 +61,11 @@ void rdar8883302() {
|
|||
void test8() {
|
||||
int bob; // expected-warning {{declaration shadows a variable in the global scope}}
|
||||
}
|
||||
|
||||
// Test that using two macros from emmintrin do not cause a
|
||||
// useless -Wshadow warning.
|
||||
void rdar10679282() {
|
||||
__m128i qf = _mm_setzero_si128();
|
||||
qf = _mm_slli_si128(_mm_add_epi64(qf, _mm_srli_si128(qf, 8)), 8); // no-warning
|
||||
(void) qf;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue