From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/gcc.target/i386/xop-vpermil2ps-1.c | 64 ++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/xop-vpermil2ps-1.c (limited to 'gcc/testsuite/gcc.target/i386/xop-vpermil2ps-1.c') diff --git a/gcc/testsuite/gcc.target/i386/xop-vpermil2ps-1.c b/gcc/testsuite/gcc.target/i386/xop-vpermil2ps-1.c new file mode 100644 index 000000000..90e59ae92 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/xop-vpermil2ps-1.c @@ -0,0 +1,64 @@ +/* { dg-do run } */ +/* { dg-require-effective-target xop } */ +/* { dg-options "-O2 -mxop" } */ + +#include "xop-check.h" + +#include + +#ifndef ZERO_MATCH +#define ZERO_MATCH 1 +#endif + +static float +select2sp(float *src1, float *src2, int sel) +{ + float tmp; + + if ((sel & 0x7) == 0) tmp = src1[0]; + if ((sel & 0x7) == 1) tmp = src1[1]; + if ((sel & 0x7) == 2) tmp = src1[2]; + if ((sel & 0x7) == 3) tmp = src1[3]; + if ((sel & 0x7) == 4) tmp = src2[0]; + if ((sel & 0x7) == 5) tmp = src2[1]; + if ((sel & 0x7) == 6) tmp = src2[2]; + if ((sel & 0x7) == 7) tmp = src2[3]; + + return tmp; +} +static float +sel_and_condzerosp(float *src1, float *src2, int sel, int imm8) +{ + float tmp; + + tmp = select2sp(src1, src2, sel & 0x7); + + if (((imm8 & 0x3) == 2) && ((sel & 0x8) == 0x8)) tmp = 0; + if (((imm8 & 0x3) == 3) && ((sel & 0x8) == 0x0)) tmp = 0; + + return tmp; +} + +void static +xop_test () +{ + int i; + union128 source1, source2, u; + union128i_d source3; + float s1[4] = {1, 2, 3, 4}; + float s2[4] = {5, 6, 7, 8}; + int s3[4] = {0, 1, 0, 1}; + float e[4]; + + source1.x = _mm_loadu_ps(s1); + source2.x = _mm_loadu_ps(s2); + source3.x = _mm_loadu_si128((__m128i*) s3); + u.x = _mm_permute2_ps(source1.x, source2.x, source3.x, ZERO_MATCH); + + for (i = 0; i < 4; ++i) { + e[i] = sel_and_condzerosp(&s1[i & 0x4], &s2[i & 0x4], s3[i] & 0xf, ZERO_MATCH & 0x3); + } + + if (check_union128 (u, e)) + abort (); +} -- cgit v1.2.3