https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125388
--- Comment #14 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> --- https://wg21.link/p4231r0 proposes the facility that would enforce the use of div[ps][hsd]. The following must not use the reciprocal even with fast-math: constexpr rounded cr; cr.div(x, y); In the meantime, I propose to resolve this issue via: M include/bits/simd_vec.h @@ -1684,7 +1684,12 @@ for (int __i = 0; __i < _S_size; ++__i) // see PR121274, PR121284, and PR121296 for missed optimizations wrt. conversions // // With only 1 or 2 divisions, the conversion to and from fp is too expensive. + // + // This optimization depends on the divp[hsd] instruction. However, with fast-math, + // division is replaced by reciprocal. + // TODO: introduce optimization barrier against reciprocal math (cf. P4231R0) if constexpr (is_integral_v<value_type> && _S_size > 2 + && !_Traits._M_reciprocal_math() && __value_preserving_convertible_to<value_type, double>) { // If the denominator (y) is known to the optimizer, don't convert to fp because the
