aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-vextracti128-2.c
blob: 7d3c561a14f4801560963bd67a18ca6fe2895449 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* { dg-do run } */
/* { dg-require-effective-target avx2 } */
/* { dg-options "-O2 -mavx2" } */

#include <string.h>
#include "avx2-check.h"

void static
avx2_test (void)
{
  union256i_q s1;
  union128i_q res;
  long long int res_ref[2];
  int j;

  for (j = 0; j < 4; j++)
    s1.a[j] = j * j;

  res.x = _mm256_extracti128_si256 (s1.x, 0);

  memset (res_ref, 0, 16);
  memcpy (res_ref, s1.a, 16);

  if (check_union128i_q (res, res_ref))
    abort ();

  res.x = _mm256_extracti128_si256 (s1.x, 1);

  memset (res_ref, 0, 16);
  memcpy (res_ref, s1.a + 2, 16);

  if (check_union128i_q (res, res_ref))
    abort ();
}