@@ -13007,7 +13007,7 @@ static SDValue combineVSelectWithAllOnesOrZeros(SDValue Cond, SDValue TVal,
13007
13007
bool IsFAllOne = ISD::isBuildVectorAllOnes(FVal.getNode());
13008
13008
13009
13009
// no vselect(cond, 0/-1, X) or vselect(cond, X, 0/-1), return
13010
- if (!( IsTAllZero || IsTAllOne || IsFAllZero || IsFAllOne) )
13010
+ if (!IsTAllZero && ! IsTAllOne && ! IsFAllZero && ! IsFAllOne)
13011
13011
return SDValue();
13012
13012
13013
13013
// select Cond, 0, 0 → 0
@@ -13024,6 +13024,10 @@ static SDValue combineVSelectWithAllOnesOrZeros(SDValue Cond, SDValue TVal,
13024
13024
if (CondVT.getScalarSizeInBits() != VT.getScalarSizeInBits())
13025
13025
return SDValue();
13026
13026
13027
+ // Cond value must be 'sign splat' to be converted to a logical op.
13028
+ if (DAG.ComputeNumSignBits(Cond) != CondVT.getScalarSizeInBits())
13029
+ return SDValue();
13030
+
13027
13031
// Try inverting Cond and swapping T/F if it gives all-ones/all-zeros form
13028
13032
if (!IsTAllOne && !IsFAllZero && Cond.hasOneUse() &&
13029
13033
Cond.getOpcode() == ISD::SETCC &&
@@ -13041,10 +13045,6 @@ static SDValue combineVSelectWithAllOnesOrZeros(SDValue Cond, SDValue TVal,
13041
13045
}
13042
13046
}
13043
13047
13044
- // Cond value must be 'sign splat' to be converted to a logical op.
13045
- if (DAG.ComputeNumSignBits(Cond) != CondVT.getScalarSizeInBits())
13046
- return SDValue();
13047
-
13048
13048
// select Cond, -1, 0 → bitcast Cond
13049
13049
if (IsTAllOne && IsFAllZero)
13050
13050
return DAG.getBitcast(VT, Cond);
0 commit comments