OSDN Git Service

* pa.c (output_call): Relocate non-jump insns in the delay slot of long
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / i386 / avx-vpermil2pd-256-1.c
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx } */
3 /* { dg-options "-O2 -mavx" } */
4
5 #include "avx-check.h"
6
7 #ifndef ZERO_MATCH
8 #define ZERO_MATCH 1 
9 #endif
10
11 static double
12 select2dp(double *src1, double *src2, long long  sel)
13 {
14     double tmp = 3.414;
15
16     if ((sel & 0x3) == 0) tmp = src1[0];
17     if ((sel & 0x3) == 1) tmp = src1[1];
18     if ((sel & 0x3) == 2) tmp = src2[0];
19     if ((sel & 0x3) == 3) tmp = src2[1];
20
21     return tmp;
22 }
23
24 static double
25 sel_and_condzerodp(double *src1, double *src2, long long  sel, int imm8)
26 {
27     double tmp;
28
29     tmp = select2dp(src1, src2, sel);
30
31     if (((imm8 & 0x3) == 2) && ((sel & 0x4) == 0x4)) tmp = 0;
32     if (((imm8 & 0x3) == 3) && ((sel & 0x4) == 0x0)) tmp = 0;
33
34     return tmp;
35 }
36
37 void static
38 avx_test ()
39 {
40     union256d u, s1, s2;
41     double   e[4] = {0.0};
42     union256i_q s3;
43
44     s1.x = _mm256_set_pd (1, 2, 3, 4);
45     s2.x = _mm256_set_pd (5, 6, 7, 8);
46     s3.x = _mm256_set_epi64x (0, 1, 2, 3);
47     u.x = _mm256_permute2_pd(s1.x, s2.x, s3.x, ZERO_MATCH);
48    
49     e[0] = sel_and_condzerodp (s1.a, s2.a, (s3.a[0] & 0xe)>>1, ZERO_MATCH);
50     e[1] = sel_and_condzerodp (s1.a, s2.a, (s3.a[1] & 0xe)>>1, ZERO_MATCH);
51     e[2] = sel_and_condzerodp (s1.a + 2, s2.a + 2, (s3.a[2] & 0xe)>>1, ZERO_MATCH);
52     e[3] = sel_and_condzerodp (s1.a + 2, s2.a + 2, (s3.a[3] & 0xe)>>1, ZERO_MATCH);
53          
54     if (check_union256d (u, e))
55       abort ();
56 }
57