summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/avx-copysignf-vec.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/i386/avx-copysignf-vec.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/i386/avx-copysignf-vec.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-copysignf-vec.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/avx-copysignf-vec.c b/gcc/testsuite/gcc.target/i386/avx-copysignf-vec.c
new file mode 100644
index 000000000..9ed3ab727
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-copysignf-vec.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx } */
+/* { dg-options "-O2 -ftree-vectorize -mavx -mtune=generic" } */
+
+#include "avx-check.h"
+
+extern float copysignf (float, float);
+
+#define N 16
+
+float a[N] = {-0.1f,-3.2f,-6.3f,-9.4f,-12.5f,-15.6f,-18.7f,-21.8f,24.9f,27.1f,30.2f,33.3f,36.4f,39.5f,42.6f,45.7f};
+float b[N] = {-1.2f,3.4f,-5.6f,7.8f,-9.0f,1.0f,-2.0f,3.0f,-4.0f,-5.0f,6.0f,7.0f,-8.0f,-9.0f,10.0f,11.0f};
+float r[N];
+
+static void
+avx_test (void)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ r[i] = copysignf (a[i], b[i]);
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ if (r[i] != copysignf (a[i], b[i]))
+ abort ();
+}