[llvm] [RISCV] Strength reduce mul by 2^M - 3/5/9 (PR #88993)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 22:39:55 PDT 2024


================
@@ -49,19 +53,24 @@ define i64 @add_mul_combine_accept_a3(i64 %x) {
 ; RV32IMB-LABEL: add_mul_combine_accept_a3:
 ; RV32IMB:       # %bb.0:
 ; RV32IMB-NEXT:    li a2, 29
-; RV32IMB-NEXT:    mul a1, a1, a2
-; RV32IMB-NEXT:    mulhu a3, a0, a2
-; RV32IMB-NEXT:    add a1, a3, a1
-; RV32IMB-NEXT:    mul a2, a0, a2
+; RV32IMB-NEXT:    mulhu a2, a0, a2
----------------
wangpc-pp wrote:

We may have latency=2 multiply instructions on a high performance RV64 core, so this may be an regression. But this is a RV32 test (multiply won't be so fast), so I just leave this comment for record.

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


More information about the llvm-commits mailing list