re PR target/16458 (PowerPC - redundant compare)

.:	PR target/16458
	* config/rs6000/rs6000.c (rs6000_generate_compare): Generate an
	unsigned equality compare when we know the operands are unsigned.
testsuite:
	PR target/16458
	* gcc.dg/ppc-compare-1.c: New.

From-SVN: r90475
This commit is contained in:
Nathan Sidwell 2004-11-11 08:40:43 +00:00
parent dc3160863a
commit 60934f9cf4
4 changed files with 38 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2004-11-11 Nathan Sidwell <nathan@codesourcery.com>
PR target/16458
* config/rs6000/rs6000.c (rs6000_generate_compare): Generate an
unsigned equality compare when we know the operands are unsigned.
2004-11-10 Peter S. Mazinger <ps.m@gmx.net>
* config/mips/linux.h (LINUX_TARGET_OS_CPP_BUILTINS): Define
@ -398,6 +404,7 @@
them static.
* expr.h: Remove the corresponding prototypes.
>>>>>>> 2.6266
2004-11-08 Richard Earnshaw <rearnsha@arm.com>
* arm.c (arm_handle_notshared_attribute): Wrap declaration and use

View File

@ -10910,6 +10910,16 @@ rs6000_generate_compare (enum rtx_code code)
else if (code == GTU || code == LTU
|| code == GEU || code == LEU)
comp_mode = CCUNSmode;
else if ((code == EQ || code == NE)
&& GET_CODE (rs6000_compare_op0) == SUBREG
&& GET_CODE (rs6000_compare_op1) == SUBREG
&& SUBREG_PROMOTED_UNSIGNED_P (rs6000_compare_op0)
&& SUBREG_PROMOTED_UNSIGNED_P (rs6000_compare_op1))
/* These are unsigned values, perhaps there will be a later
ordering compare that can be shared with this one.
Unfortunately we cannot detect the signedness of the operands
for non-subregs. */
comp_mode = CCUNSmode;
else
comp_mode = CCmode;

View File

@ -1,3 +1,8 @@
2004-11-11 Nathan Sidwell <nathan@codesourcery.com>
PR target/16458
* gcc.dg/ppc-compare-1.c: New.
2004-11-10 Joseph S. Myers <joseph@codesourcery.com>
* objc.dg/desig-init-2.m: New test.

View File

@ -0,0 +1,16 @@
/* { dg-do compile { target powerpc64-*-* } } */
/* { dg-options "-m64 -O2" } */
/* { dg-final { scan-assembler-not "cmpw" } } */
/* Origin:Pete Steinmetz <steinmtz@us.ibm.com> */
/* PR 16458: Extraneous compare. */
int foo (unsigned a, unsigned b)
{
if (a == b) return 1;
if (a > b) return 2;
if (a < b) return 3;
return 0;
}