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-pblendvb.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
static void
21
init_pblendvb (unsigned char *src1, unsigned char *src2,
22
               unsigned char *mask)
23
{
24
  int i, sign = 1;
25
 
26
  for (i = 0; i < NUM * 16; i++)
27
    {
28
      src1[i] = i* i * sign;
29
      src2[i] = (i + 20) * sign;
30
      mask[i] = (i % 3) + ((i * (14 + sign))
31
                           ^ (src1[i] | src2[i] | (i*3)));
32
      sign = -sign;
33
    }
34
}
35
 
36
static int
37
check_pblendvb (__m128i *dst, unsigned char *src1,
38
                unsigned char *src2, unsigned char *mask)
39
{
40
  unsigned char tmp[16];
41
  int j;
42
 
43
  memcpy (&tmp[0], src1, sizeof (tmp));
44
  for (j = 0; j < 16; j++)
45
    if (mask [j] & 0x80)
46
      tmp[j] = src2[j];
47
 
48
  return memcmp (dst, &tmp[0], sizeof (tmp));
49
}
50
 
51
static void
52
TEST (void)
53
{
54
  union
55
    {
56
      __m128i x[NUM];
57
      unsigned char c[NUM * 16];
58
    } dst, src1, src2, mask;
59
  int i;
60
 
61
  init_pblendvb (src1.c, src2.c, mask.c);
62
 
63
  for (i = 0; i < NUM; i++)
64
    {
65
      dst.x[i] = _mm_blendv_epi8 (src1.x[i], src2.x[i], mask.x[i]);
66
      if (check_pblendvb (&dst.x[i], &src1.c[i * 16], &src2.c[i * 16],
67
                          &mask.c[i * 16]))
68
        abort ();
69
    }
70
}

powered by: WebSVN 2.1.0

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