summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/frv/fr405-builtins-1.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.target/frv/fr405-builtins-1.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.target/frv/fr405-builtins-1.c')
-rw-r--r--gcc/testsuite/gcc.target/frv/fr405-builtins-1.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/frv/fr405-builtins-1.c b/gcc/testsuite/gcc.target/frv/fr405-builtins-1.c
new file mode 100644
index 000000000..98e304e27
--- /dev/null
+++ b/gcc/testsuite/gcc.target/frv/fr405-builtins-1.c
@@ -0,0 +1,39 @@
+/* Test the IACC multiply/accumulate instructions. Also test the IACC
+ read/write functions. */
+/* { dg-options "-mcpu=fr405" } */
+/* { dg-do run } */
+extern void abort (void);
+extern void exit (int);
+
+int main ()
+{
+ long long res, res1, res2, res3;
+
+ __SMU (0x12345678, 0x40004000);
+ __SMASS (0x12000000, 0x11223344);
+ __SMSSS (0x01020304, 0x54321000);
+
+ res = __IACCreadll (0);
+ res1 = 0x12345678LL * 0x40004000LL;
+ res2 = 0x12000000LL * 0x11223344LL;
+ res3 = 0x01020304LL * 0x54321000LL;
+ if (res != res1 + res2 - res3)
+ abort ();
+
+ __IACCsetll (0, 0x7ffffffffffffff0LL);
+ __SMASS (0x100, 0x100);
+ if (__IACCreadll (0) != 0x7fffffffffffffffLL)
+ abort ();
+
+ __IACCsetl (0, -0x7ffffffe);
+ __IACCsetl (1, 0);
+ __SMSSS (0x10001, 0x10000);
+ if (__IACCreadl (0) != -0x7fffffff - 1 || __IACCreadl (1) != -0x10000)
+ abort ();
+
+ __SMSSS (0x10001, 0x10000);
+ if (__IACCreadl (0) != -0x7fffffff - 1 || __IACCreadl (1) != 0)
+ abort ();
+
+ exit (0);
+}