Skip to content

Commit

Permalink
[X86][SSE] Added ComputeNumSignBitsForTargetNode support for (V)PSRAI
Browse files Browse the repository at this point in the history
Part 2 of 3.

Differential Revision: https://reviews.llvm.org/D31347

llvm-svn: 298780
  • Loading branch information
RKSimon committed Mar 25, 2017
1 parent 5400a4d commit 6397963
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Expand Up @@ -26661,6 +26661,15 @@ unsigned X86TargetLowering::ComputeNumSignBitsForTargetNode(
return Tmp;
}

case X86ISD::VSRAI: {
SDValue Src = Op.getOperand(0);
unsigned Tmp = DAG.ComputeNumSignBits(Src, Depth + 1);
unsigned VTBits = Op.getValueType().getScalarSizeInBits();
APInt ShiftVal = cast<ConstantSDNode>(Op.getOperand(1))->getAPIntValue();
ShiftVal += Tmp;
return ShiftVal.uge(VTBits) ? VTBits : ShiftVal.getZExtValue();
}

case X86ISD::PCMPGT:
case X86ISD::PCMPEQ:
case X86ISD::CMPP:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/X86/combine-and.ll
Expand Up @@ -254,7 +254,7 @@ define <8 x i16> @ashr_mask1_v8i16(<8 x i16> %a0) {
; CHECK-LABEL: ashr_mask1_v8i16:
; CHECK: # BB#0:
; CHECK-NEXT: psraw $15, %xmm0
; CHECK-NEXT: pand {{.*}}(%rip), %xmm0
; CHECK-NEXT: psrlw $15, %xmm0
; CHECK-NEXT: retq
%1 = ashr <8 x i16> %a0, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
%2 = and <8 x i16> %1, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
Expand All @@ -265,7 +265,7 @@ define <4 x i32> @ashr_mask7_v4i32(<4 x i32> %a0) {
; CHECK-LABEL: ashr_mask7_v4i32:
; CHECK: # BB#0:
; CHECK-NEXT: psrad $31, %xmm0
; CHECK-NEXT: pand {{.*}}(%rip), %xmm0
; CHECK-NEXT: psrld $29, %xmm0
; CHECK-NEXT: retq
%1 = ashr <4 x i32> %a0, <i32 31, i32 31, i32 31, i32 31>
%2 = and <4 x i32> %1, <i32 7, i32 7, i32 7, i32 7>
Expand Down

0 comments on commit 6397963

Please sign in to comment.