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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse4_1-blendpd.c] - Blame information for rev 848

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run } */
2
/* { dg-require-effective-target sse4 } */
3
/* { dg-options "-O2 -msse4.1" } */
4
 
5
#ifndef CHECK_H
6
#define CHECK_H "sse4_1-check.h"
7
#endif
8
 
9
#ifndef TEST
10
#define TEST sse4_1_test
11
#endif
12
 
13
#include CHECK_H
14
 
15
#include <smmintrin.h>
16
#include <string.h>
17
 
18
#define NUM 20
19
 
20
#ifndef MASK
21
#define MASK 0x03
22
#endif
23
 
24
static void
25
init_blendpd (double *src1, double *src2)
26
{
27
  int i, sign = 1;
28
 
29
  for (i = 0; i < NUM * 2; i++)
30
    {
31
      src1[i] = i * i * sign;
32
      src2[i] = (i + 20) * sign;
33
      sign = -sign;
34
    }
35
}
36
 
37
static int
38
check_blendpd (__m128d *dst, double *src1, double *src2)
39
{
40
  double tmp[2];
41
  int j;
42
 
43
  memcpy (&tmp[0], src1, sizeof (tmp));
44
 
45
  for(j = 0; j < 2; j++)
46
    if ((MASK & (1 << j)))
47
      tmp[j] = src2[j];
48
 
49
  return memcmp (dst, &tmp[0], sizeof (tmp));
50
}
51
 
52
static void
53
TEST (void)
54
{
55
  __m128d x, y;
56
  union
57
    {
58
      __m128d x[NUM];
59
      double d[NUM * 2];
60
    } dst, src1, src2;
61
  union
62
    {
63
      __m128d x;
64
      double d[2];
65
    } src3;
66
  int i;
67
 
68
  init_blendpd (src1.d, src2.d);
69
 
70
  /* Check blendpd imm8, m128, xmm */
71
  for (i = 0; i < NUM; i++)
72
    {
73
      dst.x[i] = _mm_blend_pd (src1.x[i], src2.x[i], MASK);
74
      if (check_blendpd (&dst.x[i], &src1.d[i * 2], &src2.d[i * 2]))
75
        abort ();
76
    }
77
 
78
  /* Check blendpd imm8, xmm, xmm */
79
  src3.x = _mm_setzero_pd ();
80
 
81
  x = _mm_blend_pd (dst.x[2], src3.x, MASK);
82
  y = _mm_blend_pd (src3.x, dst.x[2], MASK);
83
 
84
  if (check_blendpd (&x, &dst.d[4], &src3.d[0]))
85
    abort ();
86
 
87
  if (check_blendpd (&y, &src3.d[0], &dst.d[4]))
88
    abort ();
89
}

powered by: WebSVN 2.1.0

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