Adjust tests to AVR_TINY.
authorGeorg-Johann Lay <avr@gjlay.de>
Mon, 15 Jan 2018 11:18:18 +0000 (11:18 +0000)
committerGeorg-Johann Lay <gjl@gcc.gnu.org>
Mon, 15 Jan 2018 11:18:18 +0000 (11:18 +0000)
* gcc.target/avr/progmem.h (pgm_read_char): Handle AVR_TINY.
* gcc.target/avr/pr52472.c: Add "! avr_tiny" target filter.
* gcc.target/avr/pr71627.c: Same.
* gcc.target/avr/torture/addr-space-1-0.c: Same.
* gcc.target/avr/torture/addr-space-1-1.c: Same.
* gcc.target/avr/torture/addr-space-1-x.c: Same.
* gcc.target/avr/torture/addr-space-2-0.c: Same.
* gcc.target/avr/torture/addr-space-2-1.c: Same.
* gcc.target/avr/torture/addr-space-2-x.c: Same.
* gcc.target/avr/torture/sat-hr-plus-minus.c: Same.
* gcc.target/avr/torture/sat-k-plus-minus.c: Same.
* gcc.target/avr/torture/sat-llk-plus-minus.c: Same.
* gcc.target/avr/torture/sat-r-plus-minus.c: Same.
* gcc.target/avr/torture/sat-uhr-plus-minus.c: Same.
* gcc.target/avr/torture/sat-uk-plus-minus.c: Same.
* gcc.target/avr/torture/sat-ullk-plus-minus.c: Same.
* gcc.target/avr/torture/sat-ur-plus-minus.c: Same.
* gcc.target/avr/torture/pr61055.c: Same.
* gcc.target/avr/torture/builtins-3-absfx.c: Only use __flash if
available.
* gcc.target/avr/torture/int24-mul.c: Same.
* gcc.target/avr/torture/pr51782-1.c: Same.
* gcc.target/avr/torture/pr61443.c: Same.
* gcc.target/avr/torture/builtins-2.c: Factor out addr-space stuff...
* gcc.target/avr/torture/builtins-2-flash.c: ...to this new test.

From-SVN: r256690

25 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/avr/pr52472.c
gcc/testsuite/gcc.target/avr/pr71627.c
gcc/testsuite/gcc.target/avr/progmem.h
gcc/testsuite/gcc.target/avr/torture/addr-space-1-0.c
gcc/testsuite/gcc.target/avr/torture/addr-space-1-1.c
gcc/testsuite/gcc.target/avr/torture/addr-space-1-x.c
gcc/testsuite/gcc.target/avr/torture/addr-space-2-0.c
gcc/testsuite/gcc.target/avr/torture/addr-space-2-1.c
gcc/testsuite/gcc.target/avr/torture/addr-space-2-x.c
gcc/testsuite/gcc.target/avr/torture/builtins-2-flash.c [new file with mode: 0644]
gcc/testsuite/gcc.target/avr/torture/builtins-2.c
gcc/testsuite/gcc.target/avr/torture/builtins-3-absfx.c
gcc/testsuite/gcc.target/avr/torture/int24-mul.c
gcc/testsuite/gcc.target/avr/torture/pr51782-1.c
gcc/testsuite/gcc.target/avr/torture/pr61055.c
gcc/testsuite/gcc.target/avr/torture/pr61443.c
gcc/testsuite/gcc.target/avr/torture/sat-hr-plus-minus.c
gcc/testsuite/gcc.target/avr/torture/sat-k-plus-minus.c
gcc/testsuite/gcc.target/avr/torture/sat-llk-plus-minus.c
gcc/testsuite/gcc.target/avr/torture/sat-r-plus-minus.c
gcc/testsuite/gcc.target/avr/torture/sat-uhr-plus-minus.c
gcc/testsuite/gcc.target/avr/torture/sat-uk-plus-minus.c
gcc/testsuite/gcc.target/avr/torture/sat-ullk-plus-minus.c
gcc/testsuite/gcc.target/avr/torture/sat-ur-plus-minus.c

