[SelectionDAG] ComputeNumSignBits - add support for rotate non-uniform vector amounts

This commit is contained in:
Simon Pilgrim 2020-01-25 19:15:05 +00:00
parent e3c26a9d1b
commit 3f8916b2e8
2 changed files with 4 additions and 7 deletions

View File

@ -3749,7 +3749,8 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
if (Tmp == VTBits)
return VTBits;
if (ConstantSDNode *C = isConstOrConstSplat(Op.getOperand(1))) {
if (ConstantSDNode *C =
isConstOrConstSplat(Op.getOperand(1), DemandedElts)) {
unsigned RotAmt = C->getAPIntValue().urem(VTBits);
// Handle rotate right by N like a rotate left by 32-N.

View File

@ -121,20 +121,16 @@ define <4 x i32> @rot_v4i32_mask_ashr1(<4 x i32> %a0) {
; XOP-LABEL: rot_v4i32_mask_ashr1:
; XOP: # %bb.0:
; XOP-NEXT: vpsrad $25, %xmm0, %xmm0
; XOP-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2,3,4]
; XOP-NEXT: vprotd %xmm1, %xmm0, %xmm0
; XOP-NEXT: vprotd $1, %xmm0, %xmm0
; XOP-NEXT: vpbroadcastd %xmm0, %xmm0
; XOP-NEXT: vpsravd %xmm1, %xmm0, %xmm0
; XOP-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
; XOP-NEXT: retq
;
; AVX512-LABEL: rot_v4i32_mask_ashr1:
; AVX512: # %bb.0:
; AVX512-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2,3,4]
; AVX512-NEXT: vpsrad $25, %xmm0, %xmm0
; AVX512-NEXT: vprolvd %xmm1, %xmm0, %xmm0
; AVX512-NEXT: vprold $1, %xmm0, %xmm0
; AVX512-NEXT: vpbroadcastd %xmm0, %xmm0
; AVX512-NEXT: vpsravd %xmm1, %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>