From 96285749d88e8bf954b7e977d43e5cb947357ce5 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 26 Oct 2015 09:18:30 +0000 Subject: Move cexp simplifications to match.pd This required reinstating support for captures in the result of a simplification. That part (genmatch.c) is by Richard B. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ 2015-10-20 Richard Sandiford Richard Biener * genmatch.c (dt_simplify::gen): Skip captures that are part of the result. (parser::parse_expr): Allow captures in results too. * builtins.c (fold_builtin_cexp): Delete. (fold_builtin_1): Handle constant cexp arguments here. * match.pd: Fold cexp(x+yi) to exp(x) * cexpi(y). Co-Authored-By: Richard Biener From-SVN: r229308 --- gcc/genmatch.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc/genmatch.c') diff --git a/gcc/genmatch.c b/gcc/genmatch.c index b05760e..b5a0fff 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -3163,7 +3163,11 @@ dt_simplify::gen (FILE *f, int indent, bool gimple) s->capture_max + 1, indexes[0]->get_name (opname)); for (int i = 1; i <= s->capture_max; ++i) - fprintf (f, ", %s", indexes[i]->get_name (opname)); + { + if (!indexes[i]) + break; + fprintf (f, ", %s", indexes[i]->get_name (opname)); + } fprintf (f, " };\n"); } @@ -3831,7 +3835,7 @@ parser::parse_expr () if (token->type == CPP_ATSIGN && !(token->flags & PREV_WHITE)) - op = parse_capture (e, !parsing_match_operand); + op = parse_capture (e, false); else if (force_capture) { unsigned num = capture_ids->elements (); -- cgit v1.1