diff mbox

[testsuite] fix invalid ilp32 assumptions and m32c-isms

Message ID 201102182341.p1INfM8k013024@greed.delorie.com
State New
Headers show

Commit Message

DJ Delorie Feb. 18, 2011, 11:41 p.m. UTC
Mostly just adding effective-target filters as appropriate, a few
m32c-specific fixes.  The rest are corrections to make the code work
properly on 16-bit systems, and some m32c filters.

m32c has two pointer sizes, 16bit for r8c/m16c, and 24bit for
m32cm/m32c, but both have 16bit int and size_t.

Do these changes look reasonable?  I'm not sure I used the right
method on some of them.

Comments

Joseph Myers Feb. 19, 2011, 1:53 a.m. UTC | #1
On Fri, 18 Feb 2011, DJ Delorie wrote:

> -int
> +SItype
>  main (void)

main always returns int, so this change is wrong.  (The implementation can 
define other forms of main, but GCC doesn't know of any not returning 
int.)
Nathan Froyd Feb. 19, 2011, 1:59 a.m. UTC | #2
On Fri, Feb 18, 2011 at 06:41:22PM -0500, DJ Delorie wrote:
> Index: gcc.c-torture/execute/cmpsi-2.c
> -feq (int x, int y)
> +#if defined(__m32c__)
> +#define SItype long
> +#else
> +#define SItype int
> +#endif

I'd suggest something like:

  typedef int SItype __attribute ((mode (SI)));

or even:

  typedef __INT32_TYPE__ SItype;

assuming that you really want a 4-byte integer for SItype.

-Nathan
DJ Delorie Feb. 21, 2011, 10:08 p.m. UTC | #3
> assuming that you really want a 4-byte integer for SItype.

Given that the test is "cmpsi-2.c", let's assume they want to test
SImode, whatever it is.  Changed :-)

I also did Joseph's main() return type change (stupid global replace).

Changelog, split into generic and m32c-specific entries:

2011-02-21  DJ Delorie  <dj@redhat.com>

	* c-c++-common/pr44832.c: Require an int32plus target.
	* gcc.c-torture/compile/20011114-1.c: Require a size32plus target.
	* gcc.c-torture/compile/pr43191.c: Require an int32plus target.
	* gcc.c-torture/execute/cmpsi-2.c: Use an SImode type, not "int".
	* gcc.c-torture/execute/nestfunc-3.c: Use "unsigned long" types for 16-bit targets.
	* gcc.c-torture/execute/vector-subscript-1.c: Don't use hard-coded structure sizes.
	* gcc.dg/cdce1.c: Require an int32plus target.
	* gcc.dg/graphite/pr42205-1.c: Require an int32plus target.
	* gcc.dg/graphite/pr42221.c: Require an int32plus target.
	* gcc.dg/graphite/pr46185.c: Require a size32plus target.
	* gcc.dg/graphite/pr46966.c: Require a size32plus target.
	* gcc.dg/graphite/scop-0.c: Require a size32plus target.
	* gcc.dg/graphite/scop-22.c: Require a size32plus target.
	* gcc.dg/graphite/scop-dsyr2k.c: Require a size32plus target.
	* gcc.dg/graphite/scop-dsyrk.c: Require a size32plus target.
	* gcc.dg/graphite/scop-mvt.c: Require a size32plus target.
	* gcc.dg/graphite/scop-sor.c: Require a size32plus target.
	* gcc.dg/ipa/pr45644.c: Require an int32plus target.
	* gcc.dg/lto/20091013-1_2.c: Require a size32plus/int32plus target.
	* gcc.dg/pr34225.c: Require a size32plus target.
	* gcc.dg/pr40971.c: Require a size32plus target.
	* gcc.dg/pr42629.c: Require an int32plus target.
	* gcc.dg/pr43402.c: Don't assume 32-bit ints.
	* gcc.dg/pr44023.c: Require an int32plus target.
	* gcc.dg/pr46212.c: Require an int32plus target.
	* gcc.dg/torture/pr43165.c: Require an int32plus target.
	* gcc.dg/torture/pr47228.c: Require an int32plus target.
	* gcc.dg/torture/stackalign/non-local-goto-5.c: Prototype exit() even when skipping the test body.
	* gcc.dg/tree-ssa/pr45144.c: Require an int32plus target.
	* gcc.dg/tree-ssa/vrp51.c: Require an int32plus target.

	* gcc.c-torture/compile/pr35318.c: Not supported on m32c.
	* gcc.c-torture/compile/pr41181.c: Not supported on m32c.
	* gcc.c-torture/execute/20101011-1.c: m32s's div doesn't trap.
	* gcc.c-torture/execute/980709-1.x: m32c doesn't have pow().
	* gcc.c-torture/execute/ieee/20041213-1.c: m32c doesn't have sqrt().
	* gcc.dg/c99-stdint-1.c: Not supported on m32c.
	* gcc.dg/c99-stdint-2.c: Not supported on m32c.
	* gcc.dg/lto/20090218-2_1.c: Size_t is funny-sized on m32c.
	* gcc.dg/lto/20091013-1_1.c: Pointer-sized integers are funny-sized on R8C and M16C (but not M32C).
	* gcc.dg/lto/20110201-1_0.c: m32c doesn't have sqrt().
	* gcc.dg/pr31490.c: Pointer-sized integers are funny-sized on R8C and M16C (but not M32C).
	* gcc.dg/sibcall-3.c: Not supported on m32c.
	* gcc.dg/sibcall-4.c: Not supported on m32c.
	* gcc.dg/tree-ssa/gen-vect-11.c: Not supported on m32c.
	* gcc.dg/tree-ssa/gen-vect-25.c: Not supported on m32c.
	* gcc.dg/tree-ssa/loop-35.c: Not supported on m32c.
	* gcc.dg/tree-ssa/pr23455.c: Not supported on m32c.
	* gcc.dg/tree-ssa/pr42585.c: Not supported on m32c.
	* gcc.dg/tree-ssa/ssa-ccp-33.c: Not supported on m32c.
	* gcc.dg/tree-ssa/ssa-fre-26.c: Not supported on m32c.
	* gcc.dg/tree-ssa/vrp47.c: Not supported on m32c.
	* gcc.dg/utf-cvt.c: Not supported on m32c.
