summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/cris
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/cris')
-rw-r--r--gcc/testsuite/gcc.target/cris/asm-other.S15
-rw-r--r--gcc/testsuite/gcc.target/cris/asm-v10.S6
-rw-r--r--gcc/testsuite/gcc.target/cris/asm-v8.S6
-rw-r--r--gcc/testsuite/gcc.target/cris/inasm-other.c23
-rw-r--r--gcc/testsuite/gcc.target/cris/inasm-v10.c6
-rw-r--r--gcc/testsuite/gcc.target/cris/inasm-v8.c6
-rw-r--r--gcc/testsuite/gcc.target/cris/torture/trap-1.c13
-rw-r--r--gcc/testsuite/gcc.target/cris/torture/trap-2.c11
-rw-r--r--gcc/testsuite/gcc.target/cris/torture/trap-3.c10
-rw-r--r--gcc/testsuite/gcc.target/cris/torture/trap-v0.c11
-rw-r--r--gcc/testsuite/gcc.target/cris/torture/trap-v3.c12
11 files changed, 119 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/cris/asm-other.S b/gcc/testsuite/gcc.target/cris/asm-other.S
new file mode 100644
index 00000000000..4fe7ebfc41c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/asm-other.S
@@ -0,0 +1,15 @@
+/* { dg-do assemble } */
+/* { dg-options "-DOTHER_ISA=0 -march=v0" { target crisv32-*-* } } */
+/* { dg-options "-DOTHER_ISA=32 -march=v32" { target cris-*-* } } */
+
+/* Make sure we can assemble for the "other" variant, with the twist
+ that the gcc option -march=v0 isn't valid for the assembler. */
+ .text
+#if OTHER_ISA == 32
+ addoq 42,$r1,$acr
+#else
+0:
+ move.d [$r2=$r0+42],$r1
+ bwf 0b
+ nop
+#endif
diff --git a/gcc/testsuite/gcc.target/cris/asm-v10.S b/gcc/testsuite/gcc.target/cris/asm-v10.S
new file mode 100644
index 00000000000..c85ebe293bc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/asm-v10.S
@@ -0,0 +1,6 @@
+/* { dg-do assemble } */
+/* { dg-options "-DOTHER_ISA=10 -march=v10" } */
+
+/* Check that -march=v10 is also recognized. */
+
+#include "asm-other.S"
diff --git a/gcc/testsuite/gcc.target/cris/asm-v8.S b/gcc/testsuite/gcc.target/cris/asm-v8.S
new file mode 100644
index 00000000000..3fba3188454
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/asm-v8.S
@@ -0,0 +1,6 @@
+/* { dg-do assemble } */
+/* { dg-options "-DOTHER_ISA=8 -march=v8" } */
+
+/* Check that -march=v8 is also recognized. */
+
+#include "asm-other.S"
diff --git a/gcc/testsuite/gcc.target/cris/inasm-other.c b/gcc/testsuite/gcc.target/cris/inasm-other.c
new file mode 100644
index 00000000000..c1c043f56d3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/inasm-other.c
@@ -0,0 +1,23 @@
+/* { dg-do assemble } */
+/* { dg-options "-DOTHER_ISA=0 -march=v0" { target crisv32-*-* } } */
+/* { dg-options "-DOTHER_ISA=32 -march=v32" { target cris-*-* } } */
+
+/* Make sure we can (generate code and) assemble for the "other"
+ variant, with the twist that the gcc option -march=v0 isn't
+ valid for the assembler. We don't check that the generated code
+ is for the other variant; other tests cover that already, but they
+ don't *assemble* the result. We can't trust the prologue and
+ epilogue to contain incompatible insns (they actually deliberately
+ don't, usually and it'd be brittle to tweak the function signature
+ to make it so), so we force some with inline asm. */
+
+void f(void)
+{
+#if OTHER_ISA == 32
+ asm volatile ("addoq 42,$r11,$acr");
+#else
+ asm volatile ("0: move.d [$r12=$sp+42],$r10\n\t"
+ "bwf 0b\n\t"
+ "nop");
+#endif
+}
diff --git a/gcc/testsuite/gcc.target/cris/inasm-v10.c b/gcc/testsuite/gcc.target/cris/inasm-v10.c
new file mode 100644
index 00000000000..75379b3c8c2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/inasm-v10.c
@@ -0,0 +1,6 @@
+/* { dg-do assemble } */
+/* { dg-options "-DOTHER_ISA=10 -march=v10" } */
+
+/* Check that -march=v10 is also recognized. */
+
+#include "inasm-other.c"
diff --git a/gcc/testsuite/gcc.target/cris/inasm-v8.c b/gcc/testsuite/gcc.target/cris/inasm-v8.c
new file mode 100644
index 00000000000..b2fb3053c40
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/inasm-v8.c
@@ -0,0 +1,6 @@
+/* { dg-do assemble } */
+/* { dg-options "-DOTHER_ISA=8 -march=v8" } */
+
+/* Check that -march=v8 is also recognized. */
+
+#include "inasm-other.c"
diff --git a/gcc/testsuite/gcc.target/cris/torture/trap-1.c b/gcc/testsuite/gcc.target/cris/torture/trap-1.c
new file mode 100644
index 00000000000..48363fbb3f0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/torture/trap-1.c
@@ -0,0 +1,13 @@
+/* Check that "break 8" defaults according to CPU version. */
+/* { dg-do compile } */
+/* { dg-skip-if "" { "*-*-*" } { "-march*" } { "" } } */
+/* { dg-final { scan-assembler "break 8" { target { ! cris-*-elf } } } } */
+/* { dg-final { scan-assembler-not "bsr" { target { ! cris-*-elf } } } } */
+/* { dg-final { scan-assembler-not "jsr" { target { ! cris-*-elf } } } } */
+/* { dg-final { scan-assembler-not "break\[ \t\]" { target cris-*-elf } } } */
+/* { dg-final { scan-assembler "\[jb\]sr \[_\]\?abort" { target cris-*-elf } } } */
+
+void do_trap (void)
+{
+ __builtin_trap ();
+}
diff --git a/gcc/testsuite/gcc.target/cris/torture/trap-2.c b/gcc/testsuite/gcc.target/cris/torture/trap-2.c
new file mode 100644
index 00000000000..155d5fe4273
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/torture/trap-2.c
@@ -0,0 +1,11 @@
+/* As trap-1.c but forcing on. */
+/* { dg-do compile } */
+/* { dg-options "-mtrap-using-break8" } */
+/* { dg-final { scan-assembler "break 8" } } */
+/* { dg-final { scan-assembler-not "bsr" } } */
+/* { dg-final { scan-assembler-not "jsr" } } */
+
+void do_trap (void)
+{
+ __builtin_trap ();
+}
diff --git a/gcc/testsuite/gcc.target/cris/torture/trap-3.c b/gcc/testsuite/gcc.target/cris/torture/trap-3.c
new file mode 100644
index 00000000000..dfa092445ec
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/torture/trap-3.c
@@ -0,0 +1,10 @@
+/* Like trap-1.c and trap-2.c but force calls to abort. */
+/* { dg-do compile } */
+/* { dg-options "-mno-trap-using-break8" } */
+/* { dg-final { scan-assembler-not "break\[ \t\]" } } */
+/* { dg-final { scan-assembler "\[jb\]sr \[_\]\?abort" } } */
+
+void do_trap (void)
+{
+ __builtin_trap ();
+}
diff --git a/gcc/testsuite/gcc.target/cris/torture/trap-v0.c b/gcc/testsuite/gcc.target/cris/torture/trap-v0.c
new file mode 100644
index 00000000000..084fb28d40b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/torture/trap-v0.c
@@ -0,0 +1,11 @@
+/* As trap-1.c but with CPU version specified, excluding. */
+/* { dg-do compile } */
+/* { dg-skip-if "" { "*-*-*" } { "-march=*" } { "" } } */
+/* { dg-options "-march=v0" } */
+/* { dg-final { scan-assembler-not "break\[ \t\]" } } */
+/* { dg-final { scan-assembler "\[jb\]sr \[_\]\?abort" } } */
+
+void do_trap (void)
+{
+ __builtin_trap ();
+}
diff --git a/gcc/testsuite/gcc.target/cris/torture/trap-v3.c b/gcc/testsuite/gcc.target/cris/torture/trap-v3.c
new file mode 100644
index 00000000000..e004c5bc82b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/torture/trap-v3.c
@@ -0,0 +1,12 @@
+/* As trap-1.c but with CPU version specified, including. */
+/* { dg-do compile } */
+/* { dg-skip-if "" { "*-*-*" } { "-march=*" } { "" } } */
+/* { dg-options "-march=v3" } */
+/* { dg-final { scan-assembler "break 8" } } */
+/* { dg-final { scan-assembler-not "bsr" } } */
+/* { dg-final { scan-assembler-not "jsr" } } */
+
+void do_trap (void)
+{
+ __builtin_trap ();
+}