[llvm] [X86][AVX] Fix handling of out-of-bounds shift amounts in AVX2 vector logical shift nodes #83840 (PR #86922)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 04:21:25 PDT 2024


================
@@ -45566,6 +45566,19 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
     }
   }
 
+  if (N->getOpcode() == ISD::VSELECT && LHS.getOpcode() == ISD::SRL &&
+      supportedVectorVarShift(VT, Subtarget, ISD::SRL)) {
----------------
RKSimon wrote:

This should work for ISD::SHL as well:
```
  if (N->getOpcode() == ISD::VSELECT &&
      (LHS.getOpcode() == ISD::SRL || LHS.getOpcode() == ISD::SHL) &&
      supportedVectorVarShift(VT, Subtarget, LHS.getOpcode())) {
```

https://github.com/llvm/llvm-project/pull/86922


More information about the llvm-commits mailing list