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
This commit is contained in:
Jakub Jelinek 2006-01-04 09:15:06 +01:00
parent ee8960e558
commit d90ee6be66
4 changed files with 320 additions and 294 deletions

View File

@ -1,5 +1,12 @@
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
* c-common.c (handle_vector_size_attribute): Reject zero vector size
as well as sizes not multiple of component size.

View File

@ -7865,6 +7865,9 @@
(match_operand:SI 2 "const_int_operand" ""))
(const_int 0)))]
"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
|| (TARGET_64BIT && GET_MODE (operands[0]) == DImode)
|| GET_MODE (operands[0]) == HImode
@ -7880,8 +7883,8 @@
(const_int 0)))]
"TARGET_64BIT
&& ix86_match_ccmode (insn, CCNOmode)
/* The code below cannot deal with constants outside HOST_WIDE_INT. */
&& INTVAL (operands[1]) + INTVAL (operands[2]) < HOST_BITS_PER_WIDE_INT
&& INTVAL (operands[1]) > 0
&& INTVAL (operands[2]) >= 0
/* Ensure that resulting mask is zero or sign extended operand. */
&& (INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
|| (INTVAL (operands[1]) + INTVAL (operands[2]) == 64
@ -7936,8 +7939,11 @@
val = gen_lowpart (QImode, val);
}
mask = ((HOST_WIDE_INT)1 << (pos + len)) - 1;
mask &= ~(((HOST_WIDE_INT)1 << pos) - 1);
if (len == HOST_BITS_PER_WIDE_INT)
mask = -1;
else
mask = ((HOST_WIDE_INT)1 << len) - 1;
mask <<= pos;
operands[2] = gen_rtx_AND (mode, val, gen_int_mode (mask, mode));
})

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
/* 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 ();
}