diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ddcd7e258cc..b8c658d1c83 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-05-16 Richard Biener + + * gimple-pretty-print.c (dump_ternary_rhs): Dump BIT_INSERT_EXPR + as __BIT_INSERT with -gimple. + 2019-05-15 Jakub Jelinek * omp-low.c (lower_rec_input_clauses): For if (0) or simdlen (1) set diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 8b9465fd7c6..c42d67a3e32 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2019-05-16 Richard Biener + + * gimple-parser.c (c_parser_gimple_statement): Handle __BIT_INSERT. + (c_parser_gimple_unary_expression): Likewise. + 2019-05-15 Richard Biener * gimple-parser.c (c_parser_gimple_postfix_expression): Handle diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index 07ec1e407b2..6a15b99c215 100644 --- a/gcc/c/gimple-parser.c +++ b/gcc/c/gimple-parser.c @@ -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); } diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 58212c4dcc1..c1c08644638 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -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: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 835963b8f03..2ca1d277804 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-05-16 Richard Biener + + * gcc.dg/gimplefe-40.c: Amend again. + 2019-05-15 Cherry Zhang * go.test/test/nilptr2.go: Change use function to actually do diff --git a/gcc/testsuite/gcc.dg/gimplefe-40.c b/gcc/testsuite/gcc.dg/gimplefe-40.c index 58a8ac5553e..3939066d1b5 100644 --- a/gcc/testsuite/gcc.dg/gimplefe-40.c +++ b/gcc/testsuite/gcc.dg/gimplefe-40.c @@ -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; }