https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127055

--- Comment #19 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
Spurious FE_INEXACT is a problem with the current ROUND implementation. But a
conforming implementation is possible:

abs_x = fabs(x);
t_abs = trunc(abs_x);
r_abs = t_abs + (abs_x - t_abs >= .5 ? 1 : 0);
return or(xor(abs_x, x), r_abs);

Alternatively, it can be implemented using bit-manipulation. I have an untested
implementation of that and it seems to have slightly lower latency (but much
higher IPC) according to llvm-mca.

Reply via email to