Commit 65450d64 by Jakub Jelinek Committed by Jakub Jelinek

re PR target/47312 (ICE: in expand_ternary_op, at optabs.c:656 with -flto…

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) <case FMA_EXPR>: If target doesn't expand
	fma, expand FMA_EXPR as fma{,f,l} call.

	* gcc.target/i386/pr47312.c: New test.

From-SVN: r169786
parent 7d58701c
2011-02-03 Jakub Jelinek <jakub@redhat.com> 2011-02-03 Jakub Jelinek <jakub@redhat.com>
PR target/47312
* expr.c (expand_expr_real_2) <case FMA_EXPR>: If target doesn't expand
fma, expand FMA_EXPR as fma{,f,l} call.
PR lto/47274 PR lto/47274
* lto-streamer-out.c (write_symbol): When writing kind and visibility, * lto-streamer-out.c (write_symbol): When writing kind and visibility,
copy them into a unsigned char variable and pass address of it to copy them into a unsigned char variable and pass address of it to
......
...@@ -7695,6 +7695,18 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, ...@@ -7695,6 +7695,18 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
optab opt = fma_optab; optab opt = fma_optab;
gimple def0, def2; 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); def0 = get_def_for_expr (treeop0, NEGATE_EXPR);
def2 = get_def_for_expr (treeop2, NEGATE_EXPR); def2 = get_def_for_expr (treeop2, NEGATE_EXPR);
......
2011-02-03 Jakub Jelinek <jakub@redhat.com> 2011-02-03 Jakub Jelinek <jakub@redhat.com>
PR target/47312
* gcc.target/i386/pr47312.c: New test.
PR target/47564 PR target/47564
* gcc.target/i386/pr47564.c: New test. * gcc.target/i386/pr47564.c: New test.
......
/* PR target/47312 */
/* { dg-do link } */
/* { dg-require-effective-target lto } */
/* { dg-require-effective-target xop } */
/* { dg-options "-O -flto -mno-sse3 -mxop" } */
extern double fma (double, double, double);
extern float fmaf (float, float, float);
extern long double fmal (long double, long double, long double);
volatile float f;
volatile double d;
volatile long double ld;
int
main ()
{
f = fmaf (f, f, f);
d = fma (d, d, d);
ld = fmal (ld, ld, ld);
asm volatile ("" : : "r" (&f), "r" (&d), "r" (&ld) : "memory");
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment