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