[llvm] e3c26a9 - [SelectionDAG] ComputeNumSignBits - add support for rotate uniform vector amounts
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 25 10:56:06 PST 2020
Author: Simon Pilgrim
Date: 2020-01-25T18:55:47Z
New Revision: e3c26a9d1b6a9983ebba6b0fdfc55f57c8380c06
URL: https://github.com/llvm/llvm-project/commit/e3c26a9d1b6a9983ebba6b0fdfc55f57c8380c06
DIFF: https://github.com/llvm/llvm-project/commit/e3c26a9d1b6a9983ebba6b0fdfc55f57c8380c06.diff
LOG: [SelectionDAG] ComputeNumSignBits - add support for rotate uniform vector amounts
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/X86/rotate_vec.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 325a6b2d4f21..392243379f5a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -3749,7 +3749,7 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
if (Tmp == VTBits)
return VTBits;
- if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op.getOperand(1))) {
+ if (ConstantSDNode *C = isConstOrConstSplat(Op.getOperand(1))) {
unsigned RotAmt = C->getAPIntValue().urem(VTBits);
// Handle rotate right by N like a rotate left by 32-N.
diff --git a/llvm/test/CodeGen/X86/rotate_vec.ll b/llvm/test/CodeGen/X86/rotate_vec.ll
index 4df568da5410..66a108333cce 100644
--- a/llvm/test/CodeGen/X86/rotate_vec.ll
+++ b/llvm/test/CodeGen/X86/rotate_vec.ll
@@ -101,7 +101,6 @@ define <4 x i32> @rot_v4i32_mask_ashr0(<4 x i32> %a0) {
; XOP: # %bb.0:
; XOP-NEXT: vpsravd {{.*}}(%rip), %xmm0, %xmm0
; XOP-NEXT: vprotd $1, %xmm0, %xmm0
-; XOP-NEXT: vpsravd {{.*}}(%rip), %xmm0, %xmm0
; XOP-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
; XOP-NEXT: retq
;
@@ -109,7 +108,6 @@ define <4 x i32> @rot_v4i32_mask_ashr0(<4 x i32> %a0) {
; AVX512: # %bb.0:
; AVX512-NEXT: vpsravd {{.*}}(%rip), %xmm0, %xmm0
; AVX512-NEXT: vprold $1, %xmm0, %xmm0
-; AVX512-NEXT: vpsravd {{.*}}(%rip), %xmm0, %xmm0
; AVX512-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
; AVX512-NEXT: retq
%1 = ashr <4 x i32> %a0, <i32 25, i32 26, i32 27, i32 28>
More information about the llvm-commits
mailing list