This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [sh] Add flag_unsafe_math_optimizations to sincossf3
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: Richard Sandiford <richard dot sandiford at arm dot com>, gcc-patches at gcc dot gnu dot org
- Cc: kkojima at gcc dot gnu dot org, olegendo at gcc dot gnu dot org
- Date: Sat, 07 Nov 2015 22:34:44 +0900
- Subject: Re: [sh] Add flag_unsafe_math_optimizations to sincossf3
- Authentication-results: sourceware.org; auth=none
- References: <87d1vmos7v dot fsf at e105548-lin dot cambridge dot arm dot com>
On Sat, 2015-11-07 at 13:27 +0000, Richard Sandiford wrote:
> builtins.c uses the following code to guard expansions involving
> optabs:
>
> CASE_FLT_FN (BUILT_IN_EXP):
> CASE_FLT_FN (BUILT_IN_EXP10):
> CASE_FLT_FN (BUILT_IN_POW10):
> CASE_FLT_FN (BUILT_IN_EXP2):
> CASE_FLT_FN (BUILT_IN_EXPM1):
> CASE_FLT_FN (BUILT_IN_LOGB):
> CASE_FLT_FN (BUILT_IN_LOG):
> CASE_FLT_FN (BUILT_IN_LOG10):
> CASE_FLT_FN (BUILT_IN_LOG2):
> CASE_FLT_FN (BUILT_IN_LOG1P):
> CASE_FLT_FN (BUILT_IN_TAN):
> CASE_FLT_FN (BUILT_IN_ASIN):
> CASE_FLT_FN (BUILT_IN_ACOS):
> CASE_FLT_FN (BUILT_IN_ATAN):
> CASE_FLT_FN (BUILT_IN_SIGNIFICAND):
> /* Treat these like sqrt only if unsafe math optimizations are
> allowed,
> because of possible accuracy problems. */
> if (! flag_unsafe_math_optimizations)
> break;
> [...]
> CASE_FLT_FN (BUILT_IN_ILOGB):
> if (! flag_unsafe_math_optimizations)
> break;
> [...]
> CASE_FLT_FN (BUILT_IN_ATAN2):
> CASE_FLT_FN (BUILT_IN_LDEXP):
> CASE_FLT_FN (BUILT_IN_SCALB):
> CASE_FLT_FN (BUILT_IN_SCALBN):
> CASE_FLT_FN (BUILT_IN_SCALBLN):
> if (! flag_unsafe_math_optimizations)
> break;
> [...]
> CASE_FLT_FN (BUILT_IN_SIN):
> CASE_FLT_FN (BUILT_IN_COS):
> if (! flag_unsafe_math_optimizations)
> break;
> [...]
> CASE_FLT_FN (BUILT_IN_SINCOS):
> if (! flag_unsafe_math_optimizations)
> break;
>
> I think it's really up to the optab to decide whether it's safe
> for !flag_unsafe_math_optimizations or not, and AFAICT, all optabs
> but sh.md:sincossf3 already check. This patch makes the sh pattern
> check too.
In sh.c (sh_option_override) TARGET_FSCA is enabled only when
flag_unsafe_math_optimizations != 0. Thus another check in the
patterns is not done. However, there is PR 67723 and the fix for it
will probably be checking all the necessary flags in the pattern
conditions or something like that. Thus, please feel free to commit.
Cheers,
Oleg