re PR target/49868 (Implement named address space to place/access data in flash memory)

PR target/49868
	* gcc.target/avr/torture/addr-space-1.h: New file.
	* gcc.target/avr/torture/addr-space-g.h: New test.
	* gcc.target/avr/torture/addr-space-0.h: New test.
	* gcc.target/avr/torture/addr-space-1.h: New test.
	* gcc.target/avr/torture/addr-space-x.h: New test.

From-SVN: r185255
This commit is contained in:
Georg-Johann Lay 2012-03-12 17:55:30 +00:00 committed by Georg-Johann Lay
parent b928d32b66
commit 9438adb0a7
6 changed files with 116 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2012-03-12 Georg-Johann Lay <avr@gjlay.de>
PR target/49868
* gcc.target/avr/torture/addr-space-1.h: New file.
* gcc.target/avr/torture/addr-space-g.h: New test.
* gcc.target/avr/torture/addr-space-0.h: New test.
* gcc.target/avr/torture/addr-space-1.h: New test.
* gcc.target/avr/torture/addr-space-x.h: New test.
2012-03-12 Andrew Pinski <apinski@cavium.com>
* gcc.dg/tree-ssa/phi-opt-7.c: New testcase.

View File

@ -0,0 +1,6 @@
/* { dg-options "-std=gnu99" } */
/* { dg-do run } */
#define __as __flash
#include "addr-space-1.h"

View File

@ -0,0 +1,6 @@
/* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */
/* { dg-do run } */
#define __as __flash1
#include "addr-space-1.h"

View File

@ -0,0 +1,6 @@
/* { dg-options "-std=gnu99" } */
/* { dg-do run } */
#define __as
#include "addr-space-1.h"

View File

@ -0,0 +1,6 @@
/* { dg-options "-std=gnu99" } */
/* { dg-do run } */
#define __as __memx
#include "addr-space-1.h"

View File

@ -0,0 +1,83 @@
#include <stdlib.h>
#include <string.h>
typedef struct
{
char i1;
short i2;
long i4;
long long i8;
char str[2][10];
} a_t;
const __as a_t A =
{
12, 345, 678910, 1234567891011ll,
{
"xxx..xxx",
"yyy..yyy"
}
};
const __as volatile a_t V =
{
12+1, 345+1, 678910+1, 1234567891011ll+1,
{
"XXX..XXX",
"YYY..YYY"
}
};
a_t A2;
volatile a_t V2;
int main (void)
{
if (A.i1 != 12
|| A.i1 != V.i1 -1)
abort();
if (A.i2 != 345
|| A.i2 != V.i2 -1)
abort();
if (A.i4 != 678910
|| A.i4 != V.i4 -1)
abort();
if (A.i8 != 1234567891011ll
|| A.i8 != V.i8 -1)
abort();
A2 = A;
V2 = V;
if (A2.i1 != 12
|| A2.i1 != V2.i1 -1)
abort();
if (A2.i2 != 345
|| A2.i2 != V2.i2 -1)
abort();
if (A2.i4 != 678910
|| A2.i4 != V2.i4 -1)
abort();
if (A2.i8 != 1234567891011ll
|| A2.i8 != V2.i8 -1)
abort();
if (strcmp (A2.str[0], "xxx..xxx"))
abort();
if (strcmp (A2.str[1], "yyy..yyy"))
abort();
if (strcmp ((const char*) V2.str[0], "XXX..XXX"))
abort();
if (strcmp ((const char*) V2.str[1], "YYY..YYY"))
abort();
exit (0);
return 0;
}