aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/gimple-parser.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-05-17 12:04:21 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-05-17 12:04:21 +0000
commitc4499192638ad901fc03021834eec60399bfa736 (patch)
tree86dff9166726cc0e075dfa26d8dd8072a903c3d3 /gcc/c/gimple-parser.c
parent35ee7f54686d7cba0feb5c1750ae4071db252000 (diff)
downloadgcc-c4499192638ad901fc03021834eec60399bfa736.zip
gcc-c4499192638ad901fc03021834eec60399bfa736.tar.gz
gcc-c4499192638ad901fc03021834eec60399bfa736.tar.bz2
gimple-parser.c (c_parser_gimple_statement): Handle __VEC_PERM.
2019-05-17 Richard Biener <rguenther@suse.de> c/ * gimple-parser.c (c_parser_gimple_statement): Handle __VEC_PERM. (c_parser_gimple_unary_expression): Likewise. (c_parser_gimple_parentized_ternary_expression): New function. * gimple-pretty-print.c (dump_ternary_rhs): Handle dumping VEC_PERM_EXPR as __VEC_PERM with -gimple. * gcc.dg/gimplefe-41.c: New testcase. From-SVN: r271320
Diffstat (limited to 'gcc/c/gimple-parser.c')
-rw-r--r--gcc/c/gimple-parser.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index 6a15b99..275ad91 100644
--- a/gcc/c/gimple-parser.c
+++ b/gcc/c/gimple-parser.c
@@ -746,8 +746,9 @@ 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), "__MAX") == 0
|| strcmp (IDENTIFIER_POINTER (id), "__BIT_INSERT") == 0
- || strcmp (IDENTIFIER_POINTER (id), "__MAX") == 0)
+ || strcmp (IDENTIFIER_POINTER (id), "__VEC_PERM") == 0)
goto build_unary_expr;
break;
}
@@ -1012,6 +1013,38 @@ c_parser_gimple_parentized_binary_expression (gimple_parser &parser,
return ret;
}
+/* Parse a gimple parentized binary expression. */
+
+static c_expr
+c_parser_gimple_parentized_ternary_expression (gimple_parser &parser,
+ location_t op_loc,
+ tree_code code)
+{
+ struct c_expr ret;
+ ret.set_error ();
+
+ c_parser_consume_token (parser);
+ if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+ return ret;
+ c_expr op1 = c_parser_gimple_postfix_expression (parser);
+ if (!c_parser_require (parser, CPP_COMMA, "expected %<,%>"))
+ return ret;
+ c_expr op2 = c_parser_gimple_postfix_expression (parser);
+ if (!c_parser_require (parser, CPP_COMMA, "expected %<)%>"))
+ return ret;
+ c_expr op3 = c_parser_gimple_postfix_expression (parser);
+ if (!c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>"))
+ return ret;
+
+ if (op1.value != error_mark_node
+ && op2.value != error_mark_node
+ && op3.value != error_mark_node)
+ ret.value = build3_loc (op_loc,
+ code, TREE_TYPE (op1.value),
+ op1.value, op2.value, op3.value);
+ return ret;
+}
+
/* Parse gimple unary expression.
gimple-unary-expression:
@@ -1109,6 +1142,9 @@ 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), "__VEC_PERM") == 0)
+ return c_parser_gimple_parentized_ternary_expression
+ (parser, op_loc, VEC_PERM_EXPR);
else if (strcmp (IDENTIFIER_POINTER (id), "__BIT_INSERT") == 0)
{
/* __BIT_INSERT '(' postfix-expression, postfix-expression,