Comment Comment by tambre Both recent GCC and Clang are able to generate the most optimal version for std::clamp() if you add something like -march=znver1, even at -O1 [0]. Interesting![0] https://godbolt.org/z/YsMMo7Kjz parent tambre 2 years ago
[0] https://godbolt.org/z/YsMMo7Kjz