GCC and Clang Leave 64-bit Division on Fast Path at -O2
tetsuoai · x · 2026-08-21
Benchmarking the agenc-arena C11 region allocator revealed that both GCC 13 and Clang 18 leave a 64-bit hardware division on the fast path at -O2. The article presents the C source, the resulting assembly, and the fix. The issue stems from an overflow guard where PTRDIFFMAX / size should simplify to a sign test when count is 1, yet the compiler fails to eliminate the expensive division.
More from Infra
- Firecracker Paper: Lightweight Virtualization for Serverless — dejavucoder · 2026-08-21
- Prime Intellect Launches Open Superintelligence Stack for Agent Training — willcb · 2026-08-21
- Proposed London Datacenter to Emit 1m Tonnes of CO2 Annually — nordicinst · 2026-08-21
- Running Firecracker on M-series Macs via Nested Virtualization — dejavucoder · 2026-08-21
- MLX-LM maintainer on project focus and governance — andrejusb · 2026-08-21
- AI eats the DRAM supply: DDR5 prices up 500% in a year, back to 2007 levels — 量子位 · 2026-08-21