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]

Fix gcc.target/powerpc/ppc-negeq0-1.c (bug 29056)


Bug 29056 has a discussion of the failure of
gcc.target/powerpc/ppc-negeq0-1.c at -m64 and how this is a bug in the
testcase.  This patch fixes the testcase to use long instead of int as
discussed there; in addition, the shift count is adjusted for the
64-bit case, and the scan-assembler-not pattern is adjusted so it
would detect the cntlzd instruction generated for -m64 if the shift
count is not adjusted.  OK to commit?

2008-07-10  Joseph Myers  <joseph@codesourcery.com>

	PR middle-end/29056
	* gcc.target/powerpc/ppc-negeq0-1.c: Use long instead of int.
	Adjust shift and scan-assembler-not pattern to allow for 64-bit
	case.

Index: gcc.target/powerpc/ppc-negeq0-1.c
===================================================================
--- gcc.target/powerpc/ppc-negeq0-1.c	(revision 137695)
+++ gcc.target/powerpc/ppc-negeq0-1.c	(working copy)
@@ -1,15 +1,15 @@
 /* { dg-do compile } */
 /* { dg-options "-O2" } */
 
-int foo(int x)
+long foo(long x)
 {
   return -(x == 0);
 }
 
-int bar(int x)
+long bar(long x)
 {
-  int t = __builtin_clz(x);
-  return -(t>>5);
+  long t = __builtin_clzl(x);
+  return -(t>>(sizeof(long) == 8 ? 6 : 5));
 }
 
-/* { dg-final { scan-assembler-not "cntlzw" } } */
+/* { dg-final { scan-assembler-not "cntlz" } } */

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]