@@ -614,11 +614,9 @@ bool MipsSEDAGToDAGISel::selectVSplatMaskL(SDValue N, SDValue &Imm) const {
614
614
615
615
if (selectVSplat (N.getNode (), ImmValue, EltTy.getSizeInBits ()) &&
616
616
ImmValue.getBitWidth () == EltTy.getSizeInBits ()) {
617
- // Extract the run of set bits starting with bit zero from the bitwise
618
- // inverse of ImmValue, and test that the inverse of this is the same
619
- // as the original value.
620
- if (ImmValue == ~(~ImmValue & ~(~ImmValue + 1 ))) {
621
-
617
+ // Check if we have a leading one, then check if the whole value is a
618
+ // shifted mask.
619
+ if (ImmValue.isNegative () && ImmValue.isShiftedMask ()) {
622
620
Imm = CurDAG->getTargetConstant (ImmValue.popcount () - 1 , SDLoc (N), EltTy);
623
621
return true ;
624
622
}
@@ -647,9 +645,7 @@ bool MipsSEDAGToDAGISel::selectVSplatMaskR(SDValue N, SDValue &Imm) const {
647
645
648
646
if (selectVSplat (N.getNode (), ImmValue, EltTy.getSizeInBits ()) &&
649
647
ImmValue.getBitWidth () == EltTy.getSizeInBits ()) {
650
- // Extract the run of set bits starting with bit zero, and test that the
651
- // result is the same as the original value
652
- if (ImmValue == (ImmValue & ~(ImmValue + 1 ))) {
648
+ if (ImmValue.isMask ()) {
653
649
Imm = CurDAG->getTargetConstant (ImmValue.popcount () - 1 , SDLoc (N), EltTy);
654
650
return true ;
655
651
}
0 commit comments