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_2-pcmpestrm-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.2" } */
4
 
5
#ifndef CHECK_H
6
#define CHECK_H "sse4_2-check.h"
7
#endif
8
 
9
#ifndef TEST
10
#define TEST sse4_2_test
11
#endif
12
 
13
#include CHECK_H
14
 
15
#include "sse4_2-pcmpstr.h"
16
 
17
#define NUM 1024
18
 
19
#define IMM_VAL0 \
20
  (_SIDD_SBYTE_OPS | _SIDD_CMP_RANGES | _SIDD_MASKED_POSITIVE_POLARITY)
21
#define IMM_VAL1 \
22
  (_SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_EACH | _SIDD_NEGATIVE_POLARITY \
23
   | _SIDD_BIT_MASK)
24
#define IMM_VAL2 \
25
  (_SIDD_UWORD_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_NEGATIVE_POLARITY)
26
#define IMM_VAL3 \
27
  (_SIDD_SWORD_OPS | _SIDD_CMP_EQUAL_ORDERED \
28
   | _SIDD_MASKED_NEGATIVE_POLARITY | _SIDD_UNIT_MASK)
29
 
30
static void
31
TEST (void)
32
{
33
  union
34
    {
35
      __m128i x[NUM];
36
      char c[NUM *16];
37
    } src1, src2;
38
  __m128i res, correct;
39
  int correct_flags, l1, l2;
40
  int flags, cf, zf, sf, of, af;
41
  int i;
42
 
43
  for (i = 0; i < NUM *16; i++)
44
    {
45
      src1.c[i] = rand ();
46
      src2.c[i] = rand ();
47
    }
48
 
49
  for (i = 0; i < NUM; i++)
50
    {
51
      l1 = rand () % 18;
52
      l2 = rand () % 18;
53
 
54
      switch ((rand () % 4))
55
        {
56
        case 0:
57
          res = _mm_cmpestrm (src1.x[i], l1, src2.x[i], l2, IMM_VAL0);
58
          cf = _mm_cmpestrc (src1.x[i], l1, src2.x[i], l2, IMM_VAL0);
59
          zf = _mm_cmpestrz (src1.x[i], l1, src2.x[i], l2, IMM_VAL0);
60
          sf = _mm_cmpestrs (src1.x[i], l1, src2.x[i], l2, IMM_VAL0);
61
          of = _mm_cmpestro (src1.x[i], l1, src2.x[i], l2, IMM_VAL0);
62
          af = _mm_cmpestra (src1.x[i], l1, src2.x[i], l2, IMM_VAL0);
63
          correct = cmp_em (&src1.x[i], l1, &src2.x[i], l2, IMM_VAL0,
64
                            &correct_flags);
65
          break;
66
 
67
        case 1:
68
          res = _mm_cmpestrm (src1.x[i], l1, src2.x[i], l2, IMM_VAL1);
69
          cf = _mm_cmpestrc (src1.x[i], l1, src2.x[i], l2, IMM_VAL1);
70
          zf = _mm_cmpestrz (src1.x[i], l1, src2.x[i], l2, IMM_VAL1);
71
          sf = _mm_cmpestrs (src1.x[i], l1, src2.x[i], l2, IMM_VAL1);
72
          of = _mm_cmpestro (src1.x[i], l1, src2.x[i], l2, IMM_VAL1);
73
          af = _mm_cmpestra (src1.x[i], l1, src2.x[i], l2, IMM_VAL1);
74
          correct = cmp_em (&src1.x[i], l1, &src2.x[i], l2, IMM_VAL1,
75
                            &correct_flags);
76
          break;
77
 
78
        case 2:
79
          res = _mm_cmpestrm (src1.x[i], l1, src2.x[i], l2, IMM_VAL2);
80
          cf = _mm_cmpestrc (src1.x[i], l1, src2.x[i], l2, IMM_VAL2);
81
          zf = _mm_cmpestrz (src1.x[i], l1, src2.x[i], l2, IMM_VAL2);
82
          sf = _mm_cmpestrs (src1.x[i], l1, src2.x[i], l2, IMM_VAL2);
83
          of = _mm_cmpestro (src1.x[i], l1, src2.x[i], l2, IMM_VAL2);
84
          af = _mm_cmpestra (src1.x[i], l1, src2.x[i], l2, IMM_VAL2);
85
          correct = cmp_em (&src1.x[i], l1, &src2.x[i], l2, IMM_VAL2,
86
                            &correct_flags);
87
          break;
88
 
89
        default:
90
          res = _mm_cmpestrm (src1.x[i], l1, src2.x[i], l2, IMM_VAL3);
91
          cf = _mm_cmpestrc (src1.x[i], l1, src2.x[i], l2, IMM_VAL3);
92
          zf = _mm_cmpestrz (src1.x[i], l1, src2.x[i], l2, IMM_VAL3);
93
          sf = _mm_cmpestrs (src1.x[i], l1, src2.x[i], l2, IMM_VAL3);
94
          of = _mm_cmpestro (src1.x[i], l1, src2.x[i], l2, IMM_VAL3);
95
          af = _mm_cmpestra (src1.x[i], l1, src2.x[i], l2, IMM_VAL3);
96
          correct = cmp_em (&src1.x[i], l1, &src2.x[i], l2, IMM_VAL3,
97
                            &correct_flags);
98
          break;
99
        }
100
 
101
      if (memcmp (&correct, &res, sizeof (res)))
102
        abort ();
103
 
104
      flags = 0;
105
      if (cf)
106
        flags |= CFLAG;
107
      if (zf)
108
        flags |= ZFLAG;
109
      if (sf)
110
        flags |= SFLAG;
111
      if (of)
112
        flags |= OFLAG;
113
 
114
      if (flags != correct_flags
115
          || (af && (cf || zf))
116
          || (!af && !(cf || zf)))
117
        abort ();
118
    }
119
}

powered by: WebSVN 2.1.0

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