[llvm] [RISCV] Add isel optimization for (add x, (and (sra y, c2), c1)) to recover regression from #101751. (PR #104114)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 00:10:32 PDT 2024
================
@@ -1479,6 +1479,27 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
return;
}
}
+
+ // Look for (and (sra y, c2), c1) where c1 is a shifted mask with c3
+ // leading zeros and c4 trailing zeros. If c2 is greater than c3, we can
+ // use (slli (srli (srai y, c2 - c3), c3 + c4), c4).
+ if (isShiftedMask_64(C1)) {
----------------
dtcxzyw wrote:
```suggestion
if (isShiftedMask_64(C1) && !Skip) {
```
https://github.com/llvm/llvm-project/pull/104114
More information about the llvm-commits
mailing list