aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/xop-vpermil2pd-256-1.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.target/i386/xop-vpermil2pd-256-1.c
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/i386/xop-vpermil2pd-256-1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/i386/xop-vpermil2pd-256-1.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/xop-vpermil2pd-256-1.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/xop-vpermil2pd-256-1.c
new file mode 100644
index 000000000..ab2079afa
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/xop-vpermil2pd-256-1.c
@@ -0,0 +1,58 @@
+/* { dg-do run } */
+/* { dg-require-effective-target xop } */
+/* { dg-options "-O2 -mxop" } */
+
+#include "xop-check.h"
+
+#include <x86intrin.h>
+
+#ifndef ZERO_MATCH
+#define ZERO_MATCH 1
+#endif
+
+static double
+select2dp(double *src1, double *src2, long long sel)
+{
+ double tmp = 3.414;
+
+ if ((sel & 0x3) == 0) tmp = src1[0];
+ if ((sel & 0x3) == 1) tmp = src1[1];
+ if ((sel & 0x3) == 2) tmp = src2[0];
+ if ((sel & 0x3) == 3) tmp = src2[1];
+
+ return tmp;
+}
+
+static double
+sel_and_condzerodp(double *src1, double *src2, long long sel, int imm8)
+{
+ double tmp;
+
+ tmp = select2dp(src1, src2, sel);
+
+ if (((imm8 & 0x3) == 2) && ((sel & 0x4) == 0x4)) tmp = 0;
+ if (((imm8 & 0x3) == 3) && ((sel & 0x4) == 0x0)) tmp = 0;
+
+ return tmp;
+}
+
+void static
+xop_test ()
+{
+ union256d u, s1, s2;
+ double e[4] = {0.0};
+ union256i_q s3;
+
+ s1.x = _mm256_set_pd (1, 2, 3, 4);
+ s2.x = _mm256_set_pd (5, 6, 7, 8);
+ s3.x = _mm256_set_epi64x (0, 1, 2, 3);
+ u.x = _mm256_permute2_pd(s1.x, s2.x, s3.x, ZERO_MATCH);
+
+ e[0] = sel_and_condzerodp (s1.a, s2.a, (s3.a[0] & 0xe)>>1, ZERO_MATCH);
+ e[1] = sel_and_condzerodp (s1.a, s2.a, (s3.a[1] & 0xe)>>1, ZERO_MATCH);
+ e[2] = sel_and_condzerodp (s1.a + 2, s2.a + 2, (s3.a[2] & 0xe)>>1, ZERO_MATCH);
+ e[3] = sel_and_condzerodp (s1.a + 2, s2.a + 2, (s3.a[3] & 0xe)>>1, ZERO_MATCH);
+
+ if (check_union256d (u, e))
+ abort ();
+}