index 614bf178085c1259e44e8c4ea961555fd3cfb940..748fdf3c7c5cdbb6dc59649670c0982e6874f5af 100644 (file)
@@ -1,3 +1,33 @@
+2018-01-15  Georg-Johann Lay  <avr@gjlay.de>
+
+       Adjust tests to AVR_TINY.
+
+       * gcc.target/avr/progmem.h (pgm_read_char): Handle AVR_TINY.
+       * gcc.target/avr/pr52472.c: Add "! avr_tiny" target filter.
+       * gcc.target/avr/pr71627.c: Same.
+       * gcc.target/avr/torture/addr-space-1-0.c: Same.
+       * gcc.target/avr/torture/addr-space-1-1.c: Same.
+       * gcc.target/avr/torture/addr-space-1-x.c: Same.
+       * gcc.target/avr/torture/addr-space-2-0.c: Same.
+       * gcc.target/avr/torture/addr-space-2-1.c: Same.
+       * gcc.target/avr/torture/addr-space-2-x.c: Same.
+       * gcc.target/avr/torture/sat-hr-plus-minus.c: Same.
+       * gcc.target/avr/torture/sat-k-plus-minus.c: Same.
+       * gcc.target/avr/torture/sat-llk-plus-minus.c: Same.
+       * gcc.target/avr/torture/sat-r-plus-minus.c: Same.
+       * gcc.target/avr/torture/sat-uhr-plus-minus.c: Same.
+       * gcc.target/avr/torture/sat-uk-plus-minus.c: Same.
+       * gcc.target/avr/torture/sat-ullk-plus-minus.c: Same.
+       * gcc.target/avr/torture/sat-ur-plus-minus.c: Same.
+       * gcc.target/avr/torture/pr61055.c: Same.
+       * gcc.target/avr/torture/builtins-3-absfx.c: Only use __flash if
+       available.
+       * gcc.target/avr/torture/int24-mul.c: Same.
+       * gcc.target/avr/torture/pr51782-1.c: Same.
+       * gcc.target/avr/torture/pr61443.c: Same.
+       * gcc.target/avr/torture/builtins-2.c: Factor out addr-space stuff...
+       * gcc.target/avr/torture/builtins-2-flash.c: ...to this new test.
+
 2018-01-15  Georg-Johann Lay  <avr@gjlay.de>
 
        PR c/83801
index 701cfb42a253155995fc99c3e43555abe40a4eb0..84ed92f0c38045835879841d6013f009dfd81771 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target { ! avr_tiny } } } */
 /* { dg-options "-Os -g -Wno-pointer-to-int-cast" } */
 
 /* This testcase exposes PR52472. expand_debug_expr mistakenly
index eaef3d20863e4a0e37b609bf45497625d84fa82d..c5f15146aceaeb0e5fe07f045a04b8ae7eea7a54 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target { ! avr_tiny } } } */
 /* { dg-options "-O1" } */
 
 
index 17bb771537474acb713505e14e606a5ecf76668a..c91dc4c3f4fe163a58caab98e5122f0e730e4344 100644 (file)
             __asm__ ("lpm %0, %a1"                          \
                      : "=r" (__result) : "z" (__addr16));   \
             __result; }))
+#elif defined (__AVR_TINY__)
+/* PR71948 auto-adds 0x4000 as needed, hance just a plain read. */
+#define pgm_read_char(addr)                                 \
+  (*(addr))
 #else
 #define pgm_read_char(addr)                                 \
     (__extension__({                                        \
index 880654201d2aa9d1b7fab2112f7e334dd99dc91a..f7265419ede19377f1c77df93c52ae8ea1ddf12b 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-options "-std=gnu99" } */
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 
 #define __as __flash
 
index 137526527706f9a72c8b7ecdb80cd667a7e0c04e..e90bdcb5bfbec0a09eeab8d43012ff6a26e35680 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 
 #define __as __flash1
 
index 0b3c43a4be7bdc25b2e36b0196ac2e6ac7e6c47b..13b20e9ae8165990c8a2becd9489f1919eb030db 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-options "-std=gnu99" } */
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 
 #define __as __memx
 
index d5d4f92a93f6f4dea6a46e5c9384788fcb99d890..2fb28e05ebd79f6fdaa0c87d1dea31116460f1aa 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-options "-std=gnu99" } */
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 
 #define __as __flash
 
index c8041f7d1e4c99b5932717f5bdb7e45f4f8a91f1..327124aff27ad4be750048db2eb2c64ad6b70ff1 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 
 #define __as __flash1
 
index 846cca47dd05d3853b30b34d0761eb02011e9ee8..0206ec953bfa045856c5d106260efb257195b6e0 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-options "-std=gnu99 -Wa,--no-warn" } */
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 
 /* --no-warn because: "assembling 24-bit address needs binutils extension"
    see binutils PR13503.  */
diff --git a/gcc/testsuite/gcc.target/avr/torture/builtins-2-flash.c b/gcc/testsuite/gcc.target/avr/torture/builtins-2-flash.c
new file mode 100644 (file)
index 0000000..318551d
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */
+/* { dg-do run { target { ! avr_tiny } } } */
+
+#include <stdlib.h>
+
+const __flash char c0 = 1;
+const __flash1 char c1 = 1;
+
+int main (void)
+{
+  const __memx void *p;
+
+  p = &c0;
+  if (__builtin_avr_flash_segment (p) != 0)
+    abort();
+
+  p = &c1;
+  if (__builtin_avr_flash_segment (p) != 1)
+    abort();
+
+  if (__builtin_avr_flash_segment ("p") != -1)
+    abort();
+
+  exit (0);
+  return 0; 
+}
index ae207d9a939d0b4add4b93286ca63d9bb496421f..0b6e016818dd7b71f070d72b3a23e77e995be441 100644 (file)
@@ -1,8 +1,7 @@
-/* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */
+/* { dg-options "-std=gnu99" } */
 /* { dg-do run } */
 
 #include <stdlib.h>
