Commit 60934f9c by Nathan Sidwell

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
parent dc316086
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> 2004-11-10 Peter S. Mazinger <ps.m@gmx.net>
* config/mips/linux.h (LINUX_TARGET_OS_CPP_BUILTINS): Define * config/mips/linux.h (LINUX_TARGET_OS_CPP_BUILTINS): Define
...@@ -398,6 +404,7 @@ ...@@ -398,6 +404,7 @@
them static. them static.
* expr.h: Remove the corresponding prototypes. * expr.h: Remove the corresponding prototypes.
>>>>>>> 2.6266
2004-11-08 Richard Earnshaw <rearnsha@arm.com> 2004-11-08 Richard Earnshaw <rearnsha@arm.com>
* arm.c (arm_handle_notshared_attribute): Wrap declaration and use * arm.c (arm_handle_notshared_attribute): Wrap declaration and use
......
...@@ -10910,6 +10910,16 @@ rs6000_generate_compare (enum rtx_code code) ...@@ -10910,6 +10910,16 @@ rs6000_generate_compare (enum rtx_code code)
else if (code == GTU || code == LTU else if (code == GTU || code == LTU
|| code == GEU || code == LEU) || code == GEU || code == LEU)
comp_mode = CCUNSmode; 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 else
comp_mode = CCmode; comp_mode = CCmode;
......
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> 2004-11-10 Joseph S. Myers <joseph@codesourcery.com>
* objc.dg/desig-init-2.m: New test. * objc.dg/desig-init-2.m: New test.
......
/* { 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment