summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-27 19:20:19 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-27 19:20:19 +0000
commit488133ac66acbad4fbb7177438c6a651c3de8a07 (patch)
treef502522737a39b8803377a20fa7f25073cbd16d1 /gcc/testsuite/gcc.target
parent5ed3bd072fbadb6e5dbac35a56dd35e94827b04d (diff)
downloadgcc-488133ac66acbad4fbb7177438c6a651c3de8a07.tar.gz
2008-05-27 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r136046 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@136051 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target')
-rw-r--r--gcc/testsuite/gcc.target/arm/naked-1.c13
-rw-r--r--gcc/testsuite/gcc.target/arm/naked-2.c12
-rw-r--r--gcc/testsuite/gcc.target/spu/muldivti3.c46
3 files changed, 71 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/arm/naked-1.c b/gcc/testsuite/gcc.target/arm/naked-1.c
new file mode 100644
index 00000000000..8f9ff711a5e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/naked-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+/* Check that function arguments aren't assigned and copied to stack slots
+ in naked functions. This ususally happens at -O0 (presumably for
+ better debugging), but is highly undesirable if we haven't created
+ a stack frame. */
+void __attribute__((naked))
+foo(int n)
+{
+ __asm__ volatile ("frob r0\n");
+}
+/* { dg-final { scan-assembler "\tfrob r0" } } */
+/* { dg-final { scan-assembler-not "\tstr" } } */
diff --git a/gcc/testsuite/gcc.target/arm/naked-2.c b/gcc/testsuite/gcc.target/arm/naked-2.c
new file mode 100644
index 00000000000..92e7db4447d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/naked-2.c
@@ -0,0 +1,12 @@
+/* Verify that __attribute__((naked)) produces a naked function
+ that does not use bx to return. Naked functions could be used
+ to implement interrupt routines and must not return using bx. */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+/* Use more arguments than we have argument registers. */
+int __attribute__((naked)) foo(int a, int b, int c, int d, int e, int f)
+{
+ __asm__ volatile ("@ naked");
+}
+/* { dg-final { scan-assembler "\t@ naked" } } */
+/* { dg-final { scan-assembler-not "\tbx\tlr" } } */
diff --git a/gcc/testsuite/gcc.target/spu/muldivti3.c b/gcc/testsuite/gcc.target/spu/muldivti3.c
new file mode 100644
index 00000000000..0363e342075
--- /dev/null
+++ b/gcc/testsuite/gcc.target/spu/muldivti3.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+/* { dg-options "-std=c99" } */
+#include <stdlib.h>
+typedef unsigned int uqword __attribute__((mode(TI)));
+typedef int qword __attribute__((mode(TI)));
+
+typedef union
+{
+ uqword uq;
+ qword q;
+ unsigned long long ull[2];
+} u;
+
+int main(void)
+{
+ uqword e, f;
+ qword g, h;
+
+ e = 0x1111111111111111ULL;
+ f = 0xFULL;
+ g = 0x0000000000111100ULL;
+ h = 0x0000000000000000ULL;
+
+ u m, n, o, p, q;
+
+ m.ull[0] = f;
+ m.ull[1] = e;
+ n.ull[0] = h;
+ n.ull[1] = g;
+
+ /* __multi3 */
+ o.q = m.q * n.q;
+
+ o.q = o.q + n.q + 0x1110FF;
+ /* __udivti3, __umodti3 */
+ p.uq = o.uq / n.uq;
+ q.uq = o.uq % n.uq;
+ if (p.uq != (m.uq+1)) abort();
+ if (q.uq != 0x1110FF) abort();
+ /* __divti3, __modti3 */
+ p.q = -o.q / n.q;
+ q.q = -o.q % n.q;
+ if ((-p.q * n.q - q.q) != o.q) abort();
+
+ return 0;
+}