summaryrefslogtreecommitdiffstats
path: root/clang/lib/Headers/smmintrin.h
diff options
context:
space:
mode:
authorFilipe Cabecinhas <me@filcab.net>2014-05-13 02:37:02 +0000
committerFilipe Cabecinhas <me@filcab.net>2014-05-13 02:37:02 +0000
commit5d289b48b11f74feee1c8b0608f37d79315b2767 (patch)
treeda6ab666130cbae67467f34fdd774cfe669736a0 /clang/lib/Headers/smmintrin.h
parent7e2b7567a8110abc5399e8c32ba180c87366e123 (diff)
downloadbcm5719-llvm-5d289b48b11f74feee1c8b0608f37d79315b2767.tar.gz
bcm5719-llvm-5d289b48b11f74feee1c8b0608f37d79315b2767.zip
Patched clang to emit x86 blends as shufflevectors.
Summary: Most of the clang header patch by Simon Pilgrim @ SCEE. Also fixed (or added) clang tests for these intrinsics. LLVM tests to make sure we get the blend instruction out of these shufflevectors are at http://reviews.llvm.org/D3600 Reviewers: eli.friedman, craig.topper, rafael Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3601 llvm-svn: 208664
Diffstat (limited to 'clang/lib/Headers/smmintrin.h')
-rw-r--r--clang/lib/Headers/smmintrin.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/clang/lib/Headers/smmintrin.h b/clang/lib/Headers/smmintrin.h
index 53b3ccb4310..6e35734f6e0 100644
--- a/clang/lib/Headers/smmintrin.h
+++ b/clang/lib/Headers/smmintrin.h
@@ -79,12 +79,18 @@
#define _mm_blend_pd(V1, V2, M) __extension__ ({ \
__m128d __V1 = (V1); \
__m128d __V2 = (V2); \
- (__m128d) __builtin_ia32_blendpd ((__v2df)__V1, (__v2df)__V2, (M)); })
+ (__m128d)__builtin_shufflevector((__v2df)__V1, (__v2df)__V2, \
+ (((M) & 0x01) ? 2 : 0), \
+ (((M) & 0x02) ? 3 : 1)); })
#define _mm_blend_ps(V1, V2, M) __extension__ ({ \
__m128 __V1 = (V1); \
__m128 __V2 = (V2); \
- (__m128) __builtin_ia32_blendps ((__v4sf)__V1, (__v4sf)__V2, (M)); })
+ (__m128)__builtin_shufflevector((__v4sf)__V1, (__v4sf)__V2, \
+ (((M) & 0x01) ? 4 : 0), \
+ (((M) & 0x02) ? 5 : 1), \
+ (((M) & 0x04) ? 6 : 2), \
+ (((M) & 0x08) ? 7 : 3)); })
static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
_mm_blendv_pd (__m128d __V1, __m128d __V2, __m128d __M)
@@ -110,7 +116,15 @@ _mm_blendv_epi8 (__m128i __V1, __m128i __V2, __m128i __M)
#define _mm_blend_epi16(V1, V2, M) __extension__ ({ \
__m128i __V1 = (V1); \
__m128i __V2 = (V2); \
- (__m128i) __builtin_ia32_pblendw128 ((__v8hi)__V1, (__v8hi)__V2, (M)); })
+ (__m128i)__builtin_shufflevector((__v8hi)__V1, (__v8hi)__V2, \
+ (((M) & 0x01) ? 8 : 0), \
+ (((M) & 0x02) ? 9 : 1), \
+ (((M) & 0x04) ? 10 : 2), \
+ (((M) & 0x08) ? 11 : 3), \
+ (((M) & 0x10) ? 12 : 4), \
+ (((M) & 0x20) ? 13 : 5), \
+ (((M) & 0x40) ? 14 : 6), \
+ (((M) & 0x80) ? 15 : 7)); })
/* SSE4 Dword Multiply Instructions. */
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
OpenPOWER on IntegriCloud