backport: re PR target/48774 (gcc-4.6.0 optimization regression on x86_64-unknown-linux-gnu)

Backported from mainline
	2011-05-03  Uros Bizjak  <ubizjak@gmail.com>
		    Jakub Jelinek  <jakub@redhat.com>

	PR target/48774
	* config/i386/i386.c (ix86_match_ccmode): For CC{A,C,O,S}mode
	only succeed if req_mode is the same as set_mode.

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

From-SVN: r173359
This commit is contained in:
Jakub Jelinek 2011-05-04 11:21:09 +02:00 committed by Jakub Jelinek
parent 0a11a513d2
commit b8ef86ef26
4 changed files with 57 additions and 3 deletions

View File

@ -1,6 +1,13 @@
2011-05-04 Jakub Jelinek <jakub@redhat.com>
Backport from mainline
Backported from mainline
2011-05-03 Uros Bizjak <ubizjak@gmail.com>
Jakub Jelinek <jakub@redhat.com>
PR target/48774
* config/i386/i386.c (ix86_match_ccmode): For CC{A,C,O,S}mode
only succeed if req_mode is the same as set_mode.
2011-04-30 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/48809

View File

@ -13645,11 +13645,15 @@ ix86_match_ccmode (rtx insn, enum machine_mode req_mode)
if (req_mode == CCZmode)
return 0;
/* FALLTHRU */
case CCZmode:
break;
case CCAmode:
case CCCmode:
case CCOmode:
case CCSmode:
case CCZmode:
if (set_mode != req_mode)
return 0;
break;
default:

View File

@ -1,6 +1,11 @@
2011-05-04 Jakub Jelinek <jakub@redhat.com>
Backport from mainline
Backported from mainline
2011-05-03 Jakub Jelinek <jakub@redhat.com>
PR target/48774
* gcc.dg/pr48774.c: New test.
2011-04-30 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/48809

View File

@ -0,0 +1,38 @@
/* PR target/48774 */
/* { dg-do run } */
/* { dg-options "-O2 -funroll-loops" } */
extern void abort (void);
unsigned long int s[24]
= { 12, ~1, 12, ~2, 12, ~4, 12, ~8, 12, ~16, 12, ~32,
12, ~64, 12, ~128, 12, ~256, 12, ~512, 12, ~1024, 12, ~2048 };
struct { int n; unsigned long *e[12]; } g
= { 12, { &s[0], &s[2], &s[4], &s[6], &s[8], &s[10], &s[12], &s[14],
&s[16], &s[18], &s[20], &s[22] } };
int c[12];
__attribute__((noinline)) void
foo (void)
{
int i, j;
for (i = 0; i < g.n; i++)
for (j = 0; j < g.n; j++)
{
if (i == j && j < g.e[0][0] && (g.e[i][1] & (1UL << j)))
abort ();
if (j < g.e[0][0] && (g.e[i][1] & (1UL << j)))
c[i]++;
}
}
int
main ()
{
int i;
asm volatile ("" : "+m" (s), "+m" (g), "+m" (c));
foo ();
for (i = 0; i < 12; i++)
if (c[i] != 11)
abort ();
return 0;
}