[cfe-commits] r154777 - in /cfe/trunk: include/clang/Basic/BuiltinsX86.def lib/Headers/avx2intrin.h test/CodeGen/avx2-builtins.c

Craig Topper craig.topper at gmail.com
Sun Apr 15 15:18:10 PDT 2012


Author: ctopper
Date: Sun Apr 15 17:18:10 2012
New Revision: 154777

URL: http://llvm.org/viewvc/llvm-project?rev=154777&view=rev
Log:
Change _mm256_permute4x64_epi64 and _mm256_permute4x64_pd to use builtin_shufflevector instead of specific builtins. Old builtins will be removed from llvm now that vpermq/vpermpd are supported by shuffle lowering code.

Modified:
    cfe/trunk/include/clang/Basic/BuiltinsX86.def
    cfe/trunk/lib/Headers/avx2intrin.h
    cfe/trunk/test/CodeGen/avx2-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=154777&r1=154776&r2=154777&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Sun Apr 15 17:18:10 2012
@@ -560,9 +560,7 @@
 BUILTIN(__builtin_ia32_pbroadcastd128, "V4iV4i", "")
 BUILTIN(__builtin_ia32_pbroadcastq128, "V2LLiV2LLi", "")
 BUILTIN(__builtin_ia32_permvarsi256, "V8iV8iV8i", "")
-BUILTIN(__builtin_ia32_permdf256, "V4dV4dIc", "")
 BUILTIN(__builtin_ia32_permvarsf256, "V8fV8fV8f", "")
-BUILTIN(__builtin_ia32_permdi256, "V4LLiV4LLiIc", "")
 BUILTIN(__builtin_ia32_extract128i256, "V2LLiV4LLiIc", "")
 BUILTIN(__builtin_ia32_insert128i256, "V4LLiV4LLiV2LLiIc", "")
 BUILTIN(__builtin_ia32_maskloadd256, "V8iV8iC*V8i", "")

Modified: cfe/trunk/lib/Headers/avx2intrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx2intrin.h?rev=154777&r1=154776&r2=154777&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx2intrin.h (original)
+++ cfe/trunk/lib/Headers/avx2intrin.h Sun Apr 15 17:18:10 2012
@@ -822,7 +822,9 @@
 
 #define _mm256_permute4x64_pd(V, M) __extension__ ({ \
   __m256d __V = (V); \
-  (__m256d)__builtin_ia32_permdf256((__v4df)__V, (M)); })
+  (__m256d)__builtin_shufflevector((__v4df)__V, (__v4df) _mm256_setzero_pd(), \
+                                   (M) & 0x3, ((M) & 0xc) >> 2, \
+                                   ((M) & 0x30) >> 4, ((M) & 0xc0) >> 6); })
 
 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
 _mm256_permutevar8x32_ps(__m256 a, __m256 b)
@@ -832,7 +834,9 @@
 
 #define _mm256_permute4x64_epi64(V, M) __extension__ ({ \
   __m256i __V = (V); \
-  (__m256i)__builtin_ia32_permdi256(__V, (M)); })
+  (__m256i)__builtin_shufflevector((__v4di)__V, (__v4di) _mm256_setzero_si256(), \
+                                   (M) & 0x3, ((M) & 0xc) >> 2, \
+                                   ((M) & 0x30) >> 4, ((M) & 0xc0) >> 6); })
 
 #define _mm256_permute2x128_si256(V1, V2, M) __extension__ ({ \
   __m256i __V1 = (V1); \

Modified: cfe/trunk/test/CodeGen/avx2-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx2-builtins.c?rev=154777&r1=154776&r2=154777&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx2-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx2-builtins.c Sun Apr 15 17:18:10 2012
@@ -662,7 +662,7 @@
 }
 
 __m256d test_mm256_permute4x64_pd(__m256d a) {
-  // CHECK: @llvm.x86.avx2.permpd
+  // CHECK: shufflevector{{.*}}<i32 1, i32 2, i32 1, i32 0>
   return _mm256_permute4x64_pd(a, 25);
 }
 
@@ -672,7 +672,7 @@
 }
 
 __m256i test_mm256_permute4x64_epi64(__m256i a) {
-  // CHECK:  @llvm.x86.avx2.permq
+  // CHECK: shufflevector{{.*}}<i32 3, i32 0, i32 2, i32 0>
   return _mm256_permute4x64_epi64(a, 35);
 }
 





More information about the cfe-commits mailing list