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-blendps-2.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
#undef MASK
13
#define MASK 0xe
14
 
15
static void
16
init_blendps (float *src1, float *src2)
17
{
18
  int i, sign = 1;
19
 
20
  for (i = 0; i < NUM * 4; i++)
21
    {
22
      src1[i] = i * i * sign;
23
      src2[i] = (i + 20) * sign;
24
      sign = -sign;
25
    }
26
}
27
 
28
static int
29
check_blendps (__m128 *dst, float *src1, float *src2)
30
{
31
  float tmp[4];
32
  int j;
33
 
34
  memcpy (&tmp[0], src1, sizeof (tmp));
35
  for (j = 0; j < 4; j++)
36
    if ((MASK & (1 << j)))
37
      tmp[j] = src2[j];
38
 
39
  return memcmp (dst, &tmp[0], sizeof (tmp));
40
}
41
 
42
static void
43
sse4_1_test (void)
44
{
45
  __m128 x, y;
46
  union
47
    {
48
      __m128 x[NUM];
49
      float f[NUM * 4];
50
    } dst, src1, src2;
51
  union
52
    {
53
      __m128 x;
54
      float f[4];
55
    } src3;
56
  int i;
57
 
58
  init_blendps (src1.f, src2.f);
59
 
60
  /* Check blendps imm8, m128, xmm */
61
  for (i = 0; i < NUM; i++)
62
    {
63
      dst.x[i] = _mm_blend_ps (src1.x[i], src2.x[i], MASK);
64
      if (check_blendps (&dst.x[i], &src1.f[i * 4], &src2.f[i * 4]))
65
        abort ();
66
    }
67
 
68
   /* Check blendps imm8, xmm, xmm */
69
  x = _mm_blend_ps (dst.x[2], src3.x, MASK);
70
  y = _mm_blend_ps (src3.x, dst.x[2], MASK);
71
 
72
  if (check_blendps (&x, &dst.f[8], &src3.f[0]))
73
    abort ();
74
 
75
  if (check_blendps (&y, &src3.f[0], &dst.f[8]))
76
    abort ();
77
}

powered by: WebSVN 2.1.0

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