From: Jakub Jelinek Date: Tue, 3 May 2011 13:01:12 +0000 (+0200) Subject: re PR target/48774 (gcc-4.6.0 optimization regression on x86_64-unknown-linux-gnu) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=17038fcf969aacff3fa4ebdbb9bfedda6705f612;p=gcc.git re PR target/48774 (gcc-4.6.0 optimization regression on x86_64-unknown-linux-gnu) 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: r173301 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e59561d8234..3527b6e58aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-05-03 Uros Bizjak + Jakub Jelinek + + 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-05-03 Bernd Schmidt * gengenrtl.c (special_rtx): PC, CC0 and RETURN are special. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index c164c7074de..97064abb076 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -17299,11 +17299,15 @@ ix86_match_ccmode (rtx insn, enum machine_mode req_mode) if (req_mode == CCZmode) return false; /* FALLTHRU */ + case CCZmode: + break; + case CCAmode: case CCCmode: case CCOmode: case CCSmode: - case CCZmode: + if (set_mode != req_mode) + return false; break; default: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d15361c6b25..8c4d5f755e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-05-03 Jakub Jelinek + + PR target/48774 + * gcc.dg/pr48774.c: New test. + 2011-05-03 Richard Guenther * gcc.dg/large-size-array-5.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/pr48774.c b/gcc/testsuite/gcc.dg/pr48774.c new file mode 100644 index 00000000000..91ce361ccb3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48774.c @@ -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, noclone)) 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; +}