summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-14 02:36:41 +0000
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-14 02:36:41 +0000
commit66c750d28007b2a3caed7813f28311d1fff01a2e (patch)
tree3a5ec635168533a672eef3f55ea86b3fa8cf3938 /gcc
parente7bd05ebfea6e83d75d7a7cf70b8d8f633fdbb8f (diff)
downloadgcc-66c750d28007b2a3caed7813f28311d1fff01a2e.tar.gz
Add testcases for 256bit AVX copysign.
2010-10-13 H.J. Lu <hongjiu.lu@intel.com> * gcc.target/i386/avx-copysign-vec.c: New. * gcc.target/i386/avx-copysignf-vec.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165448 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-copysign-vec.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-copysignf-vec.c27
3 files changed, 59 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bdaa976125c..84e2669141e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2010-10-13 H.J. Lu <hongjiu.lu@intel.com>
+ * gcc.target/i386/avx-copysign-vec.c: New.
+ * gcc.target/i386/avx-copysignf-vec.c: Likewise.
+
+2010-10-13 H.J. Lu <hongjiu.lu@intel.com>
+
PR middle-end/44130
* gcc.target/i386/pr44130.c: New.
diff --git a/gcc/testsuite/gcc.target/i386/avx-copysign-vec.c b/gcc/testsuite/gcc.target/i386/avx-copysign-vec.c
new file mode 100644
index 00000000000..401ef914db8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-copysign-vec.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx } */
+/* { dg-options "-O2 -ftree-vectorize -mavx" } */
+
+#include "avx-check.h"
+
+extern double copysign (double, double);
+
+#define N 16
+
+double a[N] = {-0.1,-3.2,-6.3,-9.4,-12.5,-15.6,-18.7,-21.8,24.9,27.1,30.2,33.3,36.4,39.5,42.6,45.7};
+double b[N] = {-1.2,3.4,-5.6,7.8,-9.0,1.0,-2.0,3.0,-4.0,-5.0,6.0,7.0,-8.0,-9.0,10.0,11.0};
+double r[N];
+
+static void
+avx_test (void)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ r[i] = copysign (a[i], b[i]);
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ if (r[i] != copysign (a[i], b[i]))
+ abort ();
+}
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 00000000000..cdf0506b462
--- /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" } */
+
+#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 ();
+}