[llvm] [RISCV][WIP] Fold (sh3add Z, (add X, (slli Y, 6))) -> (sh3add (sh3add Y, Z), X). (PR #85734)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 23:49:14 PDT 2024


================
@@ -3320,6 +3322,44 @@ bool RISCVDAGToDAGISel::selectRVVSimm5(SDValue N, unsigned Width,
   return false;
 }
 
+// Fold (sh3add Z, (add X, (slli Y, 6))) -> (sh3add (sh3add Y, Z), X).
----------------
topperc wrote:

> Is this pattern possible too? 
> 
> ```
> 
> (sh2add Z, (add X, (slli Y, 4))) -> (sh2add (sh2add Y, Z), X)
> 
> ```

Sure. As I said in the description  "There other variations of this pattern with different shift amounts that I did not handle and did not look for."

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


More information about the llvm-commits mailing list