Commit 39bb7d01 by Richard Biener Committed by Richard Biener

re PR target/77826 (ICE in decompose, at wide-int.h:928 w/ -m64 -O2 and above)

2016-10-05  Richard Biener  <rguenther@suse.de>

	PR middle-end/77826
	* genmatch.c (dt_operand::gen_match_op): Amend operand_equal_p
	with types_match for GIMPLE code gen to handle type mismatched
	constants properly.
	(dt_operand::gen): Adjust.
	* match.pd ((X /[ex] A) * A -> X): Properly handle converted
	and constant A.

	* gcc.dg/torture/pr77826.c: New testcase.

From-SVN: r240776
parent eeb57981
2016-10-05 Richard Biener <rguenther@suse.de> 2016-10-05 Richard Biener <rguenther@suse.de>
PR middle-end/77826
* genmatch.c (dt_operand::gen_match_op): Amend operand_equal_p
with types_match for GIMPLE code gen to handle type mismatched
constants properly.
(dt_operand::gen): Adjust.
* match.pd ((X /[ex] A) * A -> X): Properly handle converted
and constant A.
2016-10-05 Richard Biener <rguenther@suse.de>
* match.pd (copysign(x, CST) -> [-]abs (x)): New pattern. * match.pd (copysign(x, CST) -> [-]abs (x)): New pattern.
2016-10-05 Richard Biener <rguenther@suse.de> 2016-10-05 Richard Biener <rguenther@suse.de>
......
...@@ -1562,7 +1562,7 @@ struct dt_operand : public dt_node ...@@ -1562,7 +1562,7 @@ struct dt_operand : public dt_node
void gen (FILE *, int, bool); void gen (FILE *, int, bool);
unsigned gen_predicate (FILE *, int, const char *, bool); unsigned gen_predicate (FILE *, int, const char *, bool);
unsigned gen_match_op (FILE *, int, const char *); unsigned gen_match_op (FILE *, int, const char *, bool);
unsigned gen_gimple_expr (FILE *, int); unsigned gen_gimple_expr (FILE *, int);
unsigned gen_generic_expr (FILE *, int, const char *); unsigned gen_generic_expr (FILE *, int, const char *);
...@@ -2589,12 +2589,18 @@ dt_operand::gen_predicate (FILE *f, int indent, const char *opname, bool gimple) ...@@ -2589,12 +2589,18 @@ dt_operand::gen_predicate (FILE *f, int indent, const char *opname, bool gimple)
a capture-match. */ a capture-match. */
unsigned unsigned
dt_operand::gen_match_op (FILE *f, int indent, const char *opname) dt_operand::gen_match_op (FILE *f, int indent, const char *opname, bool gimple)
{ {
char match_opname[20]; char match_opname[20];
match_dop->get_name (match_opname); match_dop->get_name (match_opname);
fprintf_indent (f, indent, "if (%s == %s || operand_equal_p (%s, %s, 0))\n", if (gimple)
opname, match_opname, opname, match_opname); fprintf_indent (f, indent, "if (%s == %s || (operand_equal_p (%s, %s, 0) "
"&& types_match (%s, %s)))\n",
opname, match_opname, opname, match_opname,
opname, match_opname);
else
fprintf_indent (f, indent, "if (%s == %s || operand_equal_p (%s, %s, 0))\n",
opname, match_opname, opname, match_opname);
fprintf_indent (f, indent + 2, "{\n"); fprintf_indent (f, indent + 2, "{\n");
return 1; return 1;
} }
...@@ -2991,7 +2997,7 @@ dt_operand::gen (FILE *f, int indent, bool gimple) ...@@ -2991,7 +2997,7 @@ dt_operand::gen (FILE *f, int indent, bool gimple)
else if (type == DT_TRUE) else if (type == DT_TRUE)
; ;
else if (type == DT_MATCH) else if (type == DT_MATCH)
n_braces = gen_match_op (f, indent, opname); n_braces = gen_match_op (f, indent, opname, gimple);
else else
gcc_unreachable (); gcc_unreachable ();
......
...@@ -1781,9 +1781,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) ...@@ -1781,9 +1781,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* (X /[ex] A) * A -> X. */ /* (X /[ex] A) * A -> X. */
(simplify (simplify
(mult (convert? (exact_div @0 @1)) @1) (mult (convert1? (exact_div @0 @1)) (convert2? @2))
/* Look through a sign-changing conversion. */ /* We cannot use matching captures here, since in the case of
(convert @0)) constants we don't see the second conversion. Look through
a sign-changing or widening conversions. */
(if (operand_equal_p (@1, @2, 0)
&& element_precision (@0) <= element_precision (type))
(convert @0)))
/* Canonicalization of binary operations. */ /* Canonicalization of binary operations. */
......
2016-10-05 Richard Biener <rguenther@suse.de> 2016-10-05 Richard Biener <rguenther@suse.de>
PR middle-end/77826
* gcc.dg/torture/pr77826.c: New testcase.
2016-10-05 Richard Biener <rguenther@suse.de>
* gcc.dg/fold-copysign-1.c: New testcase. * gcc.dg/fold-copysign-1.c: New testcase.
2016-10-05 Andreas Schwab <schwab@suse.de> 2016-10-05 Andreas Schwab <schwab@suse.de>
......
/* { dg-do compile } */
void
fi(unsigned long int *v0, unsigned int ow, int q2)
{
if (ow + q2 != 0)
if (q2 == 1)
{
*v0 |= q2;
q2 ^= *v0;
}
}
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