https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87105
--- Comment #4 from Petr <kobalicek.petr at gmail dot com> --- I think this code is vectorizable without --fast-math. However, it seems that once a min/max (or something else) is kept scalar it poisons the rest of the code. The following code works perfectly (scalar): ``` #include <algorithm> template<typename T> constexpr T altMinT(const T& a, const T& b) noexcept { return b < a ? b : a; } template<typename T> constexpr T altMaxT(const T& a, const T& b) noexcept { return a < b ? b : a; } double std_min(double a, double b) { return std::min(a, b); } double std_max(double a, double b) { return std::max(a, b); } double alt_min(double a, double b) { return altMinT(a, b); } double alt_max(double a, double b) { return altMaxT(a, b); } ``` I think that's the main problem - little samples are optimized well, complex code isn't.