[PATCH] D42437: X86: Update isVectorShiftByScalarCheap with cases covered by AVX512BW

Zvi Rackover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 23 12:11:08 PST 2018


zvi created this revision.
zvi added reviewers: craig.topper, RKSimon, spatel.
Herald added subscribers: tschuett, rengolin.

AVX512BW adds support for variable shift amount for 16-bit element
vectors.


Repository:
  rL LLVM

https://reviews.llvm.org/D42437

Files:
  lib/Target/X86/X86ISelLowering.cpp
  test/Transforms/CodeGenPrepare/X86/x86-shuffle-sink.ll


Index: test/Transforms/CodeGenPrepare/X86/x86-shuffle-sink.ll
===================================================================
--- test/Transforms/CodeGenPrepare/X86/x86-shuffle-sink.ll
+++ test/Transforms/CodeGenPrepare/X86/x86-shuffle-sink.ll
@@ -25,13 +25,27 @@
 }
 
 define <8 x i16> @test_16bit(<8 x i16> %lhs, <8 x i16> %tmp, i1 %tst) {
-; CHECK-LABEL: @test_16bit
-; CHECK: if_true:
-; CHECK-NOT: shufflevector
-
-; CHECK: if_false:
-; CHECK: [[SPLAT:%[0-9a-zA-Z_]+]] = shufflevector
-; CHECK: shl <8 x i16> %lhs, [[SPLAT]]
+; CHECK-SSE2-LABEL: @test_16bit
+; CHECK-SSE2: if_true:
+; CHECK-SSE2-NOT: shufflevector
+; CHECK-SSE2: if_false:
+; CHECK-SSE2: [[SPLAT:%[0-9a-zA-Z_]+]] = shufflevector
+; CHECK-SSE2: shl <8 x i16> %lhs, [[SPLAT]]
+
+; CHECK-AVX2-LABEL: @test_16bit
+; CHECK-AVX2: if_true:
+; CHECK-AVX2-NOT: shufflevector
+; CHECK-AVX2: if_false:
+; CHECK-AVX2: [[SPLAT:%[0-9a-zA-Z_]+]] = shufflevector
+; CHECK-AVX2: shl <8 x i16> %lhs, [[SPLAT]]
+
+; CHECK-AVX512BW-LABEL: @test_16bit
+; CHECK-AVX512BW: [[SPLAT:%[0-9a-zA-Z_]+]] = shufflevector
+; CHECK-AVX512BW: if_true:
+; CHECK-AVX512BW-NOT: shufflevector
+; CHECK-AVX512BW: if_false:
+; CHECK-AVX512BW-NOT: shufflevector
+; CHECK-AVX512BW: shl <8 x i16> %lhs, [[SPLAT]]
   %mask = shufflevector <8 x i16> %tmp, <8 x i16> undef, <8 x i32> zeroinitializer
   br i1 %tst, label %if_true, label %if_false
 
Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -25658,6 +25658,10 @@
   if (Subtarget.hasAVX2() && (Bits == 32 || Bits == 64))
     return false;
 
+  // AVX512BW has shifts such as vpsllvw.
+  if (Subtarget.hasBWI() && Bits == 16)
+      return false;
+
   // Otherwise, it's significantly cheaper to shift by a scalar amount than by a
   // fully general vector.
   return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42437.131127.patch
Type: text/x-patch
Size: 1905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180123/4375e796/attachment.bin>


More information about the llvm-commits mailing list