Commit d90ee6be by Jakub Jelinek

re PR target/25554 (unrecognizable insn on x86_64 with -O2 -ftracer (…

re PR target/25554 (unrecognizable insn on x86_64 with -O2 -ftracer ( -fno-tree-dominator-opts on the mainline))

	PR target/25554
	* config/i386/i386.md (testqi_ext_3): Ensure len is positive
	and pos non-negative and pos + len <= 32.
	(testqi_ext_3_rex64): Ensure len is positive and pos non-negative,
	drop pos + len < HOST_BITS_PER_WIDE_INT test.
	(testqi_ext_3* splitter): Handle pos + len == HOST_BITS_PER_WIDE_INT.

	* gcc.c-torture/compile/20051228-1.c: New test.

From-SVN: r109317
parent ee8960e5
2006-01-04 Jakub Jelinek <jakub@redhat.com> 2006-01-04 Jakub Jelinek <jakub@redhat.com>
PR target/25554
* config/i386/i386.md (testqi_ext_3): Ensure len is positive
and pos non-negative and pos + len <= 32.
(testqi_ext_3_rex64): Ensure len is positive and pos non-negative,
drop pos + len < HOST_BITS_PER_WIDE_INT test.
(testqi_ext_3* splitter): Handle pos + len == HOST_BITS_PER_WIDE_INT.
PR c/25559 PR c/25559
* c-common.c (handle_vector_size_attribute): Reject zero vector size * c-common.c (handle_vector_size_attribute): Reject zero vector size
as well as sizes not multiple of component size. as well as sizes not multiple of component size.
......
...@@ -7865,6 +7865,9 @@ ...@@ -7865,6 +7865,9 @@
(match_operand:SI 2 "const_int_operand" "")) (match_operand:SI 2 "const_int_operand" ""))
(const_int 0)))] (const_int 0)))]
"ix86_match_ccmode (insn, CCNOmode) "ix86_match_ccmode (insn, CCNOmode)
&& INTVAL (operands[1]) > 0
&& INTVAL (operands[2]) >= 0
&& INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
&& (GET_MODE (operands[0]) == SImode && (GET_MODE (operands[0]) == SImode
|| (TARGET_64BIT && GET_MODE (operands[0]) == DImode) || (TARGET_64BIT && GET_MODE (operands[0]) == DImode)
|| GET_MODE (operands[0]) == HImode || GET_MODE (operands[0]) == HImode
...@@ -7880,8 +7883,8 @@ ...@@ -7880,8 +7883,8 @@
(const_int 0)))] (const_int 0)))]
"TARGET_64BIT "TARGET_64BIT
&& ix86_match_ccmode (insn, CCNOmode) && ix86_match_ccmode (insn, CCNOmode)
/* The code below cannot deal with constants outside HOST_WIDE_INT. */ && INTVAL (operands[1]) > 0
&& INTVAL (operands[1]) + INTVAL (operands[2]) < HOST_BITS_PER_WIDE_INT && INTVAL (operands[2]) >= 0
/* Ensure that resulting mask is zero or sign extended operand. */ /* Ensure that resulting mask is zero or sign extended operand. */
&& (INTVAL (operands[1]) + INTVAL (operands[2]) <= 32 && (INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
|| (INTVAL (operands[1]) + INTVAL (operands[2]) == 64 || (INTVAL (operands[1]) + INTVAL (operands[2]) == 64
...@@ -7936,8 +7939,11 @@ ...@@ -7936,8 +7939,11 @@
val = gen_lowpart (QImode, val); val = gen_lowpart (QImode, val);
} }
mask = ((HOST_WIDE_INT)1 << (pos + len)) - 1; if (len == HOST_BITS_PER_WIDE_INT)
mask &= ~(((HOST_WIDE_INT)1 << pos) - 1); mask = -1;
else
mask = ((HOST_WIDE_INT)1 << len) - 1;
mask <<= pos;
operands[2] = gen_rtx_AND (mode, val, gen_int_mode (mask, mode)); operands[2] = gen_rtx_AND (mode, val, gen_int_mode (mask, mode));
}) })
......
/* PR target/25554 */
/* Bitwise shift with negative shift count has undefined behavior,
but we shouldn't ICE on it. */
void
foo (long x)
{
if (((x >> -2) & 1) != 0)
bar ();
}
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