[Bug target/108922] fmod() 13x slowdown in gcc4.9 dropping "fprem" and calling fmod()
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Feb 27 10:58:10 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108922
--- Comment #30 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Jakub Jelinek from comment #29)
> Note, fmod_optab is only used on i?86 (where because of the commit mentioned
> here it was limited to finite math only) and rs6000 (which guards it on
> unsafe math optimizations), so both in the fast-math related area only.
> Therefore it might be very well possible it got broken because of those
> changes without anyone noticing. Most of the builtins for which ranges are
> tested are single operand and pow which has 2 has special handling...
Looking at r6-4983-g883cabdecdb052865f, fmod handled here:
+/* Return true if CALL can produce a domain error (EDOM) but can never
+ produce a pole, range overflow or range underflow error (all ERANGE).
+ This means that we can tell whether a function would have set errno
+ by testing whether the result is a NaN. */
+
+static bool
+edom_only_function (gcall *call)
+{
+ switch (DECL_FUNCTION_CODE (gimple_call_fndecl (call)))
+ {
+ CASE_FLT_FN (BUILT_IN_ACOS):
+ CASE_FLT_FN (BUILT_IN_ASIN):
+ CASE_FLT_FN (BUILT_IN_ATAN):
+ CASE_FLT_FN (BUILT_IN_COS):
+ CASE_FLT_FN (BUILT_IN_SIGNIFICAND):
+ CASE_FLT_FN (BUILT_IN_SIN):
+ CASE_FLT_FN (BUILT_IN_SQRT):
+ CASE_FLT_FN (BUILT_IN_FMOD):
+ CASE_FLT_FN (BUILT_IN_REMAINDER):
+ return true;
+
+ default:
+ return false;
+ }
+}
More information about the Gcc-bugs
mailing list