Patchwork [PR50322] Fix test-case ivopts-lt.c to use int of same size as pointer.

login
register
mail settings
Submitter Tom de Vries
Date Sept. 14, 2011, 11:48 a.m.
Message ID <4E709480.8050601@mentor.com>
Download mbox | patch
Permalink /patch/114666/
State New
Headers show

Comments

Tom de Vries - Sept. 14, 2011, 11:48 a.m.
Mike,
Zdenek,

The attached patch fixes PR50322.

The test-case is supposed to succeed if the loop counter data-type has the same
size as a pointer. The patch defines TYPE to be an int datatype of the same size
as a pointer, and uses it. After this fix, there's no need for the avr xfails
anymore.

tested with avr, x86_64 and x86_64 -m32.

OK for trunk?

Thanks,
- Tom

2011-09-14  Tom de Vries  <tom@codesourcery.com>

	PR testsuite/50322
	* gcc.dg/tree-ssa/ivopts-lt.c: Define TYPE.  Use TYPE in f1.  Undo avr
	xfails.
Zdenek Dvorak - Sept. 14, 2011, 4:35 p.m.
Hi,

> The attached patch fixes PR50322.
> 
> The test-case is supposed to succeed if the loop counter data-type has the same
> size as a pointer. The patch defines TYPE to be an int datatype of the same size
> as a pointer, and uses it. After this fix, there's no need for the avr xfails
> anymore.
> 
> tested with avr, x86_64 and x86_64 -m32.

what about using uintptr_t?

Zdenek

> Index: gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c (revision 178804)
> +++ gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c (working copy)
> @@ -1,8 +1,18 @@
>  /* { dg-do compile } */
>  /* { dg-options "-O2 -fdump-tree-ivopts" } */
>  
> +#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
> +#define TYPE unsigned long long int
> +#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
> +#define TYPE unsigned long int
> +#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
> +#define TYPE unsigned int
> +#else
> +#error Add target support here
> +#endif
> +
>  void
> -f1 (char *p, unsigned long int i, unsigned long int n)
> +f1 (char *p, TYPE i, TYPE n)
>  {
>    p += i;
>    do
> @@ -14,8 +24,7 @@ f1 (char *p, unsigned long int i, unsign
>    while (i < n);
>  }
>  
> -/* For the fails on avr see PR tree-optimization/50322.  */
> -/* { dg-final { scan-tree-dump-times "PHI" 1 "ivopts" { xfail { "avr-*-*" } } } } */
> +/* { dg-final { scan-tree-dump-times "PHI" 1 "ivopts" } } */
>  /* { dg-final { scan-tree-dump-times "PHI <p_" 1 "ivopts"} } */
> -/* { dg-final { scan-tree-dump-times "p_\[0-9\]* <" 1 "ivopts" { xfail { "avr-*-*" } } } } */
> +/* { dg-final { scan-tree-dump-times "p_\[0-9\]* <" 1 "ivopts" } } */
>  /* { dg-final { cleanup-tree-dump "ivopts" } } */

Patch

Index: gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c (revision 178804)
+++ gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c (working copy)
@@ -1,8 +1,18 @@ 
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-ivopts" } */
 
+#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
+#define TYPE unsigned long long int
+#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
+#define TYPE unsigned long int
+#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
+#define TYPE unsigned int
+#else
+#error Add target support here
+#endif
+
 void
-f1 (char *p, unsigned long int i, unsigned long int n)
+f1 (char *p, TYPE i, TYPE n)
 {
   p += i;
   do
@@ -14,8 +24,7 @@  f1 (char *p, unsigned long int i, unsign
   while (i < n);
 }
 
-/* For the fails on avr see PR tree-optimization/50322.  */
-/* { dg-final { scan-tree-dump-times "PHI" 1 "ivopts" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-tree-dump-times "PHI" 1 "ivopts" } } */
 /* { dg-final { scan-tree-dump-times "PHI <p_" 1 "ivopts"} } */
-/* { dg-final { scan-tree-dump-times "p_\[0-9\]* <" 1 "ivopts" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-tree-dump-times "p_\[0-9\]* <" 1 "ivopts" } } */
 /* { dg-final { cleanup-tree-dump "ivopts" } } */