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.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
#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 0x0f
22
#endif
23
 
24
static void
25
init_blendps (float *src1, float *src2)
26
{
27
  int i, sign = 1;
28
 
29
  for (i = 0; i < NUM * 4; 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_blendps (__m128 *dst, float *src1, float *src2)
39
{
40
  float tmp[4];
41
  int j;
42
 
43
  memcpy (&tmp[0], src1, sizeof (tmp));
44
  for (j = 0; j < 4; j++)
45
    if ((MASK & (1 << j)))
46
      tmp[j] = src2[j];
47
 
48
  return memcmp (dst, &tmp[0], sizeof (tmp));
49
}
50
 
51
static void
52
TEST (void)
53
{
54
  __m128 x, y;
55
  union
56
    {
57
      __m128 x[NUM];
58
      float f[NUM * 4];
59
    } dst, src1, src2;
60
  union
61
    {
62
      __m128 x;
63
      float f[4];
64
    } src3;
65
  int i;
66
 
67
  init_blendps (src1.f, src2.f);
68
 
69
  /* Check blendps imm8, m128, xmm */
70
  for (i = 0; i < NUM; i++)
71
    {
72
      dst.x[i] = _mm_blend_ps (src1.x[i], src2.x[i], MASK);
73
      if (check_blendps (&dst.x[i], &src1.f[i * 4], &src2.f[i * 4]))
74
        abort ();
75
    }
76
 
77
   /* Check blendps imm8, xmm, xmm */
78
  x = _mm_blend_ps (dst.x[2], src3.x, MASK);
79
  y = _mm_blend_ps (src3.x, dst.x[2], MASK);
80
 
81
  if (check_blendps (&x, &dst.f[8], &src3.f[0]))
82
    abort ();
83
 
84
  if (check_blendps (&y, &src3.f[0], &dst.f[8]))
85
    abort ();
86
}

powered by: WebSVN 2.1.0

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