[cfe-commits] r110766 - in /cfe/trunk: include/clang/Basic/BuiltinsX86.def lib/Headers/avxintrin.h test/CodeGen/builtins-x86.c
Bruno Cardoso Lopes
bruno.cardoso at gmail.com
Tue Aug 10 18:17:34 PDT 2010
Author: bruno
Date: Tue Aug 10 20:17:34 2010
New Revision: 110766
URL: http://llvm.org/viewvc/llvm-project?rev=110766&view=rev
Log:
Remove 256-bit shuffle built-ins and make the AVX intrinsic call llvm __builtin_shufflevector with the appropriate arguments
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avxintrin.h
cfe/trunk/test/CodeGen/builtins-x86.c
Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=110766&r1=110765&r2=110766&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Tue Aug 10 20:17:34 2010
@@ -346,8 +346,6 @@
BUILTIN(__builtin_ia32_blendvpd256, "V4dV4dV4dV4d", "")
BUILTIN(__builtin_ia32_blendvps256, "V8fV8fV8fV8f", "")
BUILTIN(__builtin_ia32_dpps256, "V8fV8fV8fi", "")
-BUILTIN(__builtin_ia32_shufpd256, "V4dV4dV4dc", "")
-BUILTIN(__builtin_ia32_shufps256, "V8fV8fV8fc", "")
BUILTIN(__builtin_ia32_cmppd256, "V4dV4dV4dc", "")
BUILTIN(__builtin_ia32_cmpps256, "V8fV8fV8fc", "")
BUILTIN(__builtin_ia32_vextractf128_pd256, "V2dV4dc", "")
Modified: cfe/trunk/lib/Headers/avxintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avxintrin.h?rev=110766&r1=110765&r2=110766&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avxintrin.h (original)
+++ cfe/trunk/lib/Headers/avxintrin.h Tue Aug 10 20:17:34 2010
@@ -340,17 +340,19 @@
}
/* Vector shuffle */
-static __inline __m256d __attribute__((__always_inline__, __nodebug__))
-_mm256_shuffle_pd(__m256d a, __m256d b, const int s)
-{
- return (__m256d)__builtin_ia32_shufpd256((__v4df)a, (__v4df)b, s);
-}
-
-static __inline __m256 __attribute__((__always_inline__, __nodebug__))
-_mm256_shuffle_ps(__m256 a, __m256 b, const int s)
-{
- return (__m256)__builtin_ia32_shufps256((__v8sf)a, (__v8sf)b, s);
-}
+#define _mm256_shuffle_ps(a, b, mask) \
+ (__builtin_shufflevector((__v8sf)(a), (__v8sf)(b), \
+ (mask) & 0x3, ((mask) & 0xc) >> 2, \
+ (((mask) & 0x30) >> 4) + 8, (((mask) & 0xc0) >> 6) + 8 \
+ (mask) & 0x3 + 4, (((mask) & 0xc) >> 2) + 4, \
+ (((mask) & 0x30) >> 4) + 12, (((mask) & 0xc0) >> 6) + 12))
+
+#define _mm256_shuffle_pd(a, b, mask) \
+ (__builtin_shufflevector((__v4df)(a), (__v4df)(b), \
+ (mask) & 0x1, \
+ (((mask) & 0x2) >> 1) + 4, \
+ (((mask) & 0x4) >> 2) + 2, \
+ (((mask) & 0x8) >> 3) + 6))
/* Compare */
#define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */
Modified: cfe/trunk/test/CodeGen/builtins-x86.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-x86.c?rev=110766&r1=110765&r2=110766&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-x86.c (original)
+++ cfe/trunk/test/CodeGen/builtins-x86.c Tue Aug 10 20:17:34 2010
@@ -409,8 +409,6 @@
tmp_V4d = __builtin_ia32_blendvpd256(tmp_V4d, tmp_V4d, tmp_V4d);
tmp_V8f = __builtin_ia32_blendvps256(tmp_V8f, tmp_V8f, tmp_V8f);
tmp_V8f = __builtin_ia32_dpps256(tmp_V8f, tmp_V8f, 0x7);
- tmp_V4d = __builtin_ia32_shufpd256(tmp_V4d, tmp_V4d, 0x7);
- tmp_V8f = __builtin_ia32_shufps256(tmp_V8f, tmp_V8f, 0x7);
tmp_V4d = __builtin_ia32_cmppd256(tmp_V4d, tmp_V4d, 0);
tmp_V8f = __builtin_ia32_cmpps256(tmp_V8f, tmp_V8f, 0);
tmp_V2d = __builtin_ia32_vextractf128_pd256(tmp_V4d, 0x7);
More information about the cfe-commits
mailing list