https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102464
--- Comment #8 from Hongtao.liu <crazylht at gmail dot com> --- (In reply to Richard Biener from comment #3) > There's related optimizations in convert () which should ideally move to > match.pd When i try to mov convert stuffs to match.pd, i find some "mismatch", there's 3 cases 1. math functions are transformed under condition "optimize" 2. math functions are transformed under condition "optimize && flag_unsafe_math_optimizations" 3. math functions are transformed under condition "optimize && flag_unsafe_math_optimizations flag_errno_maths" And for logb, it's case 1, which means it can be transformed w/o !flag_errno_maths, but according to DEF_C99_BUILTIN (BUILT_IN_LOGB, "logb", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO), !flag_errno_maths is needed and the transformation will be prevented by gimple-match-head.c:maybe_push_res_to_seq /* We can't and should not emit calls to non-const functions. */ if (!(flags_from_decl_or_type (decl) & ECF_CONST)) return NULL; /* fabsl (extend(x)) -> extend(fabsf(x)), etc., if x is a float. */ (for froms (BUILT_IN_FABS BUILT_IN_FABSL BUILT_IN_LOGB BUILT_IN_LOGBL) tos (BUILT_IN_FABSF BUILT_IN_FABSF BUILT_IN_LOGBF BUILT_IN_LOGBF) (simplify (froms (convert float_value_p@0)) (if (optimize && canonicalize_math_p () && mathfn_built_in (TREE_TYPE (@0), froms)) (convert (tos @0)))))