[PATCH] D75897: [X86] Support intrinsic _mm_broadcastsi128_si256

Kan Shengchen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 10 02:19:52 PDT 2020


skan created this revision.
skan added reviewers: LuoYuanke, craig.topper, RKSimon, pengfei.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75897

Files:
  clang/lib/Headers/avx2intrin.h
  clang/test/CodeGen/avx2-builtins.c


Index: clang/test/CodeGen/avx2-builtins.c
===================================================================
--- clang/test/CodeGen/avx2-builtins.c
+++ clang/test/CodeGen/avx2-builtins.c
@@ -208,6 +208,12 @@
   return _mm256_broadcastsi128_si256(a);
 }
 
+__m256i test_mm_broadcastsi128_si256(__m128i a) {
+  // CHECK-LABEL: test_mm_broadcastsi128_si256
+  // CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
+  return _mm_broadcastsi128_si256(a);
+}
+
 __m128 test_mm_broadcastss_ps(__m128 a) {
   // CHECK-LABEL: test_mm_broadcastss_ps
   // CHECK-NOT: @llvm.x86.avx2.vbroadcast.ss.ps
Index: clang/lib/Headers/avx2intrin.h
===================================================================
--- clang/lib/Headers/avx2intrin.h
+++ clang/lib/Headers/avx2intrin.h
@@ -740,6 +740,8 @@
   return (__m256i)__builtin_shufflevector((__v2di)__X, (__v2di)__X, 0, 1, 0, 1);
 }
 
+#define _mm_broadcastsi128_si256(X) _mm256_broadcastsi128_si256(X)
+
 #define _mm_blend_epi32(V1, V2, M) \
   (__m128i)__builtin_ia32_pblendd128((__v4si)(__m128i)(V1), \
                                      (__v4si)(__m128i)(V2), (int)(M))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75897.249288.patch
Type: text/x-patch
Size: 1162 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200310/512c118d/attachment.bin>


More information about the cfe-commits mailing list