diff mbox

Patch

Index: gcc.c-torture/execute/cmpsi-2.c
===================================================================
--- gcc.c-torture/execute/cmpsi-2.c	(revision 170291)
+++ gcc.c-torture/execute/cmpsi-2.c	(working copy)
@@ -1,102 +1,108 @@ 
 #define F 140
 #define T 13
 
-feq (int x, int y)
+#if defined(__m32c__)
+#define SItype long
+#else
+#define SItype int
+#endif
+
+feq (SItype x, SItype y)
 {
   if (x == y)
     return T;
   else
     return F;
 }
 
-fne (int x, int y)
+fne (SItype x, SItype y)
 {
   if (x != y)
     return T;
   else
     return F;
 }
 
-flt (int x, int y)
+flt (SItype x, SItype y)
 {
   if (x < y)
     return T;
   else
     return F;
 }
 
-fge (int x, int y)
+fge (SItype x, SItype y)
 {
   if (x >= y)
     return T;
   else
     return F;
 }
 
-fgt (int x, int y)
+fgt (SItype x, SItype y)
 {
   if (x > y)
     return T;
   else
     return F;
 }
 
-fle (int x, int y)
+fle (SItype x, SItype y)
 {
   if (x <= y)
     return T;
   else
     return F;
 }
 
-fltu (unsigned int x, unsigned int y)
+fltu (unsigned SItype x, unsigned SItype y)
 {
   if (x < y)
     return T;
   else
     return F;
 }
 
-fgeu (unsigned int x, unsigned int y)
+fgeu (unsigned SItype x, unsigned SItype y)
 {
   if (x >= y)
     return T;
   else
     return F;
 }
 
-fgtu (unsigned int x, unsigned int y)
+fgtu (unsigned SItype x, unsigned SItype y)
 {
   if (x > y)
     return T;
   else
     return F;
 }
 
-fleu (unsigned int x, unsigned int y)
+fleu (unsigned SItype x, unsigned SItype y)
 {
   if (x <= y)
     return T;
   else
     return F;
 }
 
-unsigned int args[] =
+unsigned SItype args[] =
 {
   0L,
   1L,
   -1L,
   0x7fffffffL,
   0x80000000L,
   0x80000001L,
   0x1A3F2373L,
   0x93850E92L
 };
 
-int correct_results[] =
+SItype correct_results[] =
 {
   T, F, F, T, F, T, F, T, F, T,
   F, T, T, F, F, T, T, F, F, T,
   F, T, F, T, T, F, T, F, F, T,
   F, T, T, F, F, T, T, F, F, T,
   F, T, F, T, T, F, T, F, F, T,
@@ -158,23 +164,23 @@  int correct_results[] =
   F, T, F, T, T, F, F, T, T, F,
   F, T, F, T, T, F, F, T, T, F,
   F, T, T, F, F, T, F, T, T, F,
   T, F, F, T, F, T, F, T, F, T
 };
 
-int
+SItype
 main (void)
 {
-  int i, j, *res = correct_results;
+  SItype i, j, *res = correct_results;
 
   for (i = 0; i < 8; i++)
     {
-      unsigned int arg0 = args[i];
+      unsigned SItype arg0 = args[i];
       for (j = 0; j < 8; j++)
 	{
-	  unsigned int arg1 = args[j];
+	  unsigned SItype arg1 = args[j];
 
 	  if (feq (arg0, arg1) != *res++)
 	    abort ();
 	  if (fne (arg0, arg1) != *res++)
 	    abort ();
 	  if (flt (arg0, arg1) != *res++)
Index: gcc.c-torture/execute/nestfunc-3.c
===================================================================
--- gcc.c-torture/execute/nestfunc-3.c	(revision 170291)
+++ gcc.c-torture/execute/nestfunc-3.c	(working copy)
@@ -37,13 +37,13 @@  main (void)
 
           for (k = 0; k < 10; ++k)
             sum += foo (i, j > k ? j - k : k - j, nested_2);
         }
     }
 
-  if ((sum & 0xffffffff) != 0xbecfcbf5)
+  if (((unsigned long)sum & 0xffffffffUL) != 0xbecfcbf5UL)
     abort ();
 #endif
 
   exit (0);
 }
 
Index: gcc.c-torture/execute/ieee/20041213-1.c
===================================================================
--- gcc.c-torture/execute/ieee/20041213-1.c	(revision 170291)
+++ gcc.c-torture/execute/ieee/20041213-1.c	(working copy)
@@ -9,9 +9,12 @@  double foo (void)
   return 0.0 / 0.0;
 }
 
 double x;
 int main (void)
 {
+  /* m32c does not have sqrt */
+#if !defined(__m32c__)
   x = sqrt (foo ());
+#endif
   return 0;
 }
Index: gcc.c-torture/execute/980709-1.x
===================================================================
--- gcc.c-torture/execute/980709-1.x	(revision 170291)
+++ gcc.c-torture/execute/980709-1.x	(working copy)
@@ -1,10 +1,14 @@ 
 # pow() is not available on m6811/m6812 target, this test will not link.
 if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"]} {
 	return 1
 }
