summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/altivec-10.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/powerpc/altivec-10.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/powerpc/altivec-10.c')
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-10.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-10.c b/gcc/testsuite/gcc.target/powerpc/altivec-10.c
new file mode 100644
index 000000000..f532eebbf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-10.c
@@ -0,0 +1,79 @@
+/* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
+/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -mabi=altivec -fno-inline" } */
+
+#include <altivec.h>
+
+extern void exit (int);
+extern void abort (void);
+
+typedef union
+{
+ float f[4];
+ unsigned int i[4];
+ vector float v;
+} vec_float_t;
+
+void
+check_vec_all_num ()
+{
+ vec_float_t a, b, c;
+
+ a.i[0] = 0xfffa5a5a;
+ a.f[1] = 1.0;
+ a.f[2] = 1.0;
+ a.f[3] = 1.0;
+
+ b.f[0] = 1.0;
+ b.f[1] = 1.0;
+ b.f[2] = 1.0;
+ b.f[3] = 1.0;
+
+ c.i[0] = 0xfffa5a5a;
+ c.i[1] = 0xfffa5a5a;
+ c.i[2] = 0xfffa5a5a;
+ c.i[3] = 0xfffa5a5a;
+
+ if (vec_all_numeric (a.v))
+ abort ();
+
+ if (vec_all_nan (a.v))
+ abort ();
+
+ if (!vec_all_numeric (b.v))
+ abort ();
+
+ if (vec_all_nan (b.v))
+ abort ();
+
+ if (vec_all_numeric (c.v))
+ abort ();
+
+ if (!vec_all_nan (c.v))
+ abort ();
+
+}
+
+void
+check_cmple()
+{
+ vector float a = {1.0, 2.0, 3.0, 4.0};
+ vector float b = {1.0, 3.0, 2.0, 5.0};
+ vector bool int aux;
+ vector signed int le = {-1, -1, 0, -1};
+
+ aux = vec_cmple (a, b);
+
+ if (!vec_all_eq (aux, le))
+ abort ();
+}
+
+
+int
+main()
+{
+ check_cmple ();
+ check_vec_all_num ();
+ exit (0);
+}