Commit 9e61e48e by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/84834 (ICE: tree check: expected integer_cst, have complex_cst…

re PR middle-end/84834 (ICE: tree check: expected integer_cst, have complex_cst in to_wide, at tree.h:5527)

	PR middle-end/84834
	* match.pd ((A & C) != 0 ? D : 0): Use INTEGER_CST@2 instead of
	integer_pow2p@2 and test integer_pow2p in condition.
	(A < 0 ? C : 0): Similarly for @1.

	* gcc.dg/pr84834.c: New test.

From-SVN: r258479
parent cd471b26
2018-03-13 Jakub Jelinek <jakub@redhat.com> 2018-03-13 Jakub Jelinek <jakub@redhat.com>
PR middle-end/84834
* match.pd ((A & C) != 0 ? D : 0): Use INTEGER_CST@2 instead of
integer_pow2p@2 and test integer_pow2p in condition.
(A < 0 ? C : 0): Similarly for @1.
PR middle-end/84831 PR middle-end/84831
* stmt.c (parse_output_constraint): If the CONSTRAINT_LEN (*p, p) * stmt.c (parse_output_constraint): If the CONSTRAINT_LEN (*p, p)
characters starting at p contain '\0' character, don't look beyond characters starting at p contain '\0' character, don't look beyond
......
...@@ -3566,16 +3566,18 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) ...@@ -3566,16 +3566,18 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(simplify (simplify
(cond (cond
(ne (bit_and @0 integer_pow2p@1) integer_zerop) (ne (bit_and @0 integer_pow2p@1) integer_zerop)
integer_pow2p@2 integer_zerop) INTEGER_CST@2 integer_zerop)
(with { (if (integer_pow2p (@2))
int shift = (wi::exact_log2 (wi::to_wide (@2)) (with {
- wi::exact_log2 (wi::to_wide (@1))); int shift = (wi::exact_log2 (wi::to_wide (@2))
} - wi::exact_log2 (wi::to_wide (@1)));
(if (shift > 0) }
(bit_and (if (shift > 0)
(lshift (convert @0) { build_int_cst (integer_type_node, shift); }) @2) (bit_and
(bit_and (lshift (convert @0) { build_int_cst (integer_type_node, shift); }) @2)
(convert (rshift @0 { build_int_cst (integer_type_node, -shift); })) @2)))) (bit_and
(convert (rshift @0 { build_int_cst (integer_type_node, -shift); }))
@2)))))
/* If we have (A & C) != 0 where C is the sign bit of A, convert /* If we have (A & C) != 0 where C is the sign bit of A, convert
this into A < 0. Similarly for (A & C) == 0 into A >= 0. */ this into A < 0. Similarly for (A & C) == 0 into A >= 0. */
...@@ -3595,8 +3597,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) ...@@ -3595,8 +3597,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(simplify (simplify
(cond (cond
(lt @0 integer_zerop) (lt @0 integer_zerop)
integer_pow2p@1 integer_zerop) INTEGER_CST@1 integer_zerop)
(if (!TYPE_UNSIGNED (TREE_TYPE (@0))) (if (integer_pow2p (@1)
&& !TYPE_UNSIGNED (TREE_TYPE (@0)))
(with { (with {
int shift = element_precision (@0) - wi::exact_log2 (wi::to_wide (@1)) - 1; int shift = element_precision (@0) - wi::exact_log2 (wi::to_wide (@1)) - 1;
} }
......
2018-03-13 Jakub Jelinek <jakub@redhat.com> 2018-03-13 Jakub Jelinek <jakub@redhat.com>
PR middle-end/84834
* gcc.dg/pr84834.c: New test.
PR target/84827 PR target/84827
* gcc.target/i386/pr84827.c: New test. * gcc.target/i386/pr84827.c: New test.
......
/* PR middle-end/84834 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
_Complex int
foo (int a)
{
return a < 0;
}
_Complex int
bar (int a)
{
return (a & 8) ? (_Complex int) 16 : (_Complex int) 0;
}
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