OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse4_1-blendvpd.c] - Blame information for rev 318

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 318 jeremybenn
/* { dg-do run } */
2
/* { dg-require-effective-target sse4 } */
3
/* { dg-options "-O2 -msse4.1" } */
4
 
5
#include "sse4_1-check.h"
6
 
7
#include <smmintrin.h>
8
#include <string.h>
9
 
10
#define NUM 20
11
 
12
static void
13
init_blendvpd (double *src1, double *src2, double *mask)
14
{
15
  int i, msk, sign = 1;
16
 
17
  msk = -1;
18
  for (i = 0; i < NUM * 2; i++)
19
    {
20
      if((i % 2) == 0)
21
        msk++;
22
      src1[i] = i* (i + 1) * sign;
23
      src2[i] = (i + 20) * sign;
24
      mask[i] = (i + 120) * i;
25
      if( (msk & (1 << (i % 2))))
26
        mask[i] = -mask[i];
27
      sign = -sign;
28
    }
29
}
30
 
31
static int
32
check_blendvpd (__m128d *dst, double *src1, double *src2,
33
                double *mask)
34
{
35
  double tmp[2];
36
  int j;
37
 
38
  memcpy (&tmp[0], src1, sizeof (tmp));
39
  for (j = 0; j < 2; j++)
40
    if (mask [j] < 0.0)
41
      tmp[j] = src2[j];
42
 
43
  return memcmp (dst, &tmp[0], sizeof (tmp));
44
}
45
 
46
static void
47
sse4_1_test (void)
48
{
49
  union
50
    {
51
      __m128d x[NUM];
52
      double d[NUM * 2];
53
    } dst, src1, src2, mask;
54
  int i;
55
 
56
  init_blendvpd (src1.d, src2.d, mask.d);
57
 
58
  for (i = 0; i < NUM; i++)
59
    {
60
      dst.x[i] = _mm_blendv_pd (src1.x[i], src2.x[i], mask.x[i]);
61
      if (check_blendvpd (&dst.x[i], &src1.d[i * 2], &src2.d[i * 2],
62
                          &mask.d[i * 2]))
63
        abort ();
64
    }
65
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.