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
This commit is contained in:
Richard Sandiford 2015-10-27 11:55:38 +00:00 committed by Richard Sandiford
parent efc8f0d8d1
commit 4e48e02be8
2 changed files with 11 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2015-10-27 Richard Sandiford <richard.sandiford@arm.com>
* builtins.c (fold_builtin_fma): Remove constant handling.
(fold_builtin_3): Handle constant fma arguments here.
2015-10-27 Richard Sandiford <richard.sandiford@arm.com>
* builtins.c (fold_builtin_fabs): Remove constant handling.

View File

@ -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)