gimple-pretty-print.c (dump_unary_rhs): Adjust dump format for ABS_EXPR for gimple dump.
2017-02-14 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> * gimple-pretty-print.c (dump_unary_rhs): Adjust dump format for ABS_EXPR for gimple dump. c/ * gimpler-parser.c (c_parser_gimple_statement): Handle ABS_EXPR. (c_parser_gimple_unary_expression): Likewise. testsuite/ * gcc.dg/gimplefe-25.c: New test. From-SVN: r245422
This commit is contained in:
parent
6a8b140878
commit
1be33173de
6 changed files with 57 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2017-02-14 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
|
||||
|
||||
* gimple-pretty-print.c (dump_unary_rhs): Adjust dump format for
|
||||
ABS_EXPR for gimple dump.
|
||||
|
||||
2017-02-14 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/79462
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2017-02-14 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
|
||||
|
||||
* gimpler-parser.c (c_parser_gimple_statement): Handle ABS_EXPR.
|
||||
(c_parser_gimple_unary_expression): Likewise.
|
||||
|
||||
2017-02-13 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* c-parser.c (c_parser_oacc_declare): Add missing space in
|
||||
|
|
|
@ -325,6 +325,13 @@ c_parser_gimple_statement (c_parser *parser, gimple_seq *seq)
|
|||
/* Unary expression. */
|
||||
switch (c_parser_peek_token (parser)->type)
|
||||
{
|
||||
case CPP_NAME:
|
||||
{
|
||||
tree id = c_parser_peek_token (parser)->value;
|
||||
if (strcmp (IDENTIFIER_POINTER (id), "__ABS") == 0)
|
||||
goto build_unary_expr;
|
||||
break;
|
||||
}
|
||||
case CPP_KEYWORD:
|
||||
if (c_parser_peek_token (parser)->keyword != RID_REALPART
|
||||
&& c_parser_peek_token (parser)->keyword != RID_IMAGPART)
|
||||
|
@ -336,6 +343,7 @@ c_parser_gimple_statement (c_parser *parser, gimple_seq *seq)
|
|||
case CPP_COMPL:
|
||||
case CPP_NOT:
|
||||
case CPP_MULT: /* pointer deref */
|
||||
build_unary_expr:
|
||||
rhs = c_parser_gimple_unary_expression (parser);
|
||||
if (rhs.value != error_mark_node)
|
||||
{
|
||||
|
@ -536,7 +544,7 @@ c_parser_gimple_binary_expression (c_parser *parser)
|
|||
unary-operator gimple-postfix-expression
|
||||
|
||||
unary-operator: one of
|
||||
& * + - ~
|
||||
& * + - ~ abs_expr
|
||||
*/
|
||||
|
||||
static c_expr
|
||||
|
@ -600,6 +608,18 @@ c_parser_gimple_unary_expression (c_parser *parser)
|
|||
default:
|
||||
return c_parser_gimple_postfix_expression (parser);
|
||||
}
|
||||
case CPP_NAME:
|
||||
{
|
||||
tree id = c_parser_peek_token (parser)->value;
|
||||
if (strcmp (IDENTIFIER_POINTER (id), "__ABS") == 0)
|
||||
{
|
||||
c_parser_consume_token (parser);
|
||||
op = c_parser_gimple_postfix_expression (parser);
|
||||
return parser_build_unary_op (op_loc, ABS_EXPR, op);
|
||||
}
|
||||
else
|
||||
return c_parser_gimple_postfix_expression (parser);
|
||||
}
|
||||
default:
|
||||
return c_parser_gimple_postfix_expression (parser);
|
||||
}
|
||||
|
|
|
@ -323,9 +323,17 @@ dump_unary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
|
|||
break;
|
||||
|
||||
case ABS_EXPR:
|
||||
pp_string (buffer, "ABS_EXPR <");
|
||||
dump_generic_node (buffer, rhs, spc, flags, false);
|
||||
pp_greater (buffer);
|
||||
if (flags & TDF_GIMPLE)
|
||||
{
|
||||
pp_string (buffer, "__ABS ");
|
||||
dump_generic_node (buffer, rhs, spc, flags, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
pp_string (buffer, "ABS_EXPR <");
|
||||
dump_generic_node (buffer, rhs, spc, flags, false);
|
||||
pp_greater (buffer);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2017-02-14 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
|
||||
|
||||
* gcc.dg/gimplefe-25.c: New test.
|
||||
|
||||
2017-02-14 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/79408
|
||||
|
|
11
gcc/testsuite/gcc.dg/gimplefe-25.c
Normal file
11
gcc/testsuite/gcc.dg/gimplefe-25.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -fgimple -fdump-tree-ssa-gimple" } */
|
||||
|
||||
int __GIMPLE() f(int a)
|
||||
{
|
||||
int t0;
|
||||
t0_1 = __ABS a;
|
||||
return t0_1;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump "__ABS a" "ssa" } } */
|
Loading…
Add table
Reference in a new issue