public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10840] middle-end/109505 - backport match.pd ! support for GENERIC
@ 2023-06-02 7:46 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-06-02 7:46 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:bfa476528ceeac96865a48c49f3f1a15d566d209
commit r11-10840-gbfa476528ceeac96865a48c49f3f1a15d566d209
Author: Richard Biener <rguenther@suse.de>
Date: Wed Feb 23 13:47:01 2022 +0100
middle-end/109505 - backport match.pd ! support for GENERIC
The patch adds support for the ! modifier to GENERIC, backported
from r12-7361-gfdc46830f1b793.
2023-06-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/109505
* doc/match-and-simplify.texi: Amend ! documentation.
* genmatch.c (expr::gen_transform): Code-generate ! support
for GENERIC.
(parser::parse_expr): Allow ! for GENERIC.
Diff:
---
gcc/doc/match-and-simplify.texi | 6 ++++--
gcc/genmatch.c | 20 +++++++++-----------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/gcc/doc/match-and-simplify.texi b/gcc/doc/match-and-simplify.texi
index e7e5a4f7299..b76aeac4121 100644
--- a/gcc/doc/match-and-simplify.texi
+++ b/gcc/doc/match-and-simplify.texi
@@ -374,8 +374,10 @@ for example
which moves the outer @code{plus} operation to the inner arms
of the @code{vec_cond} expression but only if the actual plus
-operations both simplify. Note this is currently only supported
-for code generation targeting @code{GIMPLE}.
+operations both simplify. Note that on @code{GENERIC} a simple
+operand means that the result satisfies @code{!EXPR_P} which
+can be limiting if the operation itself simplifies but the
+remaining operand is an (unrelated) expression.
As intermediate conversions are often optional there is a way to
avoid the need to repeat patterns both with and without such
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 3b99705606c..e22158665fb 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -2554,19 +2554,20 @@ expr::gen_transform (FILE *f, int indent, const char *dest, bool gimple,
fprintf_indent (f, indent, "_r%d = fold_build%d_loc (loc, %s, %s",
depth, ops.length(), opr_name, type);
else
- {
- fprintf_indent (f, indent, "{\n");
- fprintf_indent (f, indent, " _r%d = maybe_build_call_expr_loc (loc, "
- "%s, %s, %d", depth, opr_name, type, ops.length());
- }
+ fprintf_indent (f, indent, "_r%d = maybe_build_call_expr_loc (loc, "
+ "%s, %s, %d", depth, opr_name, type, ops.length());
for (unsigned i = 0; i < ops.length (); ++i)
fprintf (f, ", _o%d[%u]", depth, i);
fprintf (f, ");\n");
if (opr->kind != id_base::CODE)
{
- fprintf_indent (f, indent, " if (!_r%d)\n", depth);
- fprintf_indent (f, indent, " goto %s;\n", fail_label);
- fprintf_indent (f, indent, "}\n");
+ fprintf_indent (f, indent, "if (!_r%d)\n", depth);
+ fprintf_indent (f, indent, " goto %s;\n", fail_label);
+ }
+ if (force_leaf)
+ {
+ fprintf_indent (f, indent, "if (EXPR_P (_r%d))\n", depth);
+ fprintf_indent (f, indent, " goto %s;\n", fail_label);
}
if (*opr == CONVERT_EXPR)
{
@@ -4300,9 +4301,6 @@ parser::parse_expr ()
&& token->type == CPP_NOT
&& !(token->flags & PREV_WHITE))
{
- if (!gimple)
- fatal_at (token, "forcing simplification to a leaf is not supported "
- "for GENERIC");
eat_token (CPP_NOT);
e->force_leaf = true;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-02 7:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02 7:46 [gcc r11-10840] middle-end/109505 - backport match.pd ! support for GENERIC Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).