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

--- Comment #21 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
(In reply to Matthias Kretz (Vir) from comment #19)
> 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.

1) we need to fix the current vector expander with !flag_rounding_math there's
different rounding mode used in the existed implementation --- roundps
$3(ROUND_TRUNC) is used.

2) The bit-manipulation solution seem correct and can drop !flag_rounding_math,
but not sure about performance(the existed solution takes only 4 uops with
-frounding-math).

Reply via email to