aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2011-11-15 20:40:04 +0100
committerUros Bizjak <uros@gcc.gnu.org>2011-11-15 20:40:04 +0100
commite35525e9b44270dd312522094fe82246c572f034 (patch)
tree431c659d8778a2fd98f83a65f489794070243203
parentf41fc8aaaaabd584e4aa7e353a965f8f5568ff9d (diff)
downloadgcc-e35525e9b44270dd312522094fe82246c572f034.zip
gcc-e35525e9b44270dd312522094fe82246c572f034.tar.gz
gcc-e35525e9b44270dd312522094fe82246c572f034.tar.bz2
sse2-cvt-vec.c: New test.
* gcc.target/i386/sse2-cvt-vec.c: New test. * gcc.target/i386/avx-cvt-vec.c: Ditto. * gcc.target/i386/avx-cvt-2-vec.c: Ditto. From-SVN: r181390
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-cvt-2-vec.c60
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-cvt-vec.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-cvt-vec.c60
4 files changed, 133 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 876d918..5d012c3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,6 +1,9 @@
2011-11-15 Uros Bizjak <ubizjak@gmail.com>
- * gcc.target/i386/avx-floor-sfix-2-vec.c: New test.
+ * gcc.target/i386/sse2-cvt-vec.c: New test.
+ * gcc.target/i386/avx-cvt-vec.c: Ditto.
+ * gcc.target/i386/avx-cvt-2-vec.c: Ditto.
+ * gcc.target/i386/avx-floor-sfix-2-vec.c: Ditto.
* gcc.target/i386/avx-ceil-sfix-2-vec.c: Ditto.
* gcc.target/i386/avx-rint-sfix-2-vec.c: Ditto.
* gcc.target/i386/avx-round-sfix-2-vec.c: Ditto.
diff --git a/gcc/testsuite/gcc.target/i386/avx-cvt-2-vec.c b/gcc/testsuite/gcc.target/i386/avx-cvt-2-vec.c
new file mode 100644
index 0000000..0081dcf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-cvt-2-vec.c
@@ -0,0 +1,60 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -ffast-math -ftree-vectorize -mavx" } */
+/* { dg-require-effective-target avx } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
+
+#ifndef CHECK_H
+#define CHECK_H "avx-check.h"
+#endif
+
+#ifndef TEST
+#define TEST avx_test
+#endif
+
+#include CHECK_H
+
+#include <math.h>
+
+#define NUM 4
+
+static void
+__attribute__((__target__("fpmath=sse")))
+init_src (double *src)
+{
+ int i, sign = 1;
+ double f = rand ();
+
+ for (i = 0; i < NUM; i++)
+ {
+ src[i] = (i + 1) * f * M_PI * sign;
+ if (i < (NUM / 2))
+ {
+ if ((i % 6) == 0)
+ f = f * src[i];
+ }
+ else if (i == (NUM / 2))
+ f = rand ();
+ else if ((i % 6) == 0)
+ f = 1 / (f * (i + 1) * src[i] * M_PI * sign);
+ sign = -sign;
+ }
+}
+
+static void
+__attribute__((__target__("fpmath=sse")))
+TEST (void)
+{
+ double a[NUM];
+ float r[NUM];
+ int i;
+
+ init_src (a);
+
+ for (i = 0; i < NUM; i++)
+ r[i] = (float) a[i];
+
+ /* check results: */
+ for (i = 0; i < NUM; i++)
+ if (r[i] != (float) a[i])
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-cvt-vec.c b/gcc/testsuite/gcc.target/i386/avx-cvt-vec.c
new file mode 100644
index 0000000..4dcfa39
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-cvt-vec.c
@@ -0,0 +1,9 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -ffast-math -ftree-vectorize -mavx" } */
+/* { dg-require-effective-target avx } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
+
+#define CHECK_H "avx-check.h"
+#define TEST avx_test
+
+#include "sse2-cvt-vec.c"
diff --git a/gcc/testsuite/gcc.target/i386/sse2-cvt-vec.c b/gcc/testsuite/gcc.target/i386/sse2-cvt-vec.c
new file mode 100644
index 0000000..8a811a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-cvt-vec.c
@@ -0,0 +1,60 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -ffast-math -ftree-vectorize -msse2" } */
+/* { dg-require-effective-target sse2 } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse2-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse2_test
+#endif
+
+#include CHECK_H
+
+#include <math.h>
+
+#define NUM 64
+
+static void
+__attribute__((__target__("fpmath=sse")))
+init_src (double *src)
+{
+ int i, sign = 1;
+ double f = rand ();
+
+ for (i = 0; i < NUM; i++)
+ {
+ src[i] = (i + 1) * f * M_PI * sign;
+ if (i < (NUM / 2))
+ {
+ if ((i % 6) == 0)
+ f = f * src[i];
+ }
+ else if (i == (NUM / 2))
+ f = rand ();
+ else if ((i % 6) == 0)
+ f = 1 / (f * (i + 1) * src[i] * M_PI * sign);
+ sign = -sign;
+ }
+}
+
+static void
+__attribute__((__target__("fpmath=sse")))
+TEST (void)
+{
+ double a[NUM];
+ float r[NUM];
+ int i;
+
+ init_src (a);
+
+ for (i = 0; i < NUM; i++)
+ r[i] = (float) a[i];
+
+ /* check results: */
+ for (i = 0; i < NUM; i++)
+ if (r[i] != (float) a[i])
+ abort();
+}