From 1759d1167a0d747c9c8578034586ed5fcdb48219 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Mon, 15 Jan 2018 11:18:18 +0000 Subject: [PATCH] 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. From-SVN: r256690 --- gcc/testsuite/ChangeLog | 30 +++++++++++++++++++ gcc/testsuite/gcc.target/avr/pr52472.c | 2 +- gcc/testsuite/gcc.target/avr/pr71627.c | 2 +- gcc/testsuite/gcc.target/avr/progmem.h | 4 +++ .../gcc.target/avr/torture/addr-space-1-0.c | 2 +- .../gcc.target/avr/torture/addr-space-1-1.c | 2 +- .../gcc.target/avr/torture/addr-space-1-x.c | 2 +- .../gcc.target/avr/torture/addr-space-2-0.c | 2 +- .../gcc.target/avr/torture/addr-space-2-1.c | 2 +- .../gcc.target/avr/torture/addr-space-2-x.c | 2 +- .../gcc.target/avr/torture/builtins-2-flash.c | 26 ++++++++++++++++ .../gcc.target/avr/torture/builtins-2.c | 21 ++----------- .../gcc.target/avr/torture/builtins-3-absfx.c | 4 +++ .../gcc.target/avr/torture/int24-mul.c | 4 +++ .../gcc.target/avr/torture/pr51782-1.c | 4 +++ .../gcc.target/avr/torture/pr61055.c | 2 +- .../gcc.target/avr/torture/pr61443.c | 5 ++++ .../avr/torture/sat-hr-plus-minus.c | 2 +- .../gcc.target/avr/torture/sat-k-plus-minus.c | 2 +- .../avr/torture/sat-llk-plus-minus.c | 2 +- .../gcc.target/avr/torture/sat-r-plus-minus.c | 2 +- .../avr/torture/sat-uhr-plus-minus.c | 2 +- .../avr/torture/sat-uk-plus-minus.c | 2 +- .../avr/torture/sat-ullk-plus-minus.c | 2 +- .../avr/torture/sat-ur-plus-minus.c | 2 +- 25 files changed, 96 insertions(+), 36 deletions(-) create mode 100644 gcc/testsuite/gcc.target/avr/torture/builtins-2-flash.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 614bf178085..748fdf3c7c5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,33 @@ +2018-01-15 Georg-Johann Lay + + 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 PR c/83801 diff --git a/gcc/testsuite/gcc.target/avr/pr52472.c b/gcc/testsuite/gcc.target/avr/pr52472.c index 701cfb42a25..84ed92f0c38 100644 --- a/gcc/testsuite/gcc.target/avr/pr52472.c +++ b/gcc/testsuite/gcc.target/avr/pr52472.c @@ -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 diff --git a/gcc/testsuite/gcc.target/avr/pr71627.c b/gcc/testsuite/gcc.target/avr/pr71627.c index eaef3d20863..c5f15146ace 100644 --- a/gcc/testsuite/gcc.target/avr/pr71627.c +++ b/gcc/testsuite/gcc.target/avr/pr71627.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { ! avr_tiny } } } */ /* { dg-options "-O1" } */ diff --git a/gcc/testsuite/gcc.target/avr/progmem.h b/gcc/testsuite/gcc.target/avr/progmem.h index 17bb7715374..c91dc4c3f4f 100644 --- a/gcc/testsuite/gcc.target/avr/progmem.h +++ b/gcc/testsuite/gcc.target/avr/progmem.h @@ -13,6 +13,10 @@ __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__({ \ diff --git a/gcc/testsuite/gcc.target/avr/torture/addr-space-1-0.c b/gcc/testsuite/gcc.target/avr/torture/addr-space-1-0.c index 880654201d2..f7265419ede 100644 --- a/gcc/testsuite/gcc.target/avr/torture/addr-space-1-0.c +++ b/gcc/testsuite/gcc.target/avr/torture/addr-space-1-0.c @@ -1,5 +1,5 @@ /* { dg-options "-std=gnu99" } */ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ #define __as __flash diff --git a/gcc/testsuite/gcc.target/avr/torture/addr-space-1-1.c b/gcc/testsuite/gcc.target/avr/torture/addr-space-1-1.c index 13752652770..e90bdcb5bfb 100644 --- a/gcc/testsuite/gcc.target/avr/torture/addr-space-1-1.c +++ b/gcc/testsuite/gcc.target/avr/torture/addr-space-1-1.c @@ -1,5 +1,5 @@ /* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ #define __as __flash1 diff --git a/gcc/testsuite/gcc.target/avr/torture/addr-space-1-x.c b/gcc/testsuite/gcc.target/avr/torture/addr-space-1-x.c index 0b3c43a4be7..13b20e9ae81 100644 --- a/gcc/testsuite/gcc.target/avr/torture/addr-space-1-x.c +++ b/gcc/testsuite/gcc.target/avr/torture/addr-space-1-x.c @@ -1,5 +1,5 @@ /* { dg-options "-std=gnu99" } */ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ #define __as __memx diff --git a/gcc/testsuite/gcc.target/avr/torture/addr-space-2-0.c b/gcc/testsuite/gcc.target/avr/torture/addr-space-2-0.c index d5d4f92a93f..2fb28e05ebd 100644 --- a/gcc/testsuite/gcc.target/avr/torture/addr-space-2-0.c +++ b/gcc/testsuite/gcc.target/avr/torture/addr-space-2-0.c @@ -1,5 +1,5 @@ /* { dg-options "-std=gnu99" } */ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ #define __as __flash diff --git a/gcc/testsuite/gcc.target/avr/torture/addr-space-2-1.c b/gcc/testsuite/gcc.target/avr/torture/addr-space-2-1.c index c8041f7d1e4..327124aff27 100644 --- a/gcc/testsuite/gcc.target/avr/torture/addr-space-2-1.c +++ b/gcc/testsuite/gcc.target/avr/torture/addr-space-2-1.c @@ -1,5 +1,5 @@ /* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ #define __as __flash1 diff --git a/gcc/testsuite/gcc.target/avr/torture/addr-space-2-x.c b/gcc/testsuite/gcc.target/avr/torture/addr-space-2-x.c index 846cca47dd0..0206ec953bf 100644 --- a/gcc/testsuite/gcc.target/avr/torture/addr-space-2-x.c +++ b/gcc/testsuite/gcc.target/avr/torture/addr-space-2-x.c @@ -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 index 00000000000..318551d5ccf --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/builtins-2-flash.c @@ -0,0 +1,26 @@ +/* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */ +/* { dg-do run { target { ! avr_tiny } } } */ + +#include + +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; +} diff --git a/gcc/testsuite/gcc.target/avr/torture/builtins-2.c b/gcc/testsuite/gcc.target/avr/torture/builtins-2.c index ae207d9a939..0b6e016818d 100644 --- a/gcc/testsuite/gcc.target/avr/torture/builtins-2.c +++ b/gcc/testsuite/gcc.target/avr/torture/builtins-2.c @@ -1,8 +1,7 @@ -/* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */ +/* { dg-options "-std=gnu99" } */ /* { dg-do run } */ #include -#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; } diff --git a/gcc/testsuite/gcc.target/avr/torture/builtins-3-absfx.c b/gcc/testsuite/gcc.target/avr/torture/builtins-3-absfx.c index a8bde2952d7..295b3d44b25 100644 --- a/gcc/testsuite/gcc.target/avr/torture/builtins-3-absfx.c +++ b/gcc/testsuite/gcc.target/avr/torture/builtins-3-absfx.c @@ -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; diff --git a/gcc/testsuite/gcc.target/avr/torture/int24-mul.c b/gcc/testsuite/gcc.target/avr/torture/int24-mul.c index c85d9327712..9b29763738c 100644 --- a/gcc/testsuite/gcc.target/avr/torture/int24-mul.c +++ b/gcc/testsuite/gcc.target/avr/torture/int24-mul.c @@ -3,6 +3,10 @@ #include +#ifndef __FLASH +#define __flash /* empty */ +#endif + const __flash __int24 vals[] = { 0, 1, 2, 3, -1, -2, -3, 0xff, 0x100, 0x101, diff --git a/gcc/testsuite/gcc.target/avr/torture/pr51782-1.c b/gcc/testsuite/gcc.target/avr/torture/pr51782-1.c index ff0f9d45fae..88ce8cd86cd 100644 --- a/gcc/testsuite/gcc.target/avr/torture/pr51782-1.c +++ b/gcc/testsuite/gcc.target/avr/torture/pr51782-1.c @@ -4,6 +4,10 @@ #include +#ifndef __FLASH +#define __flash /* empty */ +#endif + struct R { char r; }; struct RGB { char r,g,b; }; diff --git a/gcc/testsuite/gcc.target/avr/torture/pr61055.c b/gcc/testsuite/gcc.target/avr/torture/pr61055.c index 9dd1f427d00..cac1bdaf22c 100644 --- a/gcc/testsuite/gcc.target/avr/torture/pr61055.c +++ b/gcc/testsuite/gcc.target/avr/torture/pr61055.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options { -fno-peephole2 } } */ #include diff --git a/gcc/testsuite/gcc.target/avr/torture/pr61443.c b/gcc/testsuite/gcc.target/avr/torture/pr61443.c index 12c6bca6663..36df852a012 100644 --- a/gcc/testsuite/gcc.target/avr/torture/pr61443.c +++ b/gcc/testsuite/gcc.target/avr/torture/pr61443.c @@ -4,6 +4,11 @@ #include #include +#ifndef __FLASH +#define __flash /* empty */ +#define __memx /* empty */ +#endif + #define NC __attribute__((noinline,noclone)) void NC vfun (char n, ...) diff --git a/gcc/testsuite/gcc.target/avr/torture/sat-hr-plus-minus.c b/gcc/testsuite/gcc.target/avr/torture/sat-hr-plus-minus.c index 1e6215e4f41..e42ce912d37 100644 --- a/gcc/testsuite/gcc.target/avr/torture/sat-hr-plus-minus.c +++ b/gcc/testsuite/gcc.target/avr/torture/sat-hr-plus-minus.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" diff --git a/gcc/testsuite/gcc.target/avr/torture/sat-k-plus-minus.c b/gcc/testsuite/gcc.target/avr/torture/sat-k-plus-minus.c index 8a26ffeeb3e..fea991e6ac5 100644 --- a/gcc/testsuite/gcc.target/avr/torture/sat-k-plus-minus.c +++ b/gcc/testsuite/gcc.target/avr/torture/sat-k-plus-minus.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" diff --git a/gcc/testsuite/gcc.target/avr/torture/sat-llk-plus-minus.c b/gcc/testsuite/gcc.target/avr/torture/sat-llk-plus-minus.c index e81cbb187e0..84ab7fd9fb1 100644 --- a/gcc/testsuite/gcc.target/avr/torture/sat-llk-plus-minus.c +++ b/gcc/testsuite/gcc.target/avr/torture/sat-llk-plus-minus.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" diff --git a/gcc/testsuite/gcc.target/avr/torture/sat-r-plus-minus.c b/gcc/testsuite/gcc.target/avr/torture/sat-r-plus-minus.c index e59bcf655ab..72cbeee3ead 100644 --- a/gcc/testsuite/gcc.target/avr/torture/sat-r-plus-minus.c +++ b/gcc/testsuite/gcc.target/avr/torture/sat-r-plus-minus.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" diff --git a/gcc/testsuite/gcc.target/avr/torture/sat-uhr-plus-minus.c b/gcc/testsuite/gcc.target/avr/torture/sat-uhr-plus-minus.c index 6dd191f7ac3..f739c0d46d3 100644 --- a/gcc/testsuite/gcc.target/avr/torture/sat-uhr-plus-minus.c +++ b/gcc/testsuite/gcc.target/avr/torture/sat-uhr-plus-minus.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" diff --git a/gcc/testsuite/gcc.target/avr/torture/sat-uk-plus-minus.c b/gcc/testsuite/gcc.target/avr/torture/sat-uk-plus-minus.c index c9a7cd6ba4d..e3915e3d8c8 100644 --- a/gcc/testsuite/gcc.target/avr/torture/sat-uk-plus-minus.c +++ b/gcc/testsuite/gcc.target/avr/torture/sat-uk-plus-minus.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" diff --git a/gcc/testsuite/gcc.target/avr/torture/sat-ullk-plus-minus.c b/gcc/testsuite/gcc.target/avr/torture/sat-ullk-plus-minus.c index 22ebb8af50f..014627a9314 100644 --- a/gcc/testsuite/gcc.target/avr/torture/sat-ullk-plus-minus.c +++ b/gcc/testsuite/gcc.target/avr/torture/sat-ullk-plus-minus.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" diff --git a/gcc/testsuite/gcc.target/avr/torture/sat-ur-plus-minus.c b/gcc/testsuite/gcc.target/avr/torture/sat-ur-plus-minus.c index bc3c0bbcd94..409a4d04510 100644 --- a/gcc/testsuite/gcc.target/avr/torture/sat-ur-plus-minus.c +++ b/gcc/testsuite/gcc.target/avr/torture/sat-ur-plus-minus.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" -- 2.30.2