PR target/49868
authorgjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Mar 2012 11:32:54 +0000 (11:32 +0000)
committergjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Mar 2012 11:32:54 +0000 (11:32 +0000)
* gcc.target/avr/torture/addr-space-2.h: New file.
* gcc.target/avr/torture/addr-space-2-g.h: New test.
* gcc.target/avr/torture/addr-space-2-0.h: New test.
* gcc.target/avr/torture/addr-space-2-1.h: New test.
* gcc.target/avr/torture/addr-space-2-x.h: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185570 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/avr/torture/addr-space-2-0.c [new file with mode: 0644]
gcc/testsuite/gcc.target/avr/torture/addr-space-2-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/avr/torture/addr-space-2-g.c [new file with mode: 0644]
gcc/testsuite/gcc.target/avr/torture/addr-space-2-x.c [new file with mode: 0644]
gcc/testsuite/gcc.target/avr/torture/addr-space-2.h [new file with mode: 0644]

index 0264170..dfdee37 100644 (file)
@@ -1,3 +1,12 @@
+2012-03-20  Georg-Johann Lay  <avr@gjlay.de>
+
+       PR target/49868
+       * gcc.target/avr/torture/addr-space-2.h: New file.
+       * gcc.target/avr/torture/addr-space-2-g.h: New test.
+       * gcc.target/avr/torture/addr-space-2-0.h: New test.
+       * gcc.target/avr/torture/addr-space-2-1.h: New test.
+       * gcc.target/avr/torture/addr-space-2-x.h: New test.
+
 2012-03-20  Richard Guenther  <rguenther@suse.de>
 
        * gnat.dg/pack16.adb: New testcase.
 
        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.
+       * gcc.target/avr/torture/addr-space-1-g.h: New test.
+       * gcc.target/avr/torture/addr-space-1-0.h: New test.
+       * gcc.target/avr/torture/addr-space-1-1.h: New test.
+       * gcc.target/avr/torture/addr-space-1-x.h: New test.
 
 2012-03-12  Andrew Pinski  <apinski@cavium.com>
 
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
new file mode 100644 (file)
index 0000000..d5d4f92
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-options "-std=gnu99" } */
+/* { dg-do run } */
+
+#define __as __flash
+
+#include "addr-space-2.h"
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
new file mode 100644 (file)
index 0000000..c8041f7
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */
+/* { dg-do run } */
+
+#define __as __flash1
+
+#include "addr-space-2.h"
diff --git a/gcc/testsuite/gcc.target/avr/torture/addr-space-2-g.c b/gcc/testsuite/gcc.target/avr/torture/addr-space-2-g.c
new file mode 100644 (file)
index 0000000..ad0b2b8
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-options "-std=gnu99" } */
+/* { dg-do run } */
+
+#define __as
+
+#include "addr-space-2.h"
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
new file mode 100644 (file)
index 0000000..846cca4
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-options "-std=gnu99 -Wa,--no-warn" } */
+/* { dg-do run } */
+
+/* --no-warn because: "assembling 24-bit address needs binutils extension"
+   see binutils PR13503.  */
+
+#define __as __memx
+
+#include "addr-space-2.h"
diff --git a/gcc/testsuite/gcc.target/avr/torture/addr-space-2.h b/gcc/testsuite/gcc.target/avr/torture/addr-space-2.h
new file mode 100644 (file)
index 0000000..c95a163
--- /dev/null
@@ -0,0 +1,106 @@
+extern void exit (int);
+extern void abort (void);
+
+typedef struct T
+{
+  char val;
+  const __as struct T *l, *r;
+} tree;
+
+/*
+                    abcd   
+                   /    \
+                 ab      cd
+                /  \    /  \
+               a    b  c    d
+*/
+
+const __as tree a = { 'a', 0, 0 };
+const __as tree b = { 'b', 0, 0 };
+const __as tree c = { 'c', 0, 0 };
+const __as tree d = { 'd', 0, 0 };
+
+const __as tree ab = { 'A', &a, &b };
+const __as tree cd = { 'C', &c, &d };
+
+const __as tree abcd = { '*', &ab, &cd };
+
+static void
+test1 (void)
+{
+  if (abcd.val != '*')
+    abort();
+
+  if (abcd.l->val != 'A')
+    abort();
+  if (abcd.r->val != 'C')
+    abort();
+
+  if (abcd.l->l->val != 'a')
+    abort();
+  if (abcd.l->r->val != 'b')
+    abort();
+  if (abcd.r->l->val != 'c')
+    abort();
+  if (abcd.r->r->val != 'd')
+    abort();
+}
+
+static void
+test2 (const __as tree *t)
+{
+  if (t->val != '*')
+    abort();
+
+  if (t->l->val != 'A')
+    abort();
+  if (t->r->val != 'C')
+    abort();
+
+  if (t->l->l->val != 'a')
+    abort();
+  if (t->l->r->val != 'b')
+    abort();
+  if (t->r->l->val != 'c')
+    abort();
+  if (t->r->r->val != 'd')
+    abort();
+}
+
+static void
+test3 (const __as tree *pt)
+{
+  tree t = *pt;
+  
+  if (t.val != '*')
+    abort();
+
+  if (t.l->val != 'A')
+    abort();
+  if (t.r->val != 'C')
+    abort();
+
+  if (t.l->l->val != 'a')
+    abort();
+  if (t.l->r->val != 'b')
+    abort();
+  if (t.r->l->val != 'c')
+    abort();
+  if (t.r->r->val != 'd')
+    abort();
+}
+
+int main (void)
+{
+  const __as tree *t = &abcd;
+  test1();
+  test2 (&abcd);
+  test3 (&abcd);
+
+  __asm ("" : "+r" (t));
+  test2 (t);
+  test3 (t);
+  
+  exit (0);
+  return 0;
+}