gimple-pretty-print.c (dump_ternary_rhs): Adjust gimple dump format for FMA_EXPR.

2017-02-19  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

	* gimple-pretty-print.c (dump_ternary_rhs): Adjust gimple dump format
	for FMA_EXPR.

c/
	* gimple-parser.c (c_parser_gimple_postfix_expression): Handle
	FMA_EXPR.

testsuite/
	* gcc.dg/gimplefe-26.c: New test.

From-SVN: r245570
This commit is contained in:
Prathamesh Kulkarni 2017-02-19 09:06:30 +00:00 committed by Prathamesh Kulkarni
parent 593bf80a53
commit eab1f16915
6 changed files with 70 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2017-02-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* gimple-pretty-print.c (dump_ternary_rhs): Adjust gimple dump format
for FMA_EXPR.
2017-02-18 Jakub Jelinek <jakub@redhat.com>
* final.c (last_columnnum, override_columnnum): New variables.

View File

@ -1,3 +1,8 @@
2017-02-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* gimple-parser.c (c_parser_gimple_postfix_expression): Handle
FMA_EXPR.
2017-02-16 Jakub Jelinek <jakub@redhat.com>
PR c++/79512

View File

@ -856,6 +856,28 @@ c_parser_gimple_postfix_expression (c_parser *parser)
expr.value = fold_convert (type, val);
return expr;
}
else if (strcmp (IDENTIFIER_POINTER (id), "__FMA") == 0)
{
c_parser_consume_token (parser);
auto_vec<tree> args;
if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
{
c_parser_gimple_expr_list (parser, &args);
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
"expected %<)%>");
}
if (args.length () != 3)
{
error_at (loc, "invalid number of operands to __FMA");
expr.value = error_mark_node;
return expr;
}
expr.value = build3_loc (loc, FMA_EXPR, TREE_TYPE (args[0]),
args[0], args[1], args[2]);
return expr;
}
/* SSA name. */
unsigned version, ver_offset;
if (! lookup_name (id)

View File

@ -453,11 +453,24 @@ dump_ternary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
break;
case FMA_EXPR:
dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
pp_string (buffer, " * ");
dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
pp_string (buffer, " + ");
dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
if (flags & TDF_GIMPLE)
{
pp_string (buffer, "__FMA (");
dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
pp_comma (buffer);
dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
pp_comma (buffer);
dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
pp_right_paren (buffer);
}
else
{
dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
pp_string (buffer, " * ");
dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
pp_string (buffer, " + ");
dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
}
break;
case DOT_PROD_EXPR:

View File

@ -1,3 +1,7 @@
2017-02-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* gcc.dg/gimplefe-26.c: New test.
2017-02-18 John David Anglin <danglin@gcc.gnu.org>
* g++.dg/tls/thread_local-order2.C: xfail on hppa*-*-hpux*.

View File

@ -0,0 +1,16 @@
/* { dg-do compile } */
/* { dg-options "-O -fgimple -fdump-tree-ssa-gimple" } */
#define foo(type, num) \
type __GIMPLE () foo_##num (type a, type b, type c) \
{ \
type t0; \
t0_1 = __FMA (a, b, c); \
return t0_1; \
}
foo(float, 1)
foo(double, 2)
foo(long double, 3)
/* { dg-final { scan-tree-dump-times "__FMA" 3 "ssa" } } */