OSDN Git Service

2010-12-30 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / i386 / avx-vperm2f128-256-2.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 IMM8
8 #  define IMM8 99
9 #endif
10
11
12 void static
13 avx_test ()
14 {
15     union256d source1, source2, u;
16     double  s1[4]={1, 2, 3, 4};
17     double  s2[4]={5, 6, 7, 8};
18     double   e[4];
19
20     source1.x = _mm256_loadu_pd(s1);
21     source2.x = _mm256_loadu_pd(s2);
22     u.x = _mm256_permute2f128_pd(source1.x, source2.x, IMM8);
23
24     if(IMM8 & 8) e[0] = e[1] = 0;
25     else{
26         e[0] = (IMM8 & 2 ? s2 : s1)[(IMM8 & 1) * 2];
27         e[1] = (IMM8 & 2 ? s2 : s1)[(IMM8 & 1) * 2 + 1];
28     }
29     if(IMM8 & 128) e[3] = e[3] = 0;
30     else{
31         unsigned m = (IMM8 >> 4) & 3;
32         e[2] = (m & 2 ? s2 : s1)[(m & 1) * 2];
33         e[3] = (m & 2 ? s2 : s1)[(m & 1) * 2 + 1];
34     }
35   
36    if (check_union256d (u, e))
37      abort ();
38 }
39