From: Richard Sandiford Date: Tue, 27 Oct 2015 11:55:38 +0000 (+0000) Subject: Split constant handling out of fold_builtin_fma X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4e48e02be82c63ebe6687bca93f07b76b5765261;p=gcc.git Split constant handling out of fold_builtin_fma Just makes an upcoming patch a bit clearer. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ * builtins.c (fold_builtin_fma): Remove constant handling. (fold_builtin_3): Handle constant fma arguments here. From-SVN: r229428 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f59587a693..06b27fac747 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-10-27 Richard Sandiford + + * builtins.c (fold_builtin_fma): Remove constant handling. + (fold_builtin_3): Handle constant fma arguments here. + 2015-10-27 Richard Sandiford * builtins.c (fold_builtin_fabs): Remove constant handling. diff --git a/gcc/builtins.c b/gcc/builtins.c index a03dffca782..6cd8879e12d 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -7881,18 +7881,13 @@ fold_fma (location_t loc ATTRIBUTE_UNUSED, static tree fold_builtin_fma (location_t loc, tree arg0, tree arg1, tree arg2, tree type) { + /* ??? Only expand to FMA_EXPR if it's directly supported. */ if (validate_arg (arg0, REAL_TYPE) && validate_arg (arg1, REAL_TYPE) - && validate_arg (arg2, REAL_TYPE)) - { - tree tem = fold_fma (loc, type, arg0, arg1, arg2); - if (tem) - return tem; + && validate_arg (arg2, REAL_TYPE) + && optab_handler (fma_optab, TYPE_MODE (type)) != CODE_FOR_nothing) + return fold_build3_loc (loc, FMA_EXPR, type, arg0, arg1, arg2); - /* ??? Only expand to FMA_EXPR if it's directly supported. */ - if (optab_handler (fma_optab, TYPE_MODE (type)) != CODE_FOR_nothing) - return fold_build3_loc (loc, FMA_EXPR, type, arg0, arg1, arg2); - } return NULL_TREE; } @@ -9307,8 +9302,9 @@ fold_builtin_3 (location_t loc, tree fndecl, return fold_builtin_sincos (loc, arg0, arg1, arg2); CASE_FLT_FN (BUILT_IN_FMA): + if (tree tem = fold_fma (loc, type, arg0, arg1, arg2)) + return tem; return fold_builtin_fma (loc, arg0, arg1, arg2, type); - break; CASE_FLT_FN (BUILT_IN_REMQUO): if (validate_arg (arg0, REAL_TYPE)