summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/sse2-vec-1.c
blob: ab2ca5b221ac5065a26c43385a4f1748b6c2271f (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
35
36
/* { dg-do run } */
/* { dg-options "-O2 -msse2" } */
/* { dg-require-effective-target sse2 } */

#include "sse2-check.h"

#include <emmintrin.h>

#define msk0   0
#define msk1   1

static void
sse2_test (void)
{
  union
    {
      __m128d x;
      double d[2];
    } val1;
  double res[2];
  int masks[2];
  int i;

  val1.d[0] = 23.;
  val1.d[1] = 45;

  res[0] = __builtin_ia32_vec_ext_v2df ((__v2df)val1.x, msk0);
  res[1] = __builtin_ia32_vec_ext_v2df ((__v2df)val1.x, msk1);

  masks[0] = msk0;
  masks[1] = msk1;

  for (i = 0; i < 2; i++)
    if (res[i] != val1.d [masks[i]])
      abort ();
}