[cfe-commits] r72995 - in /cfe/trunk/lib/Headers: emmintrin.h xmmintrin.h
Eli Friedman
eli.friedman at gmail.com
Sat Jun 6 01:08:06 PDT 2009
Author: efriedma
Date: Sat Jun 6 03:08:06 2009
New Revision: 72995
URL: http://llvm.org/viewvc/llvm-project?rev=72995&view=rev
Log:
Replace more calls to builtins with generic code.
Modified:
cfe/trunk/lib/Headers/emmintrin.h
cfe/trunk/lib/Headers/xmmintrin.h
Modified: cfe/trunk/lib/Headers/emmintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?rev=72995&r1=72994&r2=72995&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/emmintrin.h (original)
+++ cfe/trunk/lib/Headers/emmintrin.h Sat Jun 6 03:08:06 2009
@@ -394,7 +394,8 @@
static inline __m128d __attribute__((__always_inline__, __nodebug__))
_mm_cvtsi32_sd(__m128d a, int b)
{
- return __builtin_ia32_cvtsi2sd(a, b);
+ a[0] = b;
+ return a;
}
static inline __m128d __attribute__((__always_inline__, __nodebug__))
@@ -675,7 +676,7 @@
static inline __m128i __attribute__((__always_inline__, __nodebug__))
_mm_mullo_epi16(__m128i a, __m128i b)
{
- return (__m128i)__builtin_ia32_pmullw128((__v8hi)a, (__v8hi)b);
+ return (__m128i)((__v8hi)a * (__v8hi)b);
}
static inline __m64 __attribute__((__always_inline__, __nodebug__))
@@ -1199,9 +1200,20 @@
return __builtin_ia32_pmovmskb128((__v16qi)a);
}
-#define _mm_shuffle_epi32(a, imm) ((__m128i)__builtin_ia32_pshufd((__v4si)(a), (imm)))
-#define _mm_shufflehi_epi16(a, imm) ((__m128i)__builtin_ia32_pshufhw((__v8hi)(a), (imm)))
-#define _mm_shufflelo_epi16(a, imm) ((__m128i)__builtin_ia32_pshuflw((__v8hi)(a), (imm)))
+#define _mm_shuffle_epi32(a, imm) \
+ ((__m128i)__builtin_shufflevector((__v4si)(a), (__v4si) {0}, \
+ (imm) & 0x3, ((imm) & 0xc) >> 2, \
+ ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6))
+#define _mm_shufflelo_epi16(a, imm) \
+ ((__m128i)__builtin_shufflevector((__v8hi)(a), (__v8hi) {0}, \
+ (imm) & 0x3, ((imm) & 0xc) >> 2, \
+ ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \
+ 4, 5, 6, 7))
+#define _mm_shufflehi_epi16(a, imm) \
+ ((__m128i)__builtin_shufflevector((__v8hi)(a), (__v8hi) {0}, 0, 1, 2, 3, \
+ 4 + ((imm) & 0x3), 4 + ((imm) & 0xc) >> 2, \
+ 4 + ((imm) & 0x30) >> 4, \
+ 4 + ((imm) & 0xc0) >> 6))
static inline __m128i __attribute__((__always_inline__, __nodebug__))
_mm_unpackhi_epi8(__m128i a, __m128i b)
@@ -1287,7 +1299,8 @@
return __builtin_ia32_movmskpd(a);
}
-#define _mm_shuffle_pd(a, b, i) (__builtin_ia32_shufpd((a), (b), (i)))
+#define _mm_shuffle_pd(a, b, i) (__builtin_shufflevector((a), (b), (i) & 1, \
+ (((i) & 2) >> 1) + 2))
static inline __m128 __attribute__((__always_inline__, __nodebug__))
_mm_castpd_ps(__m128d in)
Modified: cfe/trunk/lib/Headers/xmmintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/xmmintrin.h?rev=72995&r1=72994&r2=72995&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/xmmintrin.h (original)
+++ cfe/trunk/lib/Headers/xmmintrin.h Sat Jun 6 03:08:06 2009
@@ -673,7 +673,10 @@
return (__m64)__builtin_ia32_pmulhuw((__v4hi)a, (__v4hi)b);
}
-#define _mm_shuffle_pi16(a, n) ((__m64)__builtin_ia32_pshufw((__v4hi)a, n))
+#define _mm_shuffle_pi16(a, n) \
+ ((__m64)__builtin_shufflevector((__v4hi)(a), (__v4hi) {0}, \
+ (n) & 0x3, ((n) & 0xc) >> 2, \
+ ((n) & 0x30) >> 4, ((n) & 0xc0) >> 6))
static inline void __attribute__((__always_inline__, __nodebug__))
_mm_maskmove_si64(__m64 d, __m64 n, char *p)
@@ -711,7 +714,10 @@
__builtin_ia32_ldmxcsr(i);
}
-#define _mm_shuffle_ps(a, b, mask) (__builtin_ia32_shufps(a, b, mask))
+#define _mm_shuffle_ps(a, b, mask) \
+ (__builtin_shufflevector(a, b, (mask) & 0x3, ((mask) & 0xc) >> 2, \
+ (((mask) & 0x30) >> 4) + 4, \
+ (((mask) & 0xc0) >> 6) + 4))
static inline __m128 __attribute__((__always_inline__, __nodebug__))
_mm_unpackhi_ps(__m128 a, __m128 b)
More information about the cfe-commits
mailing list