r/cpp • • Jun 29 '26

Comparing an Integer Division Optimisation in Clang, MSVC, and GCC

https://nukethebees.com/int-division-modulo-optimisation-differences-clang-gcc-msvc/
56 Upvotes

8 comments sorted by

View all comments

Show parent comment

8

u/erichkeane Clang Maintainer(Templates), EWG Chair Jun 30 '26

Ooof... that is special too. Looks like this is all nonsense inherited from C, so I guess I see why.

I was quite surprised that MSVC was able to beat both clang && gcc at this (it is rare for it to so handily beat them both!), so was curious why, particularly with what seems to be such an 'easy' implementation.

No idea why this choice was made, but seemingly one not enough people have cared about to file bugs against them!