Optimization of 32-bit Unsigned Division by Constants on 64-bit Targets

hackernews

Computer Science > Programming Languages

arXiv:2604.07902 (cs)

Title:Optimization of 32-bit Unsigned Division by Constants on 64-bit Targets

View PDF HTML (experimental)
Abstract:Granlund and Montgomery proposed an optimization method for unsigned integer division by constants [3]. Their method (called the GM method in this paper) was further improved in part by works such as [1] and [7], and is now adopted by major compilers including GCC, Clang, Microsoft Compiler, and Apple Clang. However, for example, for x/7, the generated code is designed for 32-bit CPUs and therefore does not fully exploit 64-bit capabilities. This paper proposes an optimization method for 32-bit unsigned division by constants targeting 64-bit CPUs. We implemented patches for LLVM/GCC and achieved speedups of 1.67x on Intel Xeon w9-3495X (Sapphire Rapids) and 1.98x on Apple M4 (Apple M-series SoC) in the microbenchmark described later. The LLVM patch has already been merged into llvm:main [6], demonstrating the practical applicability of the proposed method.
Subjects: Programming Languages (cs.PL); Hardware Architecture (cs.AR)
ACM classes: D.3.4
Cite as: arXiv:2604.07902 [cs.PL]
(or arXiv:2604.07902v1 [cs.PL] for this version)
https://doi.org/10.48550/arXiv.2604.07902

Submission history

From: Takashi Hoshino [view email]
[v1] Thu, 9 Apr 2026 07:18:31 UTC (9 KB)
Full-text links:

Access Paper:

Current browse context:
cs.PL
< prev   |   next >
Change to browse by:

References & Citations

export BibTeX citation

Bookmark

Bibliographic and Citation Tools

Bibliographic Explorer (What is the Explorer?)
Connected Papers (What is Connected Papers?)
Litmaps (What is Litmaps?)
scite Smart Citations (What are Smart Citations?)

Code, Data and Media Associated with this Article

alphaXiv (What is alphaXiv?)
CatalyzeX Code Finder for Papers (What is CatalyzeX?)
DagsHub (What is DagsHub?)
Gotit.pub (What is GotitPub?)
Hugging Face (What is Huggingface?)
ScienceCast (What is ScienceCast?)

Demos

Replicate (What is Replicate?)
Hugging Face Spaces (What is Spaces?)
TXYZ.AI (What is TXYZ.AI?)

Recommenders and Search Tools

Influence Flower (What are Influence Flowers?)
CORE Recommender (What is CORE?)

arXivLabs: experimental projects with community collaborators

arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.

Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.

Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.

Source: hackernews

arrow_back Back to News