https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96733
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #3) > Shouldn't this help in the library then? > > if (__hi < __lo) > __builtin_unreachable(); For integers, I guess it could if Andrew's/Aldy's stuff gets in and can be used for that, for floating point types, we don't really have any value range handling, and without -ffast-math it might be even impossible to optimize away. Can't std::clamp be implemented using std::min/std::max instead, or at least as code that can be optimized into that?