gimple-parser.c (c_parser_gimple_statement): Handle __BIT_INSERT.

2019-05-16  Richard Biener  <rguenther@suse.de>

	c/
	* gimple-parser.c (c_parser_gimple_statement): Handle __BIT_INSERT.
	(c_parser_gimple_unary_expression): Likewise.

	* gimple-pretty-print.c (dump_ternary_rhs): Dump BIT_INSERT_EXPR
	as __BIT_INSERT with -gimple.

	* gcc.dg/gimplefe-40.c: Amend again.

From-SVN: r271278
This commit is contained in:
Richard Biener 2019-05-16 08:01:09 +00:00 committed by Richard Biener
parent f6b2daaf4e
commit adfe6e4b2f
6 changed files with 79 additions and 17 deletions

View File

@ -1,3 +1,8 @@
2019-05-16 Richard Biener <rguenther@suse.de>
* gimple-pretty-print.c (dump_ternary_rhs): Dump BIT_INSERT_EXPR
as __BIT_INSERT with -gimple.
2019-05-15 Jakub Jelinek <jakub@redhat.com>
* omp-low.c (lower_rec_input_clauses): For if (0) or simdlen (1) set

View File

@ -1,3 +1,8 @@
2019-05-16 Richard Biener <rguenther@suse.de>
* gimple-parser.c (c_parser_gimple_statement): Handle __BIT_INSERT.
(c_parser_gimple_unary_expression): Likewise.
2019-05-15 Richard Biener <rguenther@suse.de>
* gimple-parser.c (c_parser_gimple_postfix_expression): Handle

View File

@ -746,6 +746,7 @@ c_parser_gimple_statement (gimple_parser &parser, gimple_seq *seq)
if (strcmp (IDENTIFIER_POINTER (id), "__ABS") == 0
|| strcmp (IDENTIFIER_POINTER (id), "__ABSU") == 0
|| strcmp (IDENTIFIER_POINTER (id), "__MIN") == 0
|| strcmp (IDENTIFIER_POINTER (id), "__BIT_INSERT") == 0
|| strcmp (IDENTIFIER_POINTER (id), "__MAX") == 0)
goto build_unary_expr;
break;
@ -1108,6 +1109,37 @@ c_parser_gimple_unary_expression (gimple_parser &parser)
return c_parser_gimple_parentized_binary_expression (parser,
op_loc,
MAX_EXPR);
else if (strcmp (IDENTIFIER_POINTER (id), "__BIT_INSERT") == 0)
{
/* __BIT_INSERT '(' postfix-expression, postfix-expression,
integer ')' */
location_t loc = c_parser_peek_token (parser)->location;
c_parser_consume_token (parser);
if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
{
c_expr op0 = c_parser_gimple_postfix_expression (parser);
c_parser_skip_until_found (parser, CPP_COMMA,
"expected %<,%>");
c_expr op1 = c_parser_gimple_postfix_expression (parser);
c_parser_skip_until_found (parser, CPP_COMMA,
"expected %<,%>");
c_expr op2 = c_parser_gimple_postfix_expression (parser);
if (TREE_CODE (op2.value) != INTEGER_CST
|| !int_fits_type_p (op2.value, bitsizetype))
c_parser_error (parser, "expected constant offset");
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
"expected %<)%>");
if (op0.value != error_mark_node
&& op1.value != error_mark_node
&& TREE_CODE (op2.value) == INTEGER_CST)
ret.value = build3_loc (loc, BIT_INSERT_EXPR,
TREE_TYPE (op0.value),
op0.value, op1.value,
fold_convert (bitsizetype,
op2.value));
}
return ret;
}
else
return c_parser_gimple_postfix_expression (parser);
}

View File

@ -567,21 +567,35 @@ dump_ternary_rhs (pretty_printer *buffer, gassign *gs, int spc,
break;
case BIT_INSERT_EXPR:
pp_string (buffer, "BIT_INSERT_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);
pp_string (buffer, " (");
if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs))))
pp_decimal_int (buffer,
TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs2 (gs))));
if (flags & TDF_GIMPLE)
{
pp_string (buffer, "__BIT_INSERT (");
dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc,
flags | TDF_SLIM, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc,
flags | TDF_SLIM, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc,
flags | TDF_SLIM, false);
pp_right_paren (buffer);
}
else
dump_generic_node (buffer,
TYPE_SIZE (TREE_TYPE (gimple_assign_rhs2 (gs))),
spc, flags, false);
pp_string (buffer, " bits)>");
{
pp_string (buffer, "BIT_INSERT_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);
pp_string (buffer, " (");
if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs))))
pp_decimal_int (buffer, TYPE_PRECISION
(TREE_TYPE (gimple_assign_rhs2 (gs))));
}
break;
default:

View File

@ -1,3 +1,7 @@
2019-05-16 Richard Biener <rguenther@suse.de>
* gcc.dg/gimplefe-40.c: Amend again.
2019-05-15 Cherry Zhang <cherryyz@google.com>
* go.test/test/nilptr2.go: Change use function to actually do

View File

@ -1,12 +1,13 @@
/* { dg-do compile { target int128 } } */
/* { dg-options "-fgimple" } */
/* { dg-options "-fgimple -Wno-psabi -w" } */
typedef float v4sf __attribute__((vector_size(16)));
float __GIMPLE (ssa)
v4sf __GIMPLE (ssa)
load (const void * p)
{
__int128 unsigned _3;
v4sf _4;
v4sf _6;
float _5;
__BB(2):
@ -17,5 +18,6 @@ load (const void * p)
#else
_5 = 1.0f;
#endif
return _5;
_6 = __BIT_INSERT (_4, _5, 0);
return _6;
}