Vc  1.0.0-dev
SIMD Vector Classes for C++
fix_clang_emmintrin.h
1 /*{{{
2  Copyright (C) 2013-2015 Matthias Kretz <kretz@kde.org>
3 
4  Permission to use, copy, modify, and distribute this software
5  and its documentation for any purpose and without fee is hereby
6  granted, provided that the above copyright notice appear in all
7  copies and that both that the copyright notice and this
8  permission notice and warranty disclaimer appear in supporting
9  documentation, and that the name of the author not be used in
10  advertising or publicity pertaining to distribution of the
11  software without specific, written prior permission.
12 
13  The author disclaim all warranties with regard to this
14  software, including all implied warranties of merchantability
15  and fitness. In no event shall the author be liable for any
16  special, indirect or consequential damages or any damages
17  whatsoever resulting from loss of use, data or profits, whether
18  in an action of contract, negligence or other tortious action,
19  arising out of or in connection with the use or performance of
20  this software.
21 
22 }}}*/
23 
24 #ifndef VC_COMMON_FIX_CLANG_EMMINTRIN_H_
25 #define VC_COMMON_FIX_CLANG_EMMINTRIN_H_
26 
27 #include <Vc/global.h>
28 
29 #if defined Vc_CLANG && Vc_CLANG < 0x30700
30 
31 #ifdef _mm_slli_si128
32 #undef _mm_slli_si128
33 #define _mm_slli_si128(a, count) __extension__ ({ \
34  (__m128i)__builtin_ia32_pslldqi128((__m128i)(a), (count)*8); })
35 #endif
36 
37 #ifdef _mm_srli_si128
38 #undef _mm_srli_si128
39 #define _mm_srli_si128(a, count) __extension__ ({ \
40  (__m128i)__builtin_ia32_psrldqi128((__m128i)(a), (count)*8); })
41 #endif
42 
43 #ifdef _mm_shuffle_epi32
44 #undef _mm_shuffle_epi32
45 #define _mm_shuffle_epi32(a, imm) __extension__ ({ \
46  (__m128i)__builtin_shufflevector((__v4si)(__m128i)(a), (__v4si) _mm_set1_epi32(0), \
47  (imm) & 0x3, ((imm) & 0xc) >> 2, \
48  ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6); })
49 #endif
50 
51 #ifdef _mm_shufflelo_epi16
52 #undef _mm_shufflelo_epi16
53 #define _mm_shufflelo_epi16(a, imm) __extension__ ({ \
54  (__m128i)__builtin_shufflevector((__v8hi)(__m128i)(a), (__v8hi) _mm_set1_epi16(0), \
55  (imm) & 0x3, ((imm) & 0xc) >> 2, \
56  ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \
57  4, 5, 6, 7); })
58 #endif
59 
60 #ifdef _mm_shufflehi_epi16
61 #undef _mm_shufflehi_epi16
62 #define _mm_shufflehi_epi16(a, imm) __extension__ ({ \
63  (__m128i)__builtin_shufflevector((__v8hi)(__m128i)(a), (__v8hi) _mm_set1_epi16(0), \
64  0, 1, 2, 3, \
65  4 + (((imm) & 0x03) >> 0), \
66  4 + (((imm) & 0x0c) >> 2), \
67  4 + (((imm) & 0x30) >> 4), \
68  4 + (((imm) & 0xc0) >> 6)); })
69 #endif
70 
71 #ifdef _mm_shuffle_pd
72 #undef _mm_shuffle_pd
73 #define _mm_shuffle_pd(a, b, i) __extension__ ({ \
74  __builtin_shufflevector((__m128d)(a), (__m128d)(b), (i) & 1, (((i) & 2) >> 1) + 2); })
75 #endif
76 
77 #endif // Vc_CLANG
78 
79 #endif // VC_COMMON_FIX_CLANG_EMMINTRIN_H_