Daniel Lemire personal blog

The surprising cleverness of modern compilers

I wanted to know how a modern C compiler like clang would process the following C code: #include <stdint.h> int count(uint64_t x) { int v = 0; while(x != 0) { x &= x - 1; v++; } return v; } Can you guess? popcntq %rdi, %rax That is right. A fairly sophisticated C function, … Continue reading The surprising cleverness…
Points
144
HN comments
83
Submissions
1
Cited by
4 commenters

Systems & PerformanceSoftware Engineering2016

On Hacker News

SubmittedTitle on HNPointsComments
May 24, 2016The surprising cleverness of modern compilers by kiyanwang14483

Cited in comments

Linked from 4 Hacker News comments by 4 different people, from Jul 2016 to Jan 2025.

Most recent:

Search every comment that links here →

More from Daniel Lemire

All 87 posts →

Related posts from the same era