This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
The tests pr39902-2.c, dfp-dd.c, and dfp-td.c reports as errors when gcc is configured without dfp support. This patch will make the tests to be reported as unsupported.
The test and-1.c has wrong logic. In the formula: y & ~(y & -y)
The part (y & -y) is always a mask with one bit set, which corresponds to the least significant "1" bit in y. The final result is that bit, is set to zero (y & ~mask)
The test should be: y & ~(y & ~x)
Which can be simplified to: y & (~y or x) y.~y or yx yx
Optimized code has a single "and" instruction. Sub-optimal optimization will generate a "nand" or an "orc" / "and" pair (as in gcc-4.3).
I also would like to request for someone to commit the patch after approval, as I have no WAA privileges.
Regards, Edmar
Attachment:
sub_ppc_testcases-Changelog-testsuite
Description: Text document
Index: gcc-20100630/gcc/testsuite/gcc.target/powerpc/pr39902-2.c =================================================================== --- gcc-20100630/gcc/testsuite/gcc.target/powerpc/pr39902-2.c (revision 161589) +++ gcc-20100630/gcc/testsuite/gcc.target/powerpc/pr39902-2.c (working copy) @@ -1,7 +1,7 @@ /* Check that simplification "x*(-1)" -> "-x" is not performed for decimal float types. */ -/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */ +/* { dg-do compile { target { powerpc*-*-linux* && { powerpc_fprs && dfp } } } } */ /* { dg-options "-std=gnu99 -O -mcpu=power6" } */ /* { dg-final { scan-assembler-not "fneg" } } */ Index: gcc-20100630/gcc/testsuite/gcc.target/powerpc/dfp-dd.c =================================================================== --- gcc-20100630/gcc/testsuite/gcc.target/powerpc/dfp-dd.c (revision 161589) +++ gcc-20100630/gcc/testsuite/gcc.target/powerpc/dfp-dd.c (working copy) @@ -1,6 +1,6 @@ /* Test generation of DFP instructions for POWER6. */ /* Origin: Janis Johnson <janis187@us.ibm.com> */ -/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */ +/* { dg-do compile { target { powerpc*-*-linux* && { powerpc_fprs && dfp } } } } */ /* { dg-options "-std=gnu99 -mcpu=power6" } */ /* { dg-final { scan-assembler "dadd" } } */ Index: gcc-20100630/gcc/testsuite/gcc.target/powerpc/dfp-td.c =================================================================== --- gcc-20100630/gcc/testsuite/gcc.target/powerpc/dfp-td.c (revision 161589) +++ gcc-20100630/gcc/testsuite/gcc.target/powerpc/dfp-td.c (working copy) @@ -1,6 +1,6 @@ /* Test generation of DFP instructions for POWER6. */ /* Origin: Janis Johnson <janis187@us.ibm.com> */ -/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */ +/* { dg-do compile { target { powerpc*-*-linux* && { powerpc_fprs && dfp } } } } */ /* { dg-options "-std=gnu99 -mcpu=power6" } */ /* { dg-final { scan-assembler "daddq" } } */ Index: gcc-20100630/gcc/testsuite/gcc.dg/and-1.c =================================================================== --- gcc-20100630/gcc/testsuite/gcc.dg/and-1.c (revision 161589) +++ gcc-20100630/gcc/testsuite/gcc.dg/and-1.c (working copy) @@ -3,8 +3,9 @@ /* { dg-final { scan-assembler "and" { target powerpc*-*-* spu-*-* } } } */ /* There should be no nand for this testcase (for either PPC or SPU). */ /* { dg-final { scan-assembler-not "nand" { target powerpc*-*-* spu-*-* } } } */ +/* { dg-final { scan-assembler-not "orc" { target powerpc*-*-* spu-*-* } } } */ -int f(int y) +int f(int y, int x) { - return y & ~(y & -y); + return y & ~(y & ~x); }
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |