llvm / llvm/llvm-project

Missed optimization: `uint64_t` shift/add-by-constant lowered to `__aeabi_lmul` on Cortex-M0

Open
#183,489 4 comments 0 reactions 0 assignees View on GitHub
backend:ARM missed-optimization
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

**Problem**
For Cortex-M0 targets, LLVM optimizes a 64-bit shift & sub expression back to an equivalent 64-bit multiplication using `__aeabi_lmul`.

**Why this matters**
On Cortex-M0, `__aeabi_lmul` call overhead + software 64-bit multiply cost is substantially higher than the inline shift/add/sub sequence generated by GCC.

[https://godbolt.org/z/YqP9Kr5qx](https://godbolt.org/z/YqP9Kr5qx)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.