[all-commits] [llvm/llvm-project] cdf26f: [RISCV] Fold (add X, (mulhs X, C)) -> (mulhsu X, C...
Craig Topper via All-commits
all-commits at lists.llvm.org
Wed Jun 3 22:12:20 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: cdf26f6721363d542865d826dd6455d448e1e860
https://github.com/llvm/llvm-project/commit/cdf26f6721363d542865d826dd6455d448e1e860
Author: Craig Topper <craig.topper at sifive.com>
Date: 2026-06-03 (Wed, 03 Jun 2026)
Changed paths:
M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
M llvm/test/CodeGen/RISCV/div-by-constant.ll
M llvm/test/CodeGen/RISCV/srem-lkk.ll
M llvm/test/CodeGen/RISCV/srem-vector-lkk.ll
Log Message:
-----------
[RISCV] Fold (add X, (mulhs X, C)) -> (mulhsu X, C) if C is negative. (#199287)
Improves some division by constant cases.
Based on this blog post
https://needlesscomplexity.substack.com/p/implementing-division-by-multiplying
Correctness proof is sketched out in the comments.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list