]> granicus.if.org Git - clang/commitdiff
Add XOP permute intrinsics.
authorCraig Topper <craig.topper@gmail.com>
Tue, 12 Jun 2012 06:03:35 +0000 (06:03 +0000)
committerCraig Topper <craig.topper@gmail.com>
Tue, 12 Jun 2012 06:03:35 +0000 (06:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158351 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 285548582c1332e404d34cb267720a09506ee96a..936ebfae9a78bc521808852e9ffb5c4756df3ab5 100644 (file)
@@ -697,5 +697,9 @@ BUILTIN(__builtin_ia32_vpcomb, "V16cV16cV16cIc", "")
 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
index d9689cc57fb55b925a8a4cf28c23508de205520a..a58a3ed3824dec26aa485461823755fed14deddb 100644 (file)
@@ -342,6 +342,34 @@ _mm_sha_epi64(__m128i __A, __m128i __B)
   __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 */
index 44042bd285c7cde0f52d77d84d2b6dee4942f4ac..083d371c84a555110ed1ac3101ab01ee4a96ec22 100644 (file)
@@ -274,3 +274,23 @@ __m128i test_mm_com_epi64(__m128i a, __m128i b) {
   // 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);
+}