Commit eee7b6c4 by Richard Biener Committed by Richard Biener

genmatch.c (print_operand): Fix formatting.

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.

From-SVN: r228648
parent 0c063d60
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> 2015-10-09 Richard Biener <rguenth@suse.de>
PR target/67366 PR target/67366
...@@ -710,13 +710,9 @@ print_operand (operand *o, FILE *f = stderr, bool flattened = false) ...@@ -710,13 +710,9 @@ print_operand (operand *o, FILE *f = stderr, bool flattened = false)
{ {
if (capture *c = dyn_cast<capture *> (o)) if (capture *c = dyn_cast<capture *> (o))
{ {
fprintf (f, "@%u", c->where);
if (c->what && flattened == false) if (c->what && flattened == false)
{ print_operand (c->what, f, flattened);
putc (':', f); fprintf (f, "@%u", c->where);
print_operand (c->what, f, flattened);
putc (' ', f);
}
} }
else if (predicate *p = dyn_cast<predicate *> (o)) else if (predicate *p = dyn_cast<predicate *> (o))
...@@ -727,18 +723,22 @@ print_operand (operand *o, FILE *f = stderr, bool flattened = false) ...@@ -727,18 +723,22 @@ print_operand (operand *o, FILE *f = stderr, bool flattened = false)
else if (expr *e = dyn_cast<expr *> (o)) else if (expr *e = dyn_cast<expr *> (o))
{ {
fprintf (f, "(%s", e->operation->id); if (e->ops.length () == 0)
fprintf (f, "%s", e->operation->id);
if (flattened == false) else
{ {
putc (' ', f); fprintf (f, "(%s", e->operation->id);
for (unsigned i = 0; i < e->ops.length (); ++i)
if (flattened == false)
{ {
print_operand (e->ops[i], f, flattened); for (unsigned i = 0; i < e->ops.length (); ++i)
putc (' ', f); {
putc (' ', f);
print_operand (e->ops[i], f, flattened);
}
} }
putc (')', f);
} }
putc (')', f);
} }
else else
...@@ -1563,6 +1563,14 @@ dt_node::append_simplify (simplify *s, unsigned pattern_no, ...@@ -1563,6 +1563,14 @@ dt_node::append_simplify (simplify *s, unsigned pattern_no,
dt_operand **indexes) dt_operand **indexes)
{ {
dt_simplify *n = new dt_simplify (s, pattern_no, 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); return append_node (n);
} }
......
...@@ -2169,18 +2169,16 @@ along with GCC; see the file COPYING3. If not see ...@@ -2169,18 +2169,16 @@ along with GCC; see the file COPYING3. If not see
(mult @0 (POW @1 (negate @2)))) (mult @0 (POW @1 (negate @2))))
/* Special case, optimize logN(expN(x)) = x. */ /* Special case, optimize logN(expN(x)) = x. */
(for logs (LOG LOG2 LOG10) (for logs (LOG LOG2 LOG10 LOG10)
exps (EXP EXP2 EXP10) exps (EXP EXP2 EXP10 POW10)
(simplify (simplify
(logs (exps @0)) (logs (exps @0))
@0)) @0))
/* Optimize logN(func()) for various exponential functions. We /* Optimize logN(func()) for various exponential functions. We
want to determine the value "x" and the power "exponent" in want to determine the value "x" and the power "exponent" in
order to transform logN(x**exponent) into exponent*logN(x). */ order to transform logN(x**exponent) into exponent*logN(x). */
(for logs (LOG LOG LOG LOG (for logs (LOG LOG LOG LOG2 LOG2 LOG2 LOG10 LOG10)
LOG2 LOG2 LOG2 LOG2 exps (EXP2 EXP10 POW10 EXP EXP10 POW10 EXP EXP2)
LOG10 LOG10 LOG10 LOG10)
exps (EXP EXP2 EXP10 POW10)
(simplify (simplify
(logs (exps @0)) (logs (exps @0))
(with { (with {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment