[cfe-commits] r158351 - in /cfe/trunk: include/clang/Basic/BuiltinsX86.def lib/Headers/xopintrin.h test/CodeGen/xop-builtins.c

Craig Topper craig.topper at gmail.com
Mon Jun 11 23:03:36 PDT 2012


Author: ctopper
Date: Tue Jun 12 01:03:35 2012
New Revision: 158351

URL: http://llvm.org/viewvc/llvm-project?rev=158351&view=rev
Log:
Add XOP permute intrinsics.

Modified:
    cfe/trunk/include/clang/Basic/BuiltinsX86.def
    cfe/trunk/lib/Headers/xopintrin.h
    cfe/trunk/test/CodeGen/xop-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=158351&r1=158350&r2=158351&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Tue Jun 12 01:03:35 2012
@@ -697,5 +697,9 @@
 BUILTIN(__builtin_ia32_vpcomw, "V8sV8sV8sIc", "")
 BUILTIN(__builtin_ia32_vpcomd, "V4iV4iV4iIc", "")
 BUILTIN(__builtin_ia32_vpcomq, "V2LLiV2LLiV2LLiIc", "")
+BUILTIN(__builtin_ia32_vpermil2pd, "V2dV2dV2dV2LLiIc", "")
+BUILTIN(__builtin_ia32_vpermil2pd256, "V4dV4dV4dV4LLiIc", "")
+BUILTIN(__builtin_ia32_vpermil2ps, "V4fV4fV4fV4iIc", "")
+BUILTIN(__builtin_ia32_vpermil2ps256, "V8fV8fV8fV8iIc", "")
 
 #undef BUILTIN

Modified: cfe/trunk/lib/Headers/xopintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/xopintrin.h?rev=158351&r1=158350&r2=158351&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/xopintrin.h (original)
+++ cfe/trunk/lib/Headers/xopintrin.h Tue Jun 12 01:03:35 2012
@@ -342,6 +342,34 @@
   __m128i __B = (B); \
   (__m128i)__builtin_ia32_vpcomq((__v2di)__A, (__v2di)__B, (N)); })
 
+#define _mm_permute2_pd(X, Y, C, I) __extension__ ({ \
+  __m128d __X = (X); \
+  __m128d __Y = (Y); \
+  __m128i __C = (C); \
+  (__m128d)__builtin_ia32_vpermil2pd((__v2df)__X, (__v2df)__Y, \
+                                     (__v2di)__C, (I)); })
+
+#define _mm256_permute2_pd(X, Y, C, I) __extension__ ({ \
+  __m256d __X = (X); \
+  __m256d __Y = (Y); \
+  __m256i __C = (C); \
+  (__m256d)__builtin_ia32_vpermil2pd256((__v4df)__X, (__v4df)__Y, \
+                                        (__v4di)__C, (I)); })
+
+#define _mm_permute2_ps(X, Y, C, I) __extension__ ({ \
+  __m128 __X = (X); \
+  __m128 __Y = (Y); \
+  __m128i __C = (C); \
+  (__m128)__builtin_ia32_vpermil2ps((__v4sf)__X, (__v4sf)__Y, \
+                                    (__v4si)__C, (I)); })
+
+#define _mm256_permute2_ps(X, Y, C, I) __extension__ ({ \
+  __m256 __X = (X); \
+  __m256 __Y = (Y); \
+  __m256i __C = (C); \
+  (__m256)__builtin_ia32_vpermil2ps256((__v8sf)__X, (__v8sf)__Y, \
+                                       (__v8si)__C, (I)); })
+
 #endif /* __XOP__ */
 
 #endif /* __XOPINTRIN_H */

Modified: cfe/trunk/test/CodeGen/xop-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/xop-builtins.c?rev=158351&r1=158350&r2=158351&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/xop-builtins.c (original)
+++ cfe/trunk/test/CodeGen/xop-builtins.c Tue Jun 12 01:03:35 2012
@@ -274,3 +274,23 @@
   // CHECK: @llvm.x86.xop.vpcomq
   return _mm_com_epi64(a, b, 0);
 }
+
+__m128d test_mm_permute2_pd(__m128d a, __m128d b, __m128i c) {
+  // CHECK: @llvm.x86.xop.vpermil2pd
+  return _mm_permute2_pd(a, b, c, 0);
+}
+
+__m256d test_mm256_permute2_pd(__m256d a, __m256d b, __m256i c) {
+  // CHECK: @llvm.x86.xop.vpermil2pd.256
+  return _mm256_permute2_pd(a, b, c, 0);
+}
+
+__m128 test_mm_permute2_ps(__m128 a, __m128 b, __m128i c) {
+  // CHECK: @llvm.x86.xop.vpermil2ps
+  return _mm_permute2_ps(a, b, c, 0);
+}
+
+__m256 test_mm256_permute2_ps(__m256 a, __m256 b, __m256i c) {
+  // CHECK: @llvm.x86.xop.vpermil2ps.256
+  return _mm256_permute2_ps(a, b, c, 0);
+}





More information about the cfe-commits mailing list