Re: RFA: Fix some gcc tests for 16-bit targets

2014-02-19 Thread Richard Biener
On Tue, Feb 18, 2014 at 5:39 PM, nick clifton ni...@redhat.com wrote:
 Hi Richard,


 Instead of modifying testcases I'd be less nervous if you'd make them
 require 32bit. Otherwise you should reproduce the original issues with the
 modified testcases.


 OK, I can do that.  How about this patch.


 OK to apply ?

Ok.

Thanks,
Richard.

 Cheers
   Nick

 gcc/testsuite/ChangeLog
 2014-02-18  Nick Clifton  ni...@redhat.com

 * gcc.dg/graphite/pr46966.c: Only run on 32-bit+ targets.
 * gcc.dg/pr23623.c: Likewise.
 * gcc.dg/pr48784-1.c: Likewise.
 * gcc.dg/pr48784-2.c: Likewise.
 * gcc.dg/pr56997-2.c: Likewise.
 * gcc.dg/sms-6.c: Likewise.
 * gcc.dg/torture/pr60183.c: Likewise.
 * gcc.dg/torture/vec-cvt-1.c: Likewise.
 * gcc.c-torture/execute/20061220-1.x: New.
 * gcc.c-torture/execute/pr43220.x: New.
 * gcc.c-torture/execute/pr51581-1.x: New.
 * gcc.c-torture/execute/pr51581-2.x: New.
 * gcc.c-torture/execute/pr58570.x: New.
 * gcc.c-torture/unsorted/DFcmp.x: New.
 * gcc.c-torture/unsorted/SFset.x: New.



Re: RFA: Fix some gcc tests for 16-bit targets

2014-02-18 Thread nick clifton

Hi Richard,


Instead of modifying testcases I'd be less nervous if you'd make them require 
32bit. Otherwise you should reproduce the original issues with the modified 
testcases.


OK, I can do that.  How about this patch.

OK to apply ?

Cheers
  Nick

gcc/testsuite/ChangeLog
2014-02-18  Nick Clifton  ni...@redhat.com

* gcc.dg/graphite/pr46966.c: Only run on 32-bit+ targets.
* gcc.dg/pr23623.c: Likewise.
* gcc.dg/pr48784-1.c: Likewise.
* gcc.dg/pr48784-2.c: Likewise.
* gcc.dg/pr56997-2.c: Likewise.
* gcc.dg/sms-6.c: Likewise.
* gcc.dg/torture/pr60183.c: Likewise.
* gcc.dg/torture/vec-cvt-1.c: Likewise.
* gcc.c-torture/execute/20061220-1.x: New.
* gcc.c-torture/execute/pr43220.x: New.
* gcc.c-torture/execute/pr51581-1.x: New.
* gcc.c-torture/execute/pr51581-2.x: New.
* gcc.c-torture/execute/pr58570.x: New.
* gcc.c-torture/unsorted/DFcmp.x: New.
* gcc.c-torture/unsorted/SFset.x: New.

Index: gcc/testsuite/gcc.dg/graphite/pr46966.c
===
--- gcc/testsuite/gcc.dg/graphite/pr46966.c	(revision 207836)
+++ gcc/testsuite/gcc.dg/graphite/pr46966.c	(working copy)
@@ -1,5 +1,7 @@
 /* PR tree-optimization/46966 */
 /* { dg-do compile } */
+/* This test is too big for small targets.  */
+/* { dg-require-effective-target size32plus } */
 /* { dg-options -O -floop-interchange -ffast-math -fno-tree-copy-prop -fno-tree-loop-im } */
 
 int a[1000][1000];
