[Patch,testsuite] Break gcc.dg/fixed-point/convert.c into manageable parts

2012-08-21 Thread Georg-Johann Lay
Just as the title says: gcc.dg/fixed-point/convert.c is much too big to run on
embedded targets like AVR.

Note that embedded systems are a main audience of ISO/IEC TR 18037,
and that these systems might have limited resources.

The original convert.c inflates to thousands of functions and set -O0.
Some targets need to emulate *everything*, even integer multiplication,
and the executable is much too fat.

The patch breaks up convert.c in parts so that an AVR ATmega103 device
with 128KiB for executable code (.text + .data + .rodata) can run them.

Ok for trunk?

Johann

* gcc.dg/fixed-point/convert.c: Split into more manageable parts:
* gcc.dg/fixed-point/convert-1.c: New.
* gcc.dg/fixed-point/convert-2.c: New.
* gcc.dg/fixed-point/convert-3.c: New.
* gcc.dg/fixed-point/convert-4.c: New.
* gcc.dg/fixed-point/convert-float-1.c: New.
* gcc.dg/fixed-point/convert-float-2.c: New.
* gcc.dg/fixed-point/convert-float-3.c: New.
* gcc.dg/fixed-point/convert-float-4.c: New.
* gcc.dg/fixed-point/convert-accum-neg.c: New.
* gcc.dg/fixed-point/convert-sat.c: New.
* gcc.dg/fixed-point/convert.h: New.


Index: gcc/testsuite/gcc.dg/fixed-point/convert-sat.c
===
--- gcc/testsuite/gcc.dg/fixed-point/convert-sat.c	(revision 0)
+++ gcc/testsuite/gcc.dg/fixed-point/convert-sat.c	(revision 0)
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+/* { dg-options -std=gnu99 -O0 } */
+
+/* C99 6.3 Conversions.
+
+   Check conversions involving fixed-point.  */
+
+extern void abort (void);
+
+#include convert.h
+
+int main ()
+{
+  SAT_CONV1 (short _Accum, hk);
+  SAT_CONV1 (_Accum, k);
+  SAT_CONV1 (long _Accum, lk);
+  SAT_CONV1 (long long _Accum, llk);
+
+  SAT_CONV2 (unsigned short _Accum, uhk);
+  SAT_CONV2 (unsigned _Accum, uk);
+  SAT_CONV2 (unsigned long _Accum, ulk);
+  SAT_CONV2 (unsigned long long _Accum, ullk);
+
+  SAT_CONV3 (short _Fract, hr);
+  SAT_CONV3 (_Fract, r);
+  SAT_CONV3 (long _Fract, lr);
+  SAT_CONV3 (long long _Fract, llr);
+
+  SAT_CONV4 (signed char);
+  SAT_CONV4 (short);
+  SAT_CONV4 (int);
+  SAT_CONV4 (long);
+  SAT_CONV4 (long long);
+
+  SAT_CONV5 (unsigned char);
+  SAT_CONV5 (unsigned short);
+  SAT_CONV5 (unsigned int);
+  SAT_CONV5 (unsigned long);
+  SAT_CONV5 (unsigned long long);
+
+  SAT_CONV6 (float);
+  SAT_CONV6 (double);
+
+  return 0;
+}
Index: gcc/testsuite/gcc.dg/fixed-point/convert-accum-neg.c
===
--- gcc/testsuite/gcc.dg/fixed-point/convert-accum-neg.c	(revision 0)
+++ gcc/testsuite/gcc.dg/fixed-point/convert-accum-neg.c	(revision 0)
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options -std=gnu99 -O0 } */
+
+/* C99 6.3 Conversions.
+
+   Check conversions involving fixed-point.  */
+
+extern void abort (void);
+
+#include convert.h
+
+int main ()
+{
+  ALL_ACCUM_CONV (short _Accum, hk);
+  ALL_ACCUM_CONV (_Accum, k);
+  ALL_ACCUM_CONV (long _Accum, lk);
+  ALL_ACCUM_CONV (long long _Accum, llk);
+  ALL_ACCUM_CONV (unsigned short _Accum, uhk);
+  ALL_ACCUM_CONV (unsigned _Accum, uk);
+  ALL_ACCUM_CONV (unsigned long _Accum, ulk);
+  ALL_ACCUM_CONV (unsigned long long _Accum, ullk);
+
+  NEG_CONV (short _Fract, hr);
+  NEG_CONV (_Fract, r);
+  NEG_CONV (long _Fract, lr);
+  NEG_CONV (long long _Fract, llr);
+  NEG_CONV (short _Accum, hk);
+  NEG_CONV (_Accum, k);
+  NEG_CONV (long _Accum, lk);
+  NEG_CONV (long long _Accum, llk);
+
+  return 0;
+}
Index: gcc/testsuite/gcc.dg/fixed-point/convert-1.c
===
--- gcc/testsuite/gcc.dg/fixed-point/convert-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/fixed-point/convert-1.c	(revision 0)
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options -std=gnu99 -O0 } */
+
+/* C99 6.3 Conversions.
+
+   Check conversions involving fixed-point.  */
+
+extern void abort (void);
+
+#include convert.h
+
+int main ()
+{
+  ALL_CONV (short _Fract, hr);
+  ALL_CONV (_Fract, r);
+  ALL_CONV (long _Fract, lr);
+  ALL_CONV (long long _Fract, llr);
+
+  return 0;
+}
Index: gcc/testsuite/gcc.dg/fixed-point/convert-2.c
===
--- gcc/testsuite/gcc.dg/fixed-point/convert-2.c	(revision 0)
+++ gcc/testsuite/gcc.dg/fixed-point/convert-2.c	(revision 0)
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options -std=gnu99 -O0 } */
+
+/* C99 6.3 Conversions.
+
+   Check conversions involving fixed-point.  */
+
+extern void abort (void);
+
+#include convert.h
+
+int main ()
+{
+  ALL_CONV (unsigned short _Fract, uhr);
+  ALL_CONV (unsigned _Fract, ur);
+  ALL_CONV (unsigned long _Fract, ulr);
+  ALL_CONV (unsigned long long _Fract, ullr);
+
+  return 0;
+}
Index: gcc/testsuite/gcc.dg/fixed-point/convert.c
===
--- gcc/testsuite/gcc.dg/fixed-point/convert.c	(revision 190558)
+++ 

Re: [Patch,testsuite] Break gcc.dg/fixed-point/convert.c into manageable parts

2012-08-21 Thread Mike Stump
On Aug 21, 2012, at 4:32 AM, Georg-Johann Lay wrote:
 The patch breaks up convert.c in parts so that an AVR ATmega103 device
 with 128KiB for executable code (.text + .data + .rodata) can run them.
 
 Ok for trunk?

Ok, but watch out for any comments from the fixed-point or the C front-end 
folks.