This obvious patch adds more handling of AVR_TINY, mostly by applying "!avr_tiny" target filter of by defaulting to generic address-space if __flash is not available.
Committed as https://gcc.gnu.org/r256690 Johann * 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.
Index: gcc.target/avr/pr52472.c =================================================================== --- gcc.target/avr/pr52472.c (revision 256686) +++ gcc.target/avr/pr52472.c (working copy) @@ -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: gcc.target/avr/pr71627.c =================================================================== --- gcc.target/avr/pr71627.c (revision 256686) +++ gcc.target/avr/pr71627.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { ! avr_tiny } } } */ /* { dg-options "-O1" } */ Index: gcc.target/avr/progmem.h =================================================================== --- gcc.target/avr/progmem.h (revision 256686) +++ gcc.target/avr/progmem.h (working copy) @@ -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__({ \ Index: gcc.target/avr/torture/addr-space-1-0.c =================================================================== --- gcc.target/avr/torture/addr-space-1-0.c (revision 256686) +++ gcc.target/avr/torture/addr-space-1-0.c (working copy) @@ -1,5 +1,5 @@ /* { dg-options "-std=gnu99" } */ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ #define __as __flash Index: gcc.target/avr/torture/addr-space-1-1.c =================================================================== --- gcc.target/avr/torture/addr-space-1-1.c (revision 256686) +++ gcc.target/avr/torture/addr-space-1-1.c (working copy) @@ -1,5 +1,5 @@ /* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ #define __as __flash1 Index: gcc.target/avr/torture/addr-space-1-x.c =================================================================== --- gcc.target/avr/torture/addr-space-1-x.c (revision 256686) +++ gcc.target/avr/torture/addr-space-1-x.c (working copy) @@ -1,5 +1,5 @@ /* { dg-options "-std=gnu99" } */ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ #define __as __memx Index: gcc.target/avr/torture/addr-space-2-0.c =================================================================== --- gcc.target/avr/torture/addr-space-2-0.c (revision 256686) +++ gcc.target/avr/torture/addr-space-2-0.c (working copy) @@ -1,5 +1,5 @@ /* { dg-options "-std=gnu99" } */ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ #define __as __flash Index: gcc.target/avr/torture/addr-space-2-1.c =================================================================== --- gcc.target/avr/torture/addr-space-2-1.c (revision 256686) +++ gcc.target/avr/torture/addr-space-2-1.c (working copy) @@ -1,5 +1,5 @@ /* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ #define __as __flash1 Index: gcc.target/avr/torture/addr-space-2-x.c =================================================================== --- gcc.target/avr/torture/addr-space-2-x.c (revision 256686) +++ gcc.target/avr/torture/addr-space-2-x.c (working copy) @@ -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. */ Index: gcc.target/avr/torture/builtins-2-flash.c =================================================================== --- gcc.target/avr/torture/builtins-2-flash.c (nonexistent) +++ gcc.target/avr/torture/builtins-2-flash.c (working copy) @@ -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: gcc.target/avr/torture/builtins-2.c =================================================================== --- gcc.target/avr/torture/builtins-2.c (revision 256686) +++ gcc.target/avr/torture/builtins-2.c (working copy) @@ -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: gcc.target/avr/torture/builtins-3-absfx.c =================================================================== --- gcc.target/avr/torture/builtins-3-absfx.c (revision 256686) +++ gcc.target/avr/torture/builtins-3-absfx.c (working copy) @@ -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: gcc.target/avr/torture/int24-mul.c =================================================================== --- gcc.target/avr/torture/int24-mul.c (revision 256686) +++ gcc.target/avr/torture/int24-mul.c (working copy) @@ -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: gcc.target/avr/torture/pr51782-1.c =================================================================== --- gcc.target/avr/torture/pr51782-1.c (revision 256686) +++ gcc.target/avr/torture/pr51782-1.c (working copy) @@ -4,6 +4,10 @@ #include <stdlib.h> +#ifndef __FLASH +#define __flash /* empty */ +#endif + struct R { char r; }; struct RGB { char r,g,b; }; Index: gcc.target/avr/torture/pr61055.c =================================================================== --- gcc.target/avr/torture/pr61055.c (revision 256686) +++ gcc.target/avr/torture/pr61055.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options { -fno-peephole2 } } */ #include <stdlib.h> Index: gcc.target/avr/torture/pr61443.c =================================================================== --- gcc.target/avr/torture/pr61443.c (revision 256686) +++ gcc.target/avr/torture/pr61443.c (working copy) @@ -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: gcc.target/avr/torture/sat-hr-plus-minus.c =================================================================== --- gcc.target/avr/torture/sat-hr-plus-minus.c (revision 256686) +++ gcc.target/avr/torture/sat-hr-plus-minus.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" Index: gcc.target/avr/torture/sat-k-plus-minus.c =================================================================== --- gcc.target/avr/torture/sat-k-plus-minus.c (revision 256686) +++ gcc.target/avr/torture/sat-k-plus-minus.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" Index: gcc.target/avr/torture/sat-llk-plus-minus.c =================================================================== --- gcc.target/avr/torture/sat-llk-plus-minus.c (revision 256686) +++ gcc.target/avr/torture/sat-llk-plus-minus.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" Index: gcc.target/avr/torture/sat-r-plus-minus.c =================================================================== --- gcc.target/avr/torture/sat-r-plus-minus.c (revision 256686) +++ gcc.target/avr/torture/sat-r-plus-minus.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" Index: gcc.target/avr/torture/sat-uhr-plus-minus.c =================================================================== --- gcc.target/avr/torture/sat-uhr-plus-minus.c (revision 256686) +++ gcc.target/avr/torture/sat-uhr-plus-minus.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" Index: gcc.target/avr/torture/sat-uk-plus-minus.c =================================================================== --- gcc.target/avr/torture/sat-uk-plus-minus.c (revision 256686) +++ gcc.target/avr/torture/sat-uk-plus-minus.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" Index: gcc.target/avr/torture/sat-ullk-plus-minus.c =================================================================== --- gcc.target/avr/torture/sat-ullk-plus-minus.c (revision 256686) +++ gcc.target/avr/torture/sat-ullk-plus-minus.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h" Index: gcc.target/avr/torture/sat-ur-plus-minus.c =================================================================== --- gcc.target/avr/torture/sat-ur-plus-minus.c (revision 256686) +++ gcc.target/avr/torture/sat-ur-plus-minus.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target { ! avr_tiny } } } */ /* { dg-options "-std=gnu99 -fwrapv" } */ #include "fix-types.h"