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-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
#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_ptestnzc (__m128i m, __m128i v)
19
{
20
  union
21
    {
22
      __m128i x;
23
      unsigned char c[16];
24
    } val, mask;
25
  int i, z, c;
26
 
27
  mask.x = m;
28
  val.x = v;
29
 
30
  z = c = 1;
31
  for (i = 0; i < 16; i++)
32
    {
33
      if ((mask.c[i] & val.c[i]))
34
        z = 0;
35
      if ((~mask.c[i] & val.c[i]))
36
        c = 0;
37
    }
38
 
39
  return (z == 0 && c == 0) ? 1 : 0;
40
}
41
 
42
static void
43
TEST (void)
44
{
45
  union
46
    {
47
      __m128i x;
48
      unsigned int i[4];
49
    } val[4];
50
  int i, j, l;
51
  int res[32];
52
 
53
  val[0].i[0] = 0x11111111;
54
  val[0].i[1] = 0x00000000;
55
  val[0].i[2] = 0x00000000;
56
  val[0].i[3] = 0x11111111;
57
 
58
  val[1].i[0] = 0x00000000;
59
  val[1].i[1] = 0x11111111;
60
  val[1].i[2] = 0x11111111;
61
  val[1].i[3] = 0x00000000;
62
 
63
  val[2].i[0] = 0;
64
  val[2].i[1] = 0;
65
  val[2].i[2] = 0;
66
  val[2].i[3] = 0;
67
 
68
  val[3].i[0] = 0xffffffff;
69
  val[3].i[1] = 0xffffffff;
70
  val[3].i[2] = 0xffffffff;
71
  val[3].i[3] = 0xffffffff;
72
 
73
  l = 0;
74
  for(i = 0; i < 4; i++)
75
    for(j = 0; j < 4; j++)
76
      {
77
        res[l++] = _mm_testnzc_si128 (val[j].x, val[i].x);
78
        res[l++] = _mm_testnzc_si128 (val[j].x, val[i].x);
79
      }
80
 
81
  l = 0;
82
  for(i = 0; i < 4; i++)
83
    for(j = 0; j < 4; j++)
84
      {
85
        if (res[l++] != make_ptestnzc (val[j].x, val[i].x))
86
          abort ();
87
        if (res[l++] != make_ptestnzc (val[j].x, val[i].x))
88
          abort ();
89
      }
90
 
91
  if (res[2] != _mm_testnzc_si128 (val[1].x, val[0].x))
92
    abort ();
93
 
94
  if (res[3] != _mm_testnzc_si128 (val[1].x, val[0].x))
95
    abort ();
96
}

powered by: WebSVN 2.1.0

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