aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/gcc/testsuite/gcc.target/i386/builtin-apply-mmx.c
diff options
context:
space:
mode:
authorJing Yu <jingyu@google.com>2010-07-22 14:03:48 -0700
committerJing Yu <jingyu@google.com>2010-07-22 14:03:48 -0700
commitb094d6c4bf572654a031ecc4afe675154c886dc5 (patch)
tree89394c56b05e13a5413ee60237d65b0214fd98e2 /gcc-4.4.3/gcc/testsuite/gcc.target/i386/builtin-apply-mmx.c
parentdc34721ac3bf7e3c406fba8cfe9d139393345ec5 (diff)
downloadtoolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.tar.gz
toolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.tar.bz2
toolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.zip
commit gcc-4.4.3 which is used to build gcc-4.4.3 Android toolchain in master.
The source is based on fsf gcc-4.4.3 and contains local patches which are recorded in gcc-4.4.3/README.google. Change-Id: Id8c6d6927df274ae9749196a1cc24dbd9abc9887
Diffstat (limited to 'gcc-4.4.3/gcc/testsuite/gcc.target/i386/builtin-apply-mmx.c')
-rw-r--r--gcc-4.4.3/gcc/testsuite/gcc.target/i386/builtin-apply-mmx.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/builtin-apply-mmx.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/builtin-apply-mmx.c
new file mode 100644
index 000000000..f6477e264
--- /dev/null
+++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/builtin-apply-mmx.c
@@ -0,0 +1,42 @@
+/* __builtin_apply_args () and __builtin_return () built-in functions does
+ not function properly when -mmmx is used in compile flags.
+ __builtin_apply_args () saves all registers that pass arguments to a
+ function, including %mm0-%mm3, to a memory block, and __builtin_return ()
+ restores %mm0, from a return memory block, as it can be used as a
+ function return register. Unfortunatelly, when MMX registers are touched,
+ i387 FPU switches to MMX mode, and no FP operation is possible until emms
+ instruction is issued. */
+
+/* This test case is adapted from gcc.dg/builtin-apply4.c. */
+
+/* { dg-do run { xfail { ! *-*-darwin* } } } */
+/* { dg-options "-O2 -mmmx" } */
+/* { dg-require-effective-target ilp32 } */
+
+#include "mmx-check.h"
+
+extern void abort (void);
+
+double
+foo (double arg)
+{
+ if (arg != 116.0)
+ abort ();
+
+ return arg + 1.0;
+}
+
+inline double
+bar (double arg)
+{
+ foo (arg);
+ __builtin_return (__builtin_apply ((void (*)()) foo,
+ __builtin_apply_args (), 16));
+}
+
+static void
+mmx_test (void)
+{
+ if (bar (116.0) != 117.0)
+ abort ();
+}