-#include "../progmem.h"
 
 int volatile a;
 
@@ -20,27 +19,11 @@ void f1 (void)
   a = __builtin_avr_insert_bits (0x1f2f5364, a, a);
 }
 
-const __flash char c0 = 1;
-const __flash1 char c1 = 1;
-
-int main (void) 
+int main (void)
 {
-  const __memx void *p;
-
   f1();
   __builtin_avr_delay_cycles (1000);
 
-  p = &c0;
-  if (__builtin_avr_flash_segment (p) != 0)
-    abort();
-
-  p = &c1;
-  if (__builtin_avr_flash_segment (p) != 1)
-    abort();
-
-  if (__builtin_avr_flash_segment ("p") != -1)
-    abort();
-
   exit (0);
   return 0; 
 }
index a8bde2952d74320af3cf048c20324193457ef88e..295b3d44b25e7890da457a867ad686ac8fda5eb0 100644 (file)
@@ -98,6 +98,10 @@ long long accum test2_llk (void)
   if (abs ## FX (-VAL ## FX) != abs ## FX (VAL ## FX))  \
     abort();
 
+#ifndef __FLASH
+#define __flash /* empty */
+#endif
+
 const __flash short fract volatile v = 0.33hr;
 const __flash short fract volatile z = 0hr;
 
index c85d9327712db58fc9ef72c78593db105280cf89..9b29763738cc9e871ab95ed9981c2de2718ed5f9 100644 (file)
@@ -3,6 +3,10 @@
 
 #include <stdlib.h>
 
+#ifndef __FLASH
+#define __flash /* empty */
+#endif
+
 const __flash __int24 vals[] =
   {
     0, 1, 2, 3, -1, -2, -3, 0xff, 0x100, 0x101,
index ff0f9d45fae85152c956645a0dbd6579ff58edf7..88ce8cd86cd43c1f39942647165d1981f65f5387 100644 (file)
@@ -4,6 +4,10 @@
 
 #include <stdlib.h>
 
+#ifndef __FLASH
+#define __flash /* empty */
+#endif
+
 struct R { char r; };
 struct RGB { char r,g,b; };
 
index 9dd1f427d00057793037a31d3bdd64f05ba88064..cac1bdaf22c5b2c321210d01c9bb5a4a8bcfeeb6 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 /* { dg-options { -fno-peephole2 } } */
 
 #include <stdlib.h>
index 12c6bca6663ae5dc20526c99b012a7cac298c46b..36df852a012f565c3a901b099fd0722795e9f34d 100644 (file)
@@ -4,6 +4,11 @@
 #include <stdlib.h>
 #include <stdarg.h>
 
+#ifndef __FLASH
+#define __flash /* empty */
+#define __memx  /* empty */
+#endif
+
 #define NC __attribute__((noinline,noclone))
 
 void NC vfun (char n, ...)
index 1e6215e4f4171f0996f2b4c07ce8851658e2b0ca..e42ce912d37b9dc54df5a5c2ff612f322b75edf4 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 /* { dg-options "-std=gnu99 -fwrapv" } */
 
 #include "fix-types.h"
index 8a26ffeeb3e99efde4d5a27777ba397d30265371..fea991e6ac540630cf0093580b83bad06ddb248b 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 /* { dg-options "-std=gnu99 -fwrapv" } */
 
 #include "fix-types.h"
index e81cbb187e0f98571764d17fd4d5729796d17854..84ab7fd9fb1e7b11ea6e3c927a2d6f4209e7914a 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 /* { dg-options "-std=gnu99 -fwrapv" } */
 
 #include "fix-types.h"
index e59bcf655ab499eeac1709bf07cf3dc7b581c0ff..72cbeee3ead412646ade006d1ef3c3bff6fbf0d1 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 /* { dg-options "-std=gnu99 -fwrapv" } */
 
 #include "fix-types.h"
index 6dd191f7ac3fa6c46fb6d7d853f05aba753e682d..f739c0d46d334b691c77a9fbb070b865a3cbab0e 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 /* { dg-options "-std=gnu99 -fwrapv" } */
 
 #include "fix-types.h"
index c9a7cd6ba4d2f2d1d577b8deb357f6f99301b5a0..e3915e3d8c85999088df2c4033e80cca68479209 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 /* { dg-options "-std=gnu99 -fwrapv" } */
 
 #include "fix-types.h"
index 22ebb8af50faf60c252fffa506939cf308bfaa89..014627a9314961fdd78da9407132c0e583b067aa 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 /* { dg-options "-std=gnu99 -fwrapv" } */
 
 #include "fix-types.h"
index bc3c0bbcd9484c297dec1b9ec1616093ca8f6743..409a4d045102217fcbf28e09cf9cebf43de0c4af 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { ! avr_tiny } } } */
 /* { dg-options "-std=gnu99 -fwrapv" } */
 
 #include "fix-types.h"