[llvm] [RISCV] Move strength reduction of mul X, 3/5/9*2^N to combine (PR #89966)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 11:14:30 PDT 2024


================
@@ -565,8 +566,8 @@ define i64 @add_mul_combine_infinite_loop(i64 %x) {
 ; RV64IMB:       # %bb.0:
 ; RV64IMB-NEXT:    addi a0, a0, 86
 ; RV64IMB-NEXT:    sh1add a0, a0, a0
-; RV64IMB-NEXT:    li a1, -16
-; RV64IMB-NEXT:    sh3add a0, a0, a1
+; RV64IMB-NEXT:    slli a0, a0, 3
+; RV64IMB-NEXT:    addi a0, a0, -16
----------------
preames wrote:

This case was previously picked up by the add_like (mul_one_use X, 24), Y pattern which didn't check whether Y is an immediate or not.  

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


More information about the llvm-commits mailing list