summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-09 11:47:31 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-09 11:47:31 +0000
commit6b0c8e847d51ac3d0906ef221591ab64bd4b65e4 (patch)
tree81a81f16a67ae4ce487035cc32f0dfeee9d84b1e
parente20bd0091cf0b73e9aede68fc6d67b6e52bb330d (diff)
downloadgcc-6b0c8e847d51ac3d0906ef221591ab64bd4b65e4.tar.gz
2015-10-09 Richard Biener <rguenther@suse.de>
* genmatch.c (print_operand): Fix formatting. (dt_node::append_simplify): Warn for multiple simplifiers that match the same pattern. * match.pd (log (exp @0)): Remove duplicates. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228648 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/genmatch.c36
-rw-r--r--gcc/match.pd10
3 files changed, 33 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 514bb313b4d..11c3b47b9d9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-10-09 Richard Biener <rguenther@suse.de>
+
+ * genmatch.c (print_operand): Fix formatting.
+ (dt_node::append_simplify): Warn for multiple simplifiers
+ that match the same pattern.
+ * match.pd (log (exp @0)): Remove duplicates.
+
2015-10-09 Richard Biener <rguenth@suse.de>
PR target/67366
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 102a6350b5e..b05760ec2ba 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -710,13 +710,9 @@ print_operand (operand *o, FILE *f = stderr, bool flattened = false)
{
if (capture *c = dyn_cast<capture *> (o))
{
- fprintf (f, "@%u", c->where);
if (c->what && flattened == false)
- {
- putc (':', f);
- print_operand (c->what, f, flattened);
- putc (' ', f);
- }
+ print_operand (c->what, f, flattened);
+ fprintf (f, "@%u", c->where);
}
else if (predicate *p = dyn_cast<predicate *> (o))
@@ -727,18 +723,22 @@ print_operand (operand *o, FILE *f = stderr, bool flattened = false)
else if (expr *e = dyn_cast<expr *> (o))
{
- fprintf (f, "(%s", e->operation->id);
-
- if (flattened == false)
+ if (e->ops.length () == 0)
+ fprintf (f, "%s", e->operation->id);
+ else
{
- putc (' ', f);
- for (unsigned i = 0; i < e->ops.length (); ++i)
+ fprintf (f, "(%s", e->operation->id);
+
+ if (flattened == false)
{
- print_operand (e->ops[i], f, flattened);
- putc (' ', f);
+ for (unsigned i = 0; i < e->ops.length (); ++i)
+ {
+ putc (' ', f);
+ print_operand (e->ops[i], f, flattened);
+ }
}
+ putc (')', f);
}
- putc (')', f);
}
else
@@ -1563,6 +1563,14 @@ dt_node::append_simplify (simplify *s, unsigned pattern_no,
dt_operand **indexes)
{
dt_simplify *n = new dt_simplify (s, pattern_no, indexes);
+ for (unsigned i = 0; i < kids.length (); ++i)
+ if (dt_simplify *s2 = dyn_cast <dt_simplify *> (kids[i]))
+ {
+ warning_at (s->match->location, "duplicate pattern");
+ warning_at (s2->s->match->location, "previous pattern defined here");
+ print_operand (s->match, stderr);
+ fprintf (stderr, "\n");
+ }
return append_node (n);
}
diff --git a/gcc/match.pd b/gcc/match.pd
index b87c43641b2..170d73e9fa6 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2169,18 +2169,16 @@ along with GCC; see the file COPYING3. If not see
(mult @0 (POW @1 (negate @2))))
/* Special case, optimize logN(expN(x)) = x. */
- (for logs (LOG LOG2 LOG10)
- exps (EXP EXP2 EXP10)
+ (for logs (LOG LOG2 LOG10 LOG10)
+ exps (EXP EXP2 EXP10 POW10)
(simplify
(logs (exps @0))
@0))
/* Optimize logN(func()) for various exponential functions. We
want to determine the value "x" and the power "exponent" in
order to transform logN(x**exponent) into exponent*logN(x). */
- (for logs (LOG LOG LOG LOG
- LOG2 LOG2 LOG2 LOG2
- LOG10 LOG10 LOG10 LOG10)
- exps (EXP EXP2 EXP10 POW10)
+ (for logs (LOG LOG LOG LOG2 LOG2 LOG2 LOG10 LOG10)
+ exps (EXP2 EXP10 POW10 EXP EXP10 POW10 EXP EXP2)
(simplify
(logs (exps @0))
(with {