Landing: c743ce6b7554
Project / Subsystem
gcc / bpf
Date
2026-07-20
Author
Vineet Gupta
Commit
c743ce6b75543fadea31ab8d518bba363bf5e44e
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- bpf
- patch_id
- —
- commit_hash
- c743ce6b75543fadea31ab8d518bba363bf5e44e
- source_type
- github
- headline
- bpf: Reduce cost of multiply/divide to avoid synthesis
- tldr
- Lowers the cost of BPF multiply and divide operations to match native ISA, preventing unnecessary synthesis.
- author
- Vineet Gupta
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • bpf
- • optimization
- • cost model
- • isa
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-20T00:00:00.000Z
This commit reduces the estimated cost of multiplication, division, and modulo operations in GCC’s BPF backend. The default costs for these operations were high, leading the compiler to synthesize complex sequences instead of using native BPF instructions. By setting the cost for MPY, DIV, and MOD to 1, GCC now reliably generates direct BPF hardware instructions for these operations. A test case was also adjusted to ensure the signed argument handling is correct for the new cost model.