+# pow() is not available on m32c target, this test will not link.
+if { [istarget "m32c-*-*"]} {
+	return 1
+}
 # XFAIL this test for AIX using -msoft-float.
 # This test calls the system libm.a function pow.
 # A false failure is reported if -msoft-float is used.
 # AIX expects the the parameters to be passed in fp regs. 
 if { [istarget powerpc-*-aix*] || [istarget rs6000-*-aix*] } {
     set torture_eval_before_execute {
Index: gcc.c-torture/execute/20101011-1.c
===================================================================
--- gcc.c-torture/execute/20101011-1.c	(revision 170291)
+++ gcc.c-torture/execute/20101011-1.c	(working copy)
@@ -19,12 +19,15 @@ 
      systems that use the Linux kernel.  */
 # define DO_TEST 0
 #elif defined (__mips16) && defined(__linux__)
   /* Not all Linux kernels deal correctly the breakpoints generated by
      MIPS16 divisions by zero.  They show up as a SIGTRAP instead.  */
 # define DO_TEST 0
+#elif defined (__m32c__)
+  /* On M32C division by zero does not trap.  */
+# define DO_TEST 0
 #else
 # define DO_TEST 1
 #endif
 
 #if DO_TEST
 
Index: gcc.c-torture/execute/vector-subscript-1.c
===================================================================
--- gcc.c-torture/execute/vector-subscript-1.c	(revision 170291)
+++ gcc.c-torture/execute/vector-subscript-1.c	(working copy)
@@ -46,13 +46,13 @@  int main( int argc, char* argv[] )
     __builtin_abort ();
   if (*f(&val3, 2 ) != 3)
     __builtin_abort ();
   if (*f(&val3, 3 ) != 4)
     __builtin_abort ();
     
-  __builtin_memcpy(a, &val3, 16);
+  __builtin_memcpy(a, &val3, sizeof(a));
   for(i = 0; i < 4; i++)
     if (a[i] != i+1)
       __builtin_abort ();
   
   
   return 0;
Index: gcc.c-torture/compile/pr43191.c
===================================================================
--- gcc.c-torture/compile/pr43191.c	(revision 170291)
+++ gcc.c-torture/compile/pr43191.c	(working copy)
@@ -1,7 +1,8 @@ 
 /* { dg-skip-if "Ints are 16 bits" { "pdp11-*-*" } { "*" } { "" } } */ 
+/* { dg-require-effective-target int32plus } */
 struct S0
 {
 };
 
 struct S1
 {
Index: gcc.c-torture/compile/pr35318.c
===================================================================
--- gcc.c-torture/compile/pr35318.c	(revision 170291)
+++ gcc.c-torture/compile/pr35318.c	(working copy)
@@ -1,7 +1,7 @@ 
-/* { dg-skip-if "" { pdp11-*-* } { "*" } { "" } } */
+/* { dg-skip-if "" { pdp11-*-* m32c-*-* } { "*" } { "" } } */
 /* PR target/35318 */
 
 void
 foo ()
 {
   double x = 4, y;
Index: gcc.c-torture/compile/20011114-1.c
===================================================================
--- gcc.c-torture/compile/20011114-1.c	(revision 170291)
+++ gcc.c-torture/compile/20011114-1.c	(working copy)
@@ -1,2 +1,3 @@ 
+/* { dg-require-effective-target size32plus } */
 extern void _text;
 static __SIZE_TYPE__ x = (__SIZE_TYPE__) &_text - 0x10000000L - 1;
Index: gcc.c-torture/compile/pr41181.c
===================================================================
--- gcc.c-torture/compile/pr41181.c	(revision 170291)
+++ gcc.c-torture/compile/pr41181.c	(working copy)
@@ -1,7 +1,7 @@ 
-/* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" } { "*" } { "" } } */ 
+/* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" "m32c-*-*" } { "*" } { "" } } */ 
 char paths[1024];
 static void x264_slicetype_path(char (*best_paths)[250], int n, int length)
 {
     __builtin_memcpy (best_paths[n], paths, length);
 }
 void x264_slicetype_analyse(int n, int length)
Index: gcc.dg/cdce1.c
===================================================================
--- gcc.dg/cdce1.c	(revision 170291)
+++ gcc.dg/cdce1.c	(working copy)
@@ -1,12 +1,13 @@ 
 /* { dg-do  run  } */
 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details  -lm" } */
 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details" { target *-*-netware* } } */
 /* { dg-final { scan-tree-dump  "cdce1.c:17: note: function call is shrink-wrapped into error conditions\."  "cdce" } } */
 /* { dg-final { cleanup-tree-dump "cdce" } } */
 /* { dg-require-effective-target large_double } */
+/* { dg-require-effective-target int32plus } */
 
 #include <stdlib.h>
 #include <math.h>
 #include <errno.h>
 int total_err_count = 0;
 double foo_opt (int x, double y) __attribute__((noinline));
Index: gcc.dg/pr42629.c
===================================================================
--- gcc.dg/pr42629.c	(revision 170291)
+++ gcc.dg/pr42629.c	(working copy)
@@ -1,10 +1,11 @@ 
 /* This failed -fcompare-debug because register pressure computation
    took debug insns into account.  */
 /* { dg-do compile } */
 /* { dg-options "-O1 -fsched-pressure -fschedule-insns -fcompare-debug" } */
+/* { dg-require-effective-target int32plus } */
 
 int lzo_adler32(int adler, char *buf)
 {
   int s1 = adler;
   int s2 = adler;
   s1 += buf[0];
Index: gcc.dg/pr43402.c
===================================================================
--- gcc.dg/pr43402.c	(revision 170291)
+++ gcc.dg/pr43402.c	(working copy)
@@ -25,13 +25,13 @@  getAlgorithmicTypeFromName(const char *r
     unsigned mid, start, limit;
     unsigned lastMid;
     int result;
     start = 0;
     limit = sizeof(cnvNameType)/sizeof(cnvNameType[0]);
     mid = limit;
-    lastMid = 0xffffffff;
+    lastMid = (unsigned)~0;
 
     for (;;) {
         mid = (start + limit) / 2;
         if (lastMid == mid) {   /* Have we moved? */
             break;  /* We haven't moved, and it wasn't found. */
         }
Index: gcc.dg/pr34225.c
===================================================================
--- gcc.dg/pr34225.c	(revision 170291)
+++ gcc.dg/pr34225.c	(working copy)
@@ -1,10 +1,11 @@ 
 /* PR target/34225 */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fno-strict-aliasing -fstack-protector" } */
 /* { dg-require-effective-target fstack_protector } */
+/* { dg-require-effective-target size32plus } */
 
 typedef __SIZE_TYPE__ size_t;
 extern int sscanf (const char *, const char *, ...);
 struct C
 {
   char c[240];
Index: gcc.dg/sibcall-3.c
===================================================================
--- gcc.dg/sibcall-3.c	(revision 170291)
+++ gcc.dg/sibcall-3.c	(working copy)
@@ -2,13 +2,13 @@ 
    void non-leaf-function taking one int argument calling a function which
    is about the same as itself.
 
    Copyright (C) 2002 Free Software Foundation Inc.
    Contributed by Hans-Peter Nilsson  <hp@bitrange.com>  */
 
-/* { dg-do run { xfail { { arc-*-* avr-*-* cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } || { arm*-*-* && { ! arm32 } } } } } */
+/* { dg-do run { xfail { { arc-*-* avr-*-* cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32c-*-* m32r-*-* m68hc1?-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } || { arm*-*-* && { ! arm32 } } } } } */
 /* -mlongcall disables sibcall patterns.  */
 /* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */
 /* { dg-options "-O2 -foptimize-sibling-calls" } */
 
 /* The option -foptimize-sibling-calls is the default, but serves as
    marker.  This test is xfailed on targets without sibcall patterns
Index: gcc.dg/pr40971.c
===================================================================
--- gcc.dg/pr40971.c	(revision 170291)
+++ gcc.dg/pr40971.c	(working copy)
@@ -1,10 +1,11 @@ 
 /* PR target/40971 */
 /* { dg-do compile } */
 /* { dg-options "-O -fstack-protector -fno-strict-aliasing" } */
 /* { dg-require-effective-target fstack_protector } */
+/* { dg-require-effective-target size32plus } */
 
 extern void bar (char *);
 
 void
 foo (int f, long a)
 {
Index: gcc.dg/pr44023.c
===================================================================
--- gcc.dg/pr44023.c	(revision 170291)
+++ gcc.dg/pr44023.c	(working copy)
@@ -1,10 +1,11 @@ 
 /* PR debug/44023 */
 /* { dg-do compile } */
 /* { dg-options "-fcompare-debug -O2" } */
 /* { dg-options "-fcompare-debug -O2 -mcpu=ev67" { target alpha*-*-* } } */
+/* { dg-require-effective-target int32plus } */
 
 void
 foo (unsigned f, long v, unsigned *w, unsigned a, unsigned b, unsigned e, unsigned c, unsigned d)
 {
   unsigned h = v / 4, x[16];
   while (f < h)
Index: gcc.dg/utf-cvt.c
===================================================================
--- gcc.dg/utf-cvt.c	(revision 170291)
+++ gcc.dg/utf-cvt.c	(working copy)
@@ -1,10 +1,10 @@ 
 /* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
 /* Test the char16_t and char32_t promotion rules. */
 /* { dg-do compile } */
-/* { dg-excess-errors "short and int are 16bit" { target { "avr-*-*" } } } */
+/* { dg-excess-errors "short and int are 16bit" { target { "avr-*-*" "m32c-*-*" } } } */
 /* { dg-options "-std=gnu99 -Wall -Wconversion -Wsign-conversion" } */
 
 typedef __CHAR16_TYPE__ char16_t;
 typedef __CHAR32_TYPE__ char32_t;
 
 extern void f_c (char);
Index: gcc.dg/graphite/pr46966.c
===================================================================
--- gcc.dg/graphite/pr46966.c	(revision 170291)
+++ gcc.dg/graphite/pr46966.c	(working copy)
@@ -1,9 +1,10 @@ 
 /* PR tree-optimization/46966 */
 /* { dg-do compile } */
 /* { dg-options "-O -floop-interchange -ffast-math -fno-tree-copy-prop -fno-tree-loop-im" } */
+/* { dg-require-effective-target size32plus } */
 
 int a[1000][1000];
 
 void foo ()
 {
   int i, j;
Index: gcc.dg/graphite/pr42221.c
===================================================================
--- gcc.dg/graphite/pr42221.c	(revision 170291)
+++ gcc.dg/graphite/pr42221.c	(working copy)
@@ -1,7 +1,8 @@ 
 /* { dg-options "-Os -fgraphite-identity" } */
+/* { dg-require-effective-target int32plus } */
 
 static void b2w(unsigned int *out, const unsigned char *in, unsigned int len)
 {
   const unsigned char *bpend = in + len;
   for (; in != bpend; in += 4, ++out)
   {
Index: gcc.dg/graphite/scop-22.c
===================================================================
--- gcc.dg/graphite/scop-22.c	(revision 170291)
+++ gcc.dg/graphite/scop-22.c	(working copy)
@@ -1,6 +1,7 @@ 
+/* { dg-require-effective-target size32plus } */
 double u[1782225];
 
 void foo(int N, int *res)
 {
   int i;
   double a, b;
Index: gcc.dg/graphite/scop-dsyrk.c
===================================================================
--- gcc.dg/graphite/scop-dsyrk.c	(revision 170291)
+++ gcc.dg/graphite/scop-dsyrk.c	(working copy)
@@ -1,6 +1,7 @@ 
+/* { dg-require-effective-target size32plus } */
 #define NMAX 3000
 #define MEASURE_TIME 1
 
 static double a[NMAX][NMAX], c[NMAX][NMAX];
 
 void dsyrk(long N) 
Index: gcc.dg/graphite/pr46185.c
===================================================================
--- gcc.dg/graphite/pr46185.c	(revision 170291)
+++ gcc.dg/graphite/pr46185.c	(working copy)
@@ -1,8 +1,9 @@ 
 /* { dg-do run } */
 /* { dg-options "-O2 -floop-interchange -ffast-math -fno-ipa-cp" } */
+/* { dg-require-effective-target size32plus } */
 
 #define DEBUG 0
 #if DEBUG
 #include <stdio.h>
 #endif
 
Index: gcc.dg/graphite/scop-0.c
===================================================================
--- gcc.dg/graphite/scop-0.c	(revision 170291)
+++ gcc.dg/graphite/scop-0.c	(working copy)
@@ -1,6 +1,7 @@ 
+/* { dg-require-effective-target size32plus } */
 int foo (void);
 void bar (void);
 
 int toto()
 {
   /* Scop 1. */
Index: gcc.dg/graphite/pr42205-1.c
===================================================================
--- gcc.dg/graphite/pr42205-1.c	(revision 170291)
+++ gcc.dg/graphite/pr42205-1.c	(working copy)
@@ -1,7 +1,8 @@ 
 /* { dg-options "-O1 -ffast-math -floop-interchange" } */
+/* { dg-require-effective-target int32plus } */
 
 int adler32(int adler, char *buf, int n)
 {
   int sum = 0;
   do {
      adler += buf[0];
Index: gcc.dg/graphite/scop-sor.c
===================================================================
--- gcc.dg/graphite/scop-sor.c	(revision 170291)
+++ gcc.dg/graphite/scop-sor.c	(working copy)
@@ -1,6 +1,7 @@ 
+/* { dg-require-effective-target size32plus } */
 #define SIZE 10000
 
 static double P[SIZE][SIZE];
 
 void sor(int N1, int N2){
   int i, j, k;
Index: gcc.dg/graphite/scop-dsyr2k.c
===================================================================
--- gcc.dg/graphite/scop-dsyr2k.c	(revision 170291)
+++ gcc.dg/graphite/scop-dsyr2k.c	(working copy)
@@ -1,6 +1,7 @@ 
+/* { dg-require-effective-target size32plus } */
 #define NMAX 3000
 
 static double a[NMAX][NMAX], b[NMAX][NMAX], c[NMAX][NMAX];
 
 void dsyr2k(long N) {
 	int i,j,k;
Index: gcc.dg/graphite/scop-mvt.c
===================================================================
--- gcc.dg/graphite/scop-mvt.c	(revision 170291)
+++ gcc.dg/graphite/scop-mvt.c	(working copy)
@@ -1,6 +1,7 @@ 
+/* { dg-require-effective-target size32plus } */
 #define NMAX 2000
 
 static double x1[NMAX], x2[NMAX], a[NMAX][NMAX], y_1[NMAX], y_2[NMAX];
 
 void mvt(long N) {
 
Index: gcc.dg/sibcall-4.c
===================================================================
--- gcc.dg/sibcall-4.c	(revision 170291)
+++ gcc.dg/sibcall-4.c	(working copy)
@@ -2,13 +2,13 @@ 
    void non-leaf-function taking no arguments calling a function which
    is about the same as itself.
 
    Copyright (C) 2002 Free Software Foundation Inc.
    Contributed by Hans-Peter Nilsson  <hp@bitrange.com>  */
 
-/* { dg-do run { xfail { { arc-*-* avr-*-* cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } || { arm*-*-* && { ! arm32 } } } } } */
+/* { dg-do run { xfail { { arc-*-* avr-*-* cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32c-*-* m32r-*-* m68hc1?-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } || { arm*-*-* && { ! arm32 } } } } } */
 /* -mlongcall disables sibcall patterns.  */
 /* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */
 /* { dg-options "-O2 -foptimize-sibling-calls" } */
 
 /* The option -foptimize-sibling-calls is the default, but serves as
    marker.  This test is xfailed on targets without sibcall patterns
Index: gcc.dg/pr46212.c
===================================================================
--- gcc.dg/pr46212.c	(revision 170291)
+++ gcc.dg/pr46212.c	(working copy)
@@ -1,10 +1,11 @@ 
 /* PR rtl-optimization/46212 */
 /* { dg-do compile } */
 /* { dg-options "-O3 -funroll-loops" } */
 /* { dg-options "-O3 -funroll-loops -march=i386" { target { { i686-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-require-effective-target int32plus } */
 
 static inline unsigned
 foo (void *x)
 {
   unsigned y = *(volatile unsigned *) (x);
   return (y >> 24) | ((y >> 8) & 0xff00) | ((y & 0xff00) << 8) | (y << 24);
Index: gcc.dg/c99-stdint-1.c
===================================================================
--- gcc.dg/c99-stdint-1.c	(revision 170291)
+++ gcc.dg/c99-stdint-1.c	(working copy)
@@ -211,13 +211,13 @@  test_max (void)
   CHECK_UNSIGNED_LIMITS(uintmax_t, UINTMAX_MAX);
 }
 
 void
 test_misc_limits (void)
 {
-/* { dg-bogus  "size" "ptrdiff is 16bits" { xfail avr-*-* } 218 } */
+/* { dg-bogus  "size" "ptrdiff is 16bits" { xfail avr-*-* m32c-*-* } 218 } */
   CHECK_SIGNED_LIMITS_2(__PTRDIFF_TYPE__, PTRDIFF_MIN, PTRDIFF_MAX, -65535L, 65535L);
 #ifndef SIGNAL_SUPPRESS
   CHECK_LIMITS_2(sig_atomic_t, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX, -127, 127, 255);
 #endif
   CHECK_UNSIGNED_LIMITS_2(__SIZE_TYPE__, SIZE_MAX, 65535U);
   CHECK_LIMITS_2(__WCHAR_TYPE__, WCHAR_MIN, WCHAR_MAX, -127, 127, 255);
Index: gcc.dg/lto/20091013-1_1.c
===================================================================
--- gcc.dg/lto/20091013-1_1.c	(revision 170291)
+++ gcc.dg/lto/20091013-1_1.c	(working copy)
@@ -61,21 +61,26 @@  static const struct gdi_obj_funcs font_f
 
 HFONT CreateFontIndirectW( const void *plf )
 {
     return alloc_gdi_handle( 0, 6, &font_funcs );
 }
 
+#if defined(__r8c_cpu__) || defined (__m16c_cpu__)
+#define P_INT unsigned int
+#else
+#define P_INT unsigned long
+#endif
 static void update_font_code_page( DC *dc )
 {
     CHARSETINFO csi;
     int charset = (unsigned char)1;
 
     if (dc->gdiFont)
         charset = WineEngGetTextCharsetInfo( dc->gdiFont, ((void *)0), 0 );
 
-    if (TranslateCharsetInfo( ((void *)(unsigned long)((unsigned long)charset)), &csi, 1) )
+    if (TranslateCharsetInfo( ((void *)(P_INT)((P_INT)charset)), &csi, 1) )
         dc->font_code_page = csi.ciACP;
     else {
         switch(charset) {
         case (unsigned char)1:
             dc->font_code_page = GetACP();
             break;
Index: gcc.dg/lto/20090218-2_1.c
===================================================================
--- gcc.dg/lto/20090218-2_1.c	(revision 170291)
+++ gcc.dg/lto/20090218-2_1.c	(working copy)
@@ -1,14 +1,19 @@ 
 typedef struct {
 } mem_attrs;
 int main(void)
 {
   return 0;
 }
-void *malloc(unsigned long size);
-void *memcpy(void *dest, const void *src, unsigned long n);
+#if defined(__m32c__)
+#define SIZE_T unsigned int
+#else
+#define SIZE_T unsigned long
+#endif
+void *malloc(SIZE_T size);
+void *memcpy(void *dest, const void *src, SIZE_T n);
 static mem_attrs * get_mem_attrs () {
   void **slot;
   *slot = malloc (3);
   memcpy (*slot, 0, 3);
 }
 void set_mem_attributes () {
Index: gcc.dg/lto/20091013-1_2.c
===================================================================
--- gcc.dg/lto/20091013-1_2.c	(revision 170291)
+++ gcc.dg/lto/20091013-1_2.c	(working copy)
@@ -1,6 +1,8 @@ 
+/* { dg-require-effective-target int32plus } */
+/* { dg-require-effective-target ptr32plus } */
 typedef struct HDC__ { int unused; } *HDC;
 typedef struct HFONT__ { int unused; } *HFONT;
 
 void* HeapAlloc(void*,unsigned int,unsigned long);
 
 typedef struct tagLOGFONTW
Index: gcc.dg/lto/20110201-1_0.c
===================================================================
--- gcc.dg/lto/20110201-1_0.c	(revision 170291)
+++ gcc.dg/lto/20110201-1_0.c	(working copy)
@@ -1,10 +1,11 @@ 
 /* { dg-lto-do run } */
 /* { dg-lto-options { { -O0 -flto } } } */
 /* { dg-extra-ld-options "-O2 -ffast-math -fuse-linker-plugin" } */
 /* { dg-require-linker-plugin "" } */
+/* { dg-skip-if "no sqrt" { "m32c-*-*" } { "*" } { "" } } */
 
 /* We require a linker plugin because otherwise we'd need to link
    against libm which we are not sure here has cabs on all targets.
    This is because collect2 invokes ld on the -O0 object code
    which does not have folded cabs.  */
 
Index: gcc.dg/torture/pr43165.c
===================================================================
--- gcc.dg/torture/pr43165.c	(revision 170291)
+++ gcc.dg/torture/pr43165.c	(working copy)
@@ -1,8 +1,9 @@ 
 /* PR debug/43165 */
 /* { dg-options "-g" } */
+/* { dg-require-effective-target int32plus } */
 
 struct __attribute__((packed)) S
 {
   unsigned char a;
   unsigned short b;
   unsigned short c;
Index: gcc.dg/torture/pr47228.c
===================================================================
--- gcc.dg/torture/pr47228.c	(revision 170291)
+++ gcc.dg/torture/pr47228.c	(working copy)
@@ -1,7 +1,8 @@ 
 /* { dg-do run } */
+/* { dg-require-effective-target int32plus } */
 
 struct S4
 {
   unsigned f0:24;
 } __attribute__((__packed__));
 
Index: gcc.dg/torture/stackalign/non-local-goto-5.c
===================================================================
--- gcc.dg/torture/stackalign/non-local-goto-5.c	(revision 170291)
+++ gcc.dg/torture/stackalign/non-local-goto-5.c	(working copy)
@@ -1,11 +1,11 @@ 
 /* { dg-do run } */
 
+extern void exit (int);
 #if !defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES)
 extern void abort (void);
-extern void exit (int);
 int s(i){if(i>0){__label__ l1;int f(int i){if(i==2)goto l1;return 0;}return f(i);l1:;}return 1;}
 int x(){return s(0)==1&&s(1)==0&&s(2)==1;}
 int main(){if(x()!=1)abort();exit(0);}
 #else
 int main(){ exit (0); }
 #endif
Index: gcc.dg/tree-ssa/pr23455.c
===================================================================
--- gcc.dg/tree-ssa/pr23455.c	(revision 170291)
+++ gcc.dg/tree-ssa/pr23455.c	(working copy)
@@ -16,9 +16,9 @@  bi_windup(unsigned int *outbuf, unsigned
     unsigned long t3 = outcnt;
     outbuf[t3] = bi_buf;
 }
 /* We should eliminate one load of outcnt, which will in turn let us eliminate
    one multiply of outcnt which will in turn let us eliminate
    one add involving outcnt and outbuf.  */
-/* { dg-final { scan-tree-dump-times "Eliminated: 3" 1 "pre" {target { ! avr-*-* } } } } */
-/* { dg-final { scan-tree-dump-times "Eliminated: 4" 1 "pre" {target {   avr-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 3" 1 "pre" {target { ! "avr-*-* m32c-*-*" } } } } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 4" 1 "pre" {target {   avr-*-* m32c-*-* } } } } */
 /* { dg-final { cleanup-tree-dump "pre" } } */
Index: gcc.dg/tree-ssa/vrp47.c
===================================================================
--- gcc.dg/tree-ssa/vrp47.c	(revision 170291)
+++ gcc.dg/tree-ssa/vrp47.c	(working copy)
@@ -1,12 +1,12 @@ 
 /* Skip on MIPS, where LOGICAL_OP_NON_SHORT_CIRCUIT inhibits the setcc
    optimizations that expose the VRP opportunity.  */
 /* Skip on S/390 and avr.  Lower values in BRANCH_COST lead to two conditional
    jumps when evaluating an && condition.  VRP is not able to optimize
    this.  */
-/* { dg-do compile { target { ! "mips*-*-* s390*-*-*  avr-*-* mn10300-*-*" } } } */
+/* { dg-do compile { target { ! "mips*-*-* s390*-*-*  avr-*-* m32c-*-* mn10300-*-*" } } } */
 /* { dg-options "-O2 -fdump-tree-vrp -fdump-tree-dom" } */
 /* { dg-options "-O2 -fdump-tree-vrp -fdump-tree-dom -march=i586" { target { i?86-*-* && ilp32 } } } */
 
 int h(int x, int y)
 {
   if ((x >= 0 && x <= 1) && (y >= 0 && y <= 1))
Index: gcc.dg/tree-ssa/pr45144.c
===================================================================
--- gcc.dg/tree-ssa/pr45144.c	(revision 170291)
+++ gcc.dg/tree-ssa/pr45144.c	(working copy)
@@ -1,8 +1,9 @@ 
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-require-effective-target int32plus } */
 
 void baz (unsigned);
 
 extern unsigned buf[];
 
 struct A
Index: gcc.dg/tree-ssa/gen-vect-11.c
===================================================================
--- gcc.dg/tree-ssa/gen-vect-11.c	(revision 170291)
+++ gcc.dg/tree-ssa/gen-vect-11.c	(working copy)
@@ -27,8 +27,8 @@  int main ()
     }
 
   return 0;
 }
 
 
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! avr-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! "avr-*-* m32c-*-*" } } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */
Index: gcc.dg/tree-ssa/loop-35.c
===================================================================
--- gcc.dg/tree-ssa/loop-35.c	(revision 170291)
+++ gcc.dg/tree-ssa/loop-35.c	(working copy)
@@ -57,9 +57,9 @@  void test4(struct a *A, unsigned long b)
     {
       A[b].X += i;
       A[b+1].Y += i;
     }
 }
 /* long index not hoisted for avr target PR 36561 */
-/* { dg-final { scan-tree-dump-times "Executing store motion of" 8 "lim1" { xfail { "avr-*-*" } } } } */
-/* { dg-final { scan-tree-dump-times "Executing store motion of" 6 "lim1" { target { "avr-*-*" } } } } */
+/* { dg-final { scan-tree-dump-times "Executing store motion of" 8 "lim1" { xfail { "avr-*-*" "m32c-*-*" } } } } */
+/* { dg-final { scan-tree-dump-times "Executing store motion of" 6 "lim1" { target { "avr-*-*" "m32c-*-*" } } } } */
 /* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
Index: gcc.dg/tree-ssa/ssa-fre-26.c
===================================================================
--- gcc.dg/tree-ssa/ssa-fre-26.c	(revision 170291)
+++ gcc.dg/tree-ssa/ssa-fre-26.c	(working copy)
@@ -12,8 +12,8 @@  int foo (union U *p)
   p->f = 0.0;
   u = *p;
   return u.i;
 }
 
 /* avr has 16 bit int and 32 bit float */
-/* { dg-final { scan-tree-dump "Replaced u.i with 0 in" "fre" {xfail avr-*-* } } } */
+/* { dg-final { scan-tree-dump "Replaced u.i with 0 in" "fre" {xfail avr-*-* m32c-*-* } } } */
 /* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc.dg/tree-ssa/ssa-ccp-33.c
===================================================================
--- gcc.dg/tree-ssa/ssa-ccp-33.c	(revision 170291)
+++ gcc.dg/tree-ssa/ssa-ccp-33.c	(working copy)
@@ -1,8 +1,9 @@ 
 /* { dg-do link } */
 /* { dg-options "-O" } */
+/* { dg-skip-if "pointers are bigger than size_t" { "m32c-*-*" } { "-mcpu=m32c" "-mcpu=m32cm" } { "" } } */
 
 extern void link_error ();
 int a[256];
 void foo(int n)
 {
   int *p;
Index: gcc.dg/tree-ssa/pr42585.c
===================================================================
--- gcc.dg/tree-ssa/pr42585.c	(revision 170291)
+++ gcc.dg/tree-ssa/pr42585.c	(working copy)
@@ -32,9 +32,9 @@  Cyc_string_ungetc (int ignore, struct _f
 }
 
 /* The local aggregates . */
 /* Whether the structs are totally scalarized or not depends on the
    MOVE_RATIO macro defintion in the back end.  The scalarization will
    not take place when using small values for MOVE_RATIO.  */
-/* { dg-final { scan-tree-dump-times "struct _fat_ptr _ans" 0 "optimized" { target { ! "powerpc*-*-* arm-*-* sh*-*-* s390*-*-*" } } } } */
-/* { dg-final { scan-tree-dump-times "struct _fat_ptr _T2" 0 "optimized" { target { ! "powerpc*-*-* arm-*-* sh*-*-* s390*-*-*" } } } } */
+/* { dg-final { scan-tree-dump-times "struct _fat_ptr _ans" 0 "optimized" { target { ! "powerpc*-*-* arm-*-* sh*-*-* s390*-*-* m32c-*-*" } } } } */
+/* { dg-final { scan-tree-dump-times "struct _fat_ptr _T2" 0 "optimized" { target { ! "powerpc*-*-* arm-*-* sh*-*-* s390*-*-* m32c-*-*" } } } } */
 /* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc.dg/tree-ssa/gen-vect-25.c
===================================================================
--- gcc.dg/tree-ssa/gen-vect-25.c	(revision 170291)
+++ gcc.dg/tree-ssa/gen-vect-25.c	(working copy)
@@ -51,9 +51,9 @@  static volatile int n = 1;
 
 int main (void)
 {
   return main_1 (n + 2, (int *) &n);
 }
 
-/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { ! avr-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { ! "avr-*-* m32c-*-*" } } } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! avr-*-* } } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */
Index: gcc.dg/tree-ssa/vrp51.c
===================================================================
--- gcc.dg/tree-ssa/vrp51.c	(revision 170291)
+++ gcc.dg/tree-ssa/vrp51.c	(working copy)
@@ -1,9 +1,10 @@ 
 /* PR tree-optimization/28632 */
 /* { dg-do compile } */
 /* { dg-options "-O2 -ftree-vrp" } */
+/* { dg-require-effective-target int32plus } */
 
 void
 v4 (unsigned a, unsigned b)
 {
   if (a < 0x1000) return;
   if (a > 0x1000) return;
Index: gcc.dg/pr31490.c
===================================================================
--- gcc.dg/pr31490.c	(revision 170291)
+++ gcc.dg/pr31490.c	(working copy)
@@ -1,6 +1,13 @@ 
 /* PR middle-end/31490 */
 /* { dg-do compile } */
 /* { dg-require-named-sections "" } */
+
+#if defined (__r8c_cpu__) || defined (__m16c_cpu__)
+#define PTRLONG int
+#else
+#define PTRLONG long
+#endif
+
 int cpu (void *attr) {}
-const unsigned long x __attribute__((section("foo"))) =  (unsigned long)&cpu;
-const unsigned long g __attribute__((section("foo"))) = 0;
+const unsigned PTRLONG x __attribute__((section("foo"))) =  (unsigned PTRLONG)&cpu;
+const unsigned PTRLONG g __attribute__((section("foo"))) = 0;
Index: gcc.dg/ipa/pr45644.c
===================================================================
--- gcc.dg/ipa/pr45644.c	(revision 170291)
+++ gcc.dg/ipa/pr45644.c	(working copy)
@@ -1,9 +1,10 @@ 
 /* Verify that we do not IPA-SRA bitfields.  */
 /* { dg-do run } */
 /* { dg-options "-O2"  } */
+/* { dg-require-effective-target int32plus } */
 
 extern void abort (void);
 
 struct S
 {
   int j : 8;
Index: gcc.dg/c99-stdint-2.c
===================================================================
--- gcc.dg/c99-stdint-2.c	(revision 170291)
+++ gcc.dg/c99-stdint-2.c	(working copy)
@@ -1,8 +1,8 @@ 
 /* Verify that <stdint.h> is present and follows the C99 requirements.
    Freestanding version.  */
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1999 -pedantic-errors -ffreestanding" } */
-/* { dg-xfail-if "ptrdiff size is 16bits" { avr-*-* } } */
+/* { dg-xfail-if "ptrdiff size is 16bits" { avr-*-* m32c-*-* } } */
 /* The test is that there are no diagnostics, so just include the
    hosted version.  */
 #include "c99-stdint-1.c"
Index: c-c++-common/pr44832.c
===================================================================
--- c-c++-common/pr44832.c	(revision 170291)
+++ c-c++-common/pr44832.c	(working copy)
@@ -1,10 +1,11 @@ 
 /* PR debug/44832 */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fcompare-debug" } */
 /* { dg-options "-O2 -fcompare-debug -fno-short-enums" {target short_enums} } */
+/* { dg-require-effective-target int32plus } */
 
 struct rtx_def;
 typedef struct rtx_def *rtx;
 typedef const struct rtx_def *const_rtx;
 struct rtvec_def;
 typedef struct rtvec_def *rtvec;