r/cpp • • Feb 16 '26

Favorite optimizations ??

I'd love to hear stories about people's best feats of optimization, or something small you are able to use often!

134 Upvotes

185 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Feb 18 '26

[deleted] — view deleted comment

1

u/James20k P2005R0 Feb 18 '26 edited Feb 20 '26

not replace mul+add with FMA unless allowed explicitly

I've linked explicit documentation that indicates that clang defaults this to on, I'd ask that you at least read the comments you reply to

This permits operation fusing, and Clang takes advantage of this by default (on)

if the HW cannot do that, you are out of spec anyway.

Where does it say in the C++ standard that floats must be IEEE?