diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-10-26 09:18:30 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-10-26 09:18:30 +0000 |
commit | 96285749d88e8bf954b7e977d43e5cb947357ce5 (patch) | |
tree | e79ab049985d601289566c278b52580210cc2ad4 /gcc/genmatch.c | |
parent | 9df01367f2f481d91b4927669cec5dbf80f489a1 (diff) | |
download | gcc-96285749d88e8bf954b7e977d43e5cb947357ce5.zip gcc-96285749d88e8bf954b7e977d43e5cb947357ce5.tar.gz gcc-96285749d88e8bf954b7e977d43e5cb947357ce5.tar.bz2 |
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.sandiford@arm.com>
Richard Biener <rguenther@suse.de>
* 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 <rguenther@suse.de>
From-SVN: r229308
Diffstat (limited to 'gcc/genmatch.c')
-rw-r--r-- | gcc/genmatch.c | 8 |
1 files changed, 6 insertions, 2 deletions
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 (); |