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-ptest-1.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
 
17
static int
18
make_ptestz (__m128i m, __m128i v)
19
{
20
  union
21
    {
22
      __m128i x;
23
      unsigned char c[16];
24
    } val, mask;
25
  int i, z;
26
 
27
  mask.x = m;
28
  val.x = v;
29
 
30
  z = 1;
31
  for (i = 0; i < 16; i++)
32
    if ((mask.c[i] & val.c[i]))
33
      {
34
        z = 0;
35
        break;
36
      }
37
  return z;
38
}
39
 
40
static int
41
make_ptestc (__m128i m, __m128i v)
42
{
43
  union
44
    {
45
      __m128i x;
46
      unsigned char c[16];
47
    } val, mask;
48
  int i, c;
49
 
50
  mask.x = m;
51
  val.x = v;
52
 
53
  c = 1;
54
  for (i = 0; i < 16; i++)
55
    if ((val.c[i] & ~mask.c[i]))
56
      {
57
        c = 0;
58
        break;
59
      }
60
  return c;
61
}
62
 
63
static void
64
TEST (void)
65
{
66
  union
67
    {
68
      __m128i x;
69
      unsigned int i[4];
70
    } val[4];
71
  int i, j, l;
72
  int res[32];
73
 
74
  val[0].i[0] = 0x11111111;
75
  val[0].i[1] = 0x00000000;
76
  val[0].i[2] = 0x00000000;
77
  val[0].i[3] = 0x11111111;
78
 
79
  val[1].i[0] = 0x00000000;
80
  val[1].i[1] = 0x11111111;
81
  val[1].i[2] = 0x11111111;
82
  val[1].i[3] = 0x00000000;
83
 
84
  val[2].i[0] = 0;
85
  val[2].i[1] = 0;
86
  val[2].i[2] = 0;
87
  val[2].i[3] = 0;
88
 
89
  val[3].i[0] = 0xffffffff;
90
  val[3].i[1] = 0xffffffff;
91
  val[3].i[2] = 0xffffffff;
92
  val[3].i[3] = 0xffffffff;
93
 
94
  l = 0;
95
  for(i = 0; i < 4; i++)
96
    for(j = 0; j < 4; j++)
97
      {
98
        res[l++] = _mm_testz_si128 (val[j].x, val[i].x);
99
        res[l++] = _mm_testc_si128 (val[j].x, val[i].x);
100
      }
101
 
102
  l = 0;
103
  for(i = 0; i < 4; i++)
104
    for(j = 0; j < 4; j++)
105
      {
106
        if (res[l++] != make_ptestz (val[j].x, val[i].x))
107
          abort ();
108
        if (res[l++] != make_ptestc (val[j].x, val[i].x))
109
          abort ();
110
      }
111
 
112
  if (res[2] != _mm_testz_si128 (val[1].x, val[0].x))
113
    abort ();
114
 
115
  if (res[3] != _mm_testc_si128 (val[1].x, val[0].x))
116
    abort ();
117
}

powered by: WebSVN 2.1.0

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