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-pcmpistrm-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_MASKED_NEGATIVE_POLARITY)
26
#define IMM_VAL3 \
27
  (_SIDD_SWORD_OPS | _SIDD_CMP_EQUAL_ORDERED \
28
   | _SIDD_POSITIVE_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;
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
      switch ((rand () % 4))
52
        {
53
        case 0:
54
          res = _mm_cmpistrm (src1.x[i], src2.x[i], IMM_VAL0);
55
          cf = _mm_cmpistrc (src1.x[i], src2.x[i], IMM_VAL0);
56
          zf = _mm_cmpistrz (src1.x[i], src2.x[i], IMM_VAL0);
57
          sf = _mm_cmpistrs (src1.x[i], src2.x[i], IMM_VAL0);
58
          of = _mm_cmpistro (src1.x[i], src2.x[i], IMM_VAL0);
59
          af = _mm_cmpistra (src1.x[i], src2.x[i], IMM_VAL0);
60
          correct = cmp_im (&src1.x[i], &src2.x[i], IMM_VAL0,
61
                            &correct_flags);
62
          break;
63
 
64
        case 1:
65
          res = _mm_cmpistrm (src1.x[i], src2.x[i], IMM_VAL1);
66
          cf = _mm_cmpistrc (src1.x[i], src2.x[i], IMM_VAL1);
67
          zf = _mm_cmpistrz (src1.x[i], src2.x[i], IMM_VAL1);
68
          sf = _mm_cmpistrs (src1.x[i], src2.x[i], IMM_VAL1);
69
          of = _mm_cmpistro (src1.x[i], src2.x[i], IMM_VAL1);
70
          af = _mm_cmpistra (src1.x[i], src2.x[i], IMM_VAL1);
71
          correct = cmp_im (&src1.x[i], &src2.x[i], IMM_VAL1,
72
                            &correct_flags);
73
          break;
74
 
75
        case 2:
76
          res = _mm_cmpistrm (src1.x[i], src2.x[i], IMM_VAL2);
77
          cf = _mm_cmpistrc (src1.x[i], src2.x[i], IMM_VAL2);
78
          zf = _mm_cmpistrz (src1.x[i], src2.x[i], IMM_VAL2);
79
          sf = _mm_cmpistrs (src1.x[i], src2.x[i], IMM_VAL2);
80
          of = _mm_cmpistro (src1.x[i], src2.x[i], IMM_VAL2);
81
          af = _mm_cmpistra (src1.x[i], src2.x[i], IMM_VAL2);
82
          correct = cmp_im (&src1.x[i], &src2.x[i], IMM_VAL2,
83
                            &correct_flags);
84
          break;
85
 
86
        default:
87
          res = _mm_cmpistrm (src1.x[i], src2.x[i], IMM_VAL3);
88
          cf = _mm_cmpistrc (src1.x[i], src2.x[i], IMM_VAL3);
89
          zf = _mm_cmpistrz (src1.x[i], src2.x[i], IMM_VAL3);
90
          sf = _mm_cmpistrs (src1.x[i], src2.x[i], IMM_VAL3);
91
          of = _mm_cmpistro (src1.x[i], src2.x[i], IMM_VAL3);
92
          af = _mm_cmpistra (src1.x[i], src2.x[i], IMM_VAL3);
93
          correct = cmp_im (&src1.x[i], &src2.x[i], IMM_VAL3,
94
                            &correct_flags);
95
          break;
96
        }
97
 
98
      if (memcmp (&correct, &res, sizeof (res)))
99
        abort ();
100
 
101
      flags = 0;
102
      if (cf)
103
        flags |= CFLAG;
104
      if (zf)
105
        flags |= ZFLAG;
106
      if (sf)
107
        flags |= SFLAG;
108
      if (of)
109
        flags |= OFLAG;
110
 
111
      if (flags != correct_flags
112
          || (af && (cf || zf))
113
          || (!af && !(cf || zf)))
114
        abort ();
115
    }
116
}

powered by: WebSVN 2.1.0

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