Index: gcc/testsuite/gcc.dg/pr23623.c
===
--- gcc/testsuite/gcc.dg/pr23623.c	(revision 207836)
+++ gcc/testsuite/gcc.dg/pr23623.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target size32plus } */
 /* { dg-options -fstrict-volatile-bitfields -fdump-rtl-final } */
 
 /* With -fstrict-volatile-bitfields, the volatile accesses to bf2.b
Index: gcc/testsuite/gcc.dg/pr48784-1.c
===
--- gcc/testsuite/gcc.dg/pr48784-1.c	(revision 207836)
+++ gcc/testsuite/gcc.dg/pr48784-1.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do run } */
+/* { dg-require-effective-target size32plus } */
 /* { dg-options -fstrict-volatile-bitfields } */
 
 extern void abort (void);
Index: gcc/testsuite/gcc.dg/pr48784-2.c
===
--- gcc/testsuite/gcc.dg/pr48784-2.c	(revision 207836)
+++ gcc/testsuite/gcc.dg/pr48784-2.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do run } */
+/* { dg-require-effective-target size32plus } */
 /* { dg-options -fno-strict-volatile-bitfields } */
 
 extern void abort (void);
Index: gcc/testsuite/gcc.dg/pr56997-2.c
===
--- gcc/testsuite/gcc.dg/pr56997-2.c	(revision 207836)
+++ gcc/testsuite/gcc.dg/pr56997-2.c	(working copy)
@@ -1,5 +1,6 @@
 /* Test volatile access to unaligned field.  */
 /* { dg-do run } */
+/* { dg-require-effective-target size32plus } */
 /* { dg-options -fstrict-volatile-bitfields } */
 
 extern void abort (void);
Index: gcc/testsuite/gcc.dg/sms-6.c
===
--- gcc/testsuite/gcc.dg/sms-6.c	(revision 207836)
+++ gcc/testsuite/gcc.dg/sms-6.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do run } */
+/* { dg-require-effective-target size32plus } */
 /* { dg-options -O2 -fmodulo-sched -fdump-rtl-sms --param sms-min-sc=1 } */
 /* { dg-options -O2 -fmodulo-sched -fdump-rtl-sms --param sms-min-sc=1 -fmodulo-sched-allow-regmoves { target powerpc*-*-* } } */
 
Index: gcc/testsuite/gcc.dg/torture/pr60183.c
===
--- gcc/testsuite/gcc.dg/torture/pr60183.c	(revision 207836)
+++ gcc/testsuite/gcc.dg/torture/pr60183.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do run } */
+/* { dg-require-effective-target size32plus } */
 
 /* Large so an out-of-bound read will crash.  */
 unsigned char c[0x30001] = { 1 };
Index: gcc/testsuite/gcc.dg/torture/vec-cvt-1.c
===
--- gcc/testsuite/gcc.dg/torture/vec-cvt-1.c	(revision 207836)
+++ gcc/testsuite/gcc.dg/torture/vec-cvt-1.c	(working copy)
@@ -1,4 +1,6 @@
 /* { dg-do run } */
+/* This test is too big for small targets.  */
+/* { dg-require-effective-target size32plus } */
 
 #include stdlib.h
 
*** /dev/null	2014-02-18 08:00:55.971916261 +
--- gcc/testsuite/gcc.c-torture/execute/20061220-1.x	2014-02-12 17:20:52.601890142 +
***
*** 0 
--- 1,6 
+ # asm statements for the RL78 do not work as expected
+ if { [istarget rl78-*-*] } {
+ return 1;
+ }
+ 
+ return 0
*** /dev/null	2014-02-18 08:00:55.971916261 +
--- gcc/testsuite/gcc.c-torture/execute/pr43220.x	2014-02-18 13:07:38.953426402 +
***
*** 0 
--- 1,7 
+ load_lib target-supports.exp
+ 
+ 

RFA: Fix some gcc tests for 16-bit targets

2014-02-17 Thread Nick Clifton
Hi Guys,

  There are several tests in the gcc testsuite which implicitly assume a
  32-bit (or larger) target.  The patch below provides fixes for these
  tests in a variety of different ways.  Where possible I have tried to
  recode the test so that it will compile on a 16-bit target, but in a
  couple of cases the test itself is too big, and so I have added a
  requirement on a 32-bit+ target.

  Tested with no regressions on an i686-pc-linux-gnu and an
  x86_64-pc-linux-gnu toolchain, and with reduction in the number of
  unexpected failures for rl78-elf, rx-elf and msp430-elf toolchains.

  OK to apply ?

Cheers
  Nick

gcc/testsuite/ChangeLog
2014-02-17  Nick Clifton  ni...@redhat.com

* gcc.dg/c-torture/execute/pr43220.c: Use a long integer to
count the iterations.
* gcc.c-torture/execute/pr58570.c: Use a long integer to hold a
29-bit bitfield.
* gcc.c-torture/unsorted/DFcmp.c: Use smaller arrays on 16-bit
targets.
* gcc.c-torture/unsorted/SFset.c: Likewise.
* gcc.dg/graphite/pr46966.c: Require a 32-bit plus target - it
is too big for smaller targets.
* gcc.dg/pr23623.c: Use a long integer to hold 31-bit
bitfields.
* gcc.dg/pr48784-1.c: Use a long integer to hold a 28-bit
bitfield.
* gcc.dg/pr48784-2.c: Likewise.
* gcc.dg/pr56997-2.c: Use a long integer as the test_type on
16-bit targets.
* gcc.dg/pr59471.c: Use a long integer as the 32-bit vector type
on 16-bit targets.
* gcc.dg/sms-6.c: Use a long integer as the array_type on
16-bit targets.
* gcc.dg/torture/vec-cvt-1.c: Require a 32-bit plus target - it
is too big for smaller targets.

Index: gcc/testsuite/gcc.c-torture/execute/pr43220.c
===
--- gcc/testsuite/gcc.c-torture/execute/pr43220.c   (revision 207817)
+++ gcc/testsuite/gcc.c-torture/execute/pr43220.c   (working copy)
@@ -3,7 +3,7 @@
 int
 main (void)
 {
-  int n = 0;
+  long int n = 0;
 lab:;
 {
   int x[n % 1000 + 1];
Index: gcc/testsuite/gcc.c-torture/execute/pr58570.c
===
--- gcc/testsuite/gcc.c-torture/execute/pr58570.c   (revision 207817)
+++ gcc/testsuite/gcc.c-torture/execute/pr58570.c   (working copy)
@@ -2,7 +2,7 @@
 struct S
 {
   int f0:15;
-  int f1:29;
+  long int f1:29;
 };
 
 int e = 1, i;
Index: gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c
===
--- gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c(revision 207817)
+++ gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c(working copy)
@@ -22,6 +22,17 @@
 #define adrx1 (E1[x1])
 #define regx1 (p1[x1])
 
+#if __SIZEOF_INT__ = 2
+#undef  E0
+#define E0  ((type *)1)
+#undef  adrreg0
+#define adrreg0 (p0[1])
+#undef  E1
+#define E1  ((type *)(  ~(__alignof__ (type) - 1)))
+#undef  adrreg1
+#define adrreg1 (p1[/4])
+#endif
+
 reg0reg1 (r0, r1, x0, x1, p0, p1)
 type r0, r1;  type *p0, *p1;
 {if (reg0 = reg1) return 1; else return 0;}
Index: gcc/testsuite/gcc.c-torture/unsorted/SFset.c
===
--- gcc/testsuite/gcc.c-torture/unsorted/SFset.c(revision 207817)
+++ gcc/testsuite/gcc.c-torture/unsorted/SFset.c(working copy)
@@ -18,6 +18,17 @@
 #define adrx1 (E1[x1])
 #define regx1 (p1[x1])
 
+#if __SIZEOF_INT__ = 2
+#undef  E0
+#define E0  ((type *)1)
+#undef  adrreg0
+#define adrreg0 (p0[1])
+#undef  E1
+#define E1  ((type *)(  ~(__alignof__ (type) - 1)))
+#undef  adrreg1
+#define adrreg1 (p1[/4])
+#endif
+
 int glob0, glob1;
 
 #define type float
Index: gcc/testsuite/gcc.dg/graphite/pr46966.c
===
--- gcc/testsuite/gcc.dg/graphite/pr46966.c (revision 207817)
+++ gcc/testsuite/gcc.dg/graphite/pr46966.c (working copy)
@@ -1,5 +1,7 @@
 /* PR tree-optimization/46966 */
 /* { dg-do compile } */
+/* This test is too big for small targets.  */
+/* { dg-require-effective-target size32plus } */
 /* { dg-options -O -floop-interchange -ffast-math -fno-tree-copy-prop 
-fno-tree-loop-im } */
 
 int a[1000][1000];
Index: gcc/testsuite/gcc.dg/pr23623.c
===
--- gcc/testsuite/gcc.dg/pr23623.c  (revision 207817)
+++ gcc/testsuite/gcc.dg/pr23623.c  (working copy)
@@ -8,19 +8,19 @@
 extern struct
 {
   unsigned int b : 1;
-  unsigned int : 31;
+  unsigned long int : 31;
 } bf1;
 
 extern volatile struct
 {
   unsigned int b : 1;
-  unsigned int : 31;
+  unsigned long int : 31;
 } bf2;
 
 extern struct
 {
   volatile unsigned int b : 1;
-  volatile unsigned int : 31;
+  volatile unsigned long int : 31;
 } bf3;
 
 void writeb(void)
@@ -45,4 +45,3 @@
variable, we need to give a count of 12 instead of 6 

Re: RFA: Fix some gcc tests for 16-bit targets

2014-02-17 Thread DJ Delorie

  struct S
  {
int f0:15;
 -  int f1:29;
 +  long int f1:29;
  };

IIRC if you change one field here, you need to change both as some
targets won't pack fields together if the types don't match.

Likewise for other struct-field cases.



Re: RFA: Fix some gcc tests for 16-bit targets

2014-02-17 Thread Richard Biener
On February 17, 2014 6:03:56 PM GMT+01:00, Nick Clifton ni...@redhat.com 
wrote:
Hi Guys,

 There are several tests in the gcc testsuite which implicitly assume a
  32-bit (or larger) target.  The patch below provides fixes for these
  tests in a variety of different ways.  Where possible I have tried to
  recode the test so that it will compile on a 16-bit target, but in a
  couple of cases the test itself is too big, and so I have added a
  requirement on a 32-bit+ target.

  Tested with no regressions on an i686-pc-linux-gnu and an
  x86_64-pc-linux-gnu toolchain, and with reduction in the number of
  unexpected failures for rl78-elf, rx-elf and msp430-elf toolchains.

  OK to apply ?

Instead of modifying testcases I'd be less nervous if you'd make them require 
32bit. Otherwise you should reproduce the original issues with the modified 
testcases.

Thanks,
Richard.

Cheers
  Nick

gcc/testsuite/ChangeLog
2014-02-17  Nick Clifton  ni...@redhat.com

   * gcc.dg/c-torture/execute/pr43220.c: Use a long integer to
   count the iterations.
* gcc.c-torture/execute/pr58570.c: Use a long integer to hold a
   29-bit bitfield.
* gcc.c-torture/unsorted/DFcmp.c: Use smaller arrays on 16-bit
   targets.
* gcc.c-torture/unsorted/SFset.c: Likewise.
* gcc.dg/graphite/pr46966.c: Require a 32-bit plus target - it
   is too big for smaller targets.
* gcc.dg/pr23623.c: Use a long integer to hold 31-bit
   bitfields.
* gcc.dg/pr48784-1.c: Use a long integer to hold a 28-bit
   bitfield.
* gcc.dg/pr48784-2.c: Likewise.
* gcc.dg/pr56997-2.c: Use a long integer as the test_type on
   16-bit targets.
   * gcc.dg/pr59471.c: Use a long integer as the 32-bit vector type
   on 16-bit targets.
* gcc.dg/sms-6.c: Use a long integer as the array_type on
   16-bit targets.
* gcc.dg/torture/vec-cvt-1.c: Require a 32-bit plus target - it
   is too big for smaller targets.

Index: gcc/testsuite/gcc.c-torture/execute/pr43220.c
===
--- gcc/testsuite/gcc.c-torture/execute/pr43220.c  (revision 207817)
+++ gcc/testsuite/gcc.c-torture/execute/pr43220.c  (working copy)
@@ -3,7 +3,7 @@
 int
 main (void)
 {
-  int n = 0;
+  long int n = 0;
 lab:;
 {
   int x[n % 1000 + 1];
Index: gcc/testsuite/gcc.c-torture/execute/pr58570.c
===
--- gcc/testsuite/gcc.c-torture/execute/pr58570.c  (revision 207817)
+++ gcc/testsuite/gcc.c-torture/execute/pr58570.c  (working copy)
@@ -2,7 +2,7 @@
 struct S
 {
   int f0:15;
-  int f1:29;
+  long int f1:29;
 };
 
 int e = 1, i;
Index: gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c
===
--- gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c   (revision 207817)
+++ gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c   (working copy)
@@ -22,6 +22,17 @@
 #define adrx1 (E1[x1])
 #define regx1 (p1[x1])
 
+#if __SIZEOF_INT__ = 2
+#undef  E0
+#define E0  ((type *)1)
+#undef  adrreg0
+#define adrreg0 (p0[1])
+#undef  E1
+#define E1  ((type *)(  ~(__alignof__ (type) - 1)))
+#undef  adrreg1
+#define adrreg1 (p1[/4])
+#endif
+
 reg0reg1 (r0, r1, x0, x1, p0, p1)
 type r0, r1;  type *p0, *p1;
 {if (reg0 = reg1) return 1; else return 0;}
Index: gcc/testsuite/gcc.c-torture/unsorted/SFset.c
===
--- gcc/testsuite/gcc.c-torture/unsorted/SFset.c   (revision 207817)
+++ gcc/testsuite/gcc.c-torture/unsorted/SFset.c   (working copy)
@@ -18,6 +18,17 @@
 #define adrx1 (E1[x1])
 #define regx1 (p1[x1])
 
+#if __SIZEOF_INT__ = 2
+#undef  E0
+#define E0  ((type *)1)
+#undef  adrreg0
+#define adrreg0 (p0[1])
+#undef  E1
+#define E1  ((type *)(  ~(__alignof__ (type) - 1)))
+#undef  adrreg1
+#define adrreg1 (p1[/4])
+#endif
+
 int glob0, glob1;
 
 #define type float
Index: gcc/testsuite/gcc.dg/graphite/pr46966.c
===
--- gcc/testsuite/gcc.dg/graphite/pr46966.c(revision 207817)
+++ gcc/testsuite/gcc.dg/graphite/pr46966.c(working copy)
@@ -1,5 +1,7 @@
 /* PR tree-optimization/46966 */
 /* { dg-do compile } */
+/* This test is too big for small targets.  */
+/* { dg-require-effective-target size32plus } */
/* { dg-options -O -floop-interchange -ffast-math -fno-tree-copy-prop
-fno-tree-loop-im } */
 
 int a[1000][1000];
Index: gcc/testsuite/gcc.dg/pr23623.c
===
--- gcc/testsuite/gcc.dg/pr23623.c (revision 207817)
+++ gcc/testsuite/gcc.dg/pr23623.c (working copy)
@@ -8,19 +8,19 @@
 extern struct
 {
   unsigned int b : 1;
-  unsigned int : 31;
+  unsigned long int : 31;
 } bf1;
 
 extern volatile struct
 {
   unsigned int b : 1;
-  unsigned int : 31;
+  unsigned long