From 65450d64b7ea2c26eb03dd0557703440c24a112a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 3 Feb 2011 11:53:19 +0100 Subject: re PR target/47312 (ICE: in expand_ternary_op, at optabs.c:656 with -flto -mno-sse -mxop and __builtin_fmaf()) PR target/47312 * expr.c (expand_expr_real_2) : If target doesn't expand fma, expand FMA_EXPR as fma{,f,l} call. * gcc.target/i386/pr47312.c: New test. From-SVN: r169786 --- gcc/expr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gcc/expr.c') diff --git a/gcc/expr.c b/gcc/expr.c index e6b42795b3a..df15c928bee 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -7695,6 +7695,18 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, optab opt = fma_optab; gimple def0, def2; + /* If there is no insn for FMA, emit it as __builtin_fma{,f,l} + call. */ + if (optab_handler (fma_optab, mode) == CODE_FOR_nothing) + { + tree fn = mathfn_built_in (TREE_TYPE (treeop0), BUILT_IN_FMA); + tree call_expr; + + gcc_assert (fn != NULL_TREE); + call_expr = build_call_expr (fn, 3, treeop0, treeop1, treeop2); + return expand_builtin (call_expr, target, subtarget, mode, false); + } + def0 = get_def_for_expr (treeop0, NEGATE_EXPR); def2 = get_def_for_expr (treeop2, NEGATE_EXPR); -- cgit v1.2.1