[llvm] [SelectionDAG] Move VSelect sign pattern check from AArch64 to general SelectionDAG (PR #151840)
    Simon Pilgrim via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sun Aug  3 01:29:02 PDT 2025
    
    
  
================
@@ -13143,7 +13143,13 @@ static SDValue combineVSelectWithAllOnesOrZeros(SDValue Cond, SDValue TVal,
       TValAPInt.isOne() &&
       ISD::isConstantSplatVectorAllOnes(Cond.getOperand(1).getNode()) &&
       ISD::isConstantSplatVectorAllOnes(FVal.getNode())) {
-    return SDValue();
+    SDValue LHS = Cond.getOperand(0);
+    SDValue ShiftC = DAG.getShiftAmountConstant(VT.getScalarSizeInBits() - 1,
+                                                VT.getScalarType(), DL);
+    SDValue ShiftAmount = DAG.getSplatBuildVector(VT, DL, ShiftC);
----------------
RKSimon wrote:
getShiftAmountConstant should be able to splat for you:
```
SDValue ShiftAmount =DAG.getShiftAmountConstant(VT.getScalarSizeInBits() - 1, VT, DL);
```
https://github.com/llvm/llvm-project/pull/151840
    
    
More information about the llvm-commits
mailing list