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-pcmpistri-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.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_MOST_SIGNIFICANT)
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_MASKED_NEGATIVE_POLARITY | _SIDD_MOST_SIGNIFICANT)
29
 
30
 
31
static void
32
TEST (void)
33
{
34
  union
35
    {
36
      __m128i x[NUM];
37
      char c[NUM *16];
38
    } src1, src2;
39
  int res, correct;
40
  int i;
41
 
42
  for (i = 0; i < NUM *16; i++)
43
    {
44
      src1.c[i] = rand ();
45
      src2.c[i] = rand ();
46
    }
47
 
48
  for (i = 0; i < NUM; i++)
49
    {
50
      switch ((rand () % 4))
51
        {
52
        case 0:
53
          res = _mm_cmpistri (src1.x[i], src2.x[i], IMM_VAL0);
54
          correct = cmp_ii (&src1.x[i], &src2.x[i], IMM_VAL0, NULL);
55
          break;
56
 
57
        case 1:
58
          res = _mm_cmpistri (src1.x[i], src2.x[i], IMM_VAL1);
59
          correct = cmp_ii (&src1.x[i], &src2.x[i], IMM_VAL1, NULL);
60
          break;
61
 
62
        case 2:
63
          res = _mm_cmpistri (src1.x[i], src2.x[i], IMM_VAL2);
64
          correct = cmp_ii (&src1.x[i], &src2.x[i], IMM_VAL2, NULL);
65
          break;
66
 
67
        default:
68
          res = _mm_cmpistri (src1.x[i], src2.x[i], IMM_VAL3);
69
          correct = cmp_ii (&src1.x[i], &src2.x[i], IMM_VAL3, NULL);
70
          break;
71
        }
72
 
73
      if (correct != res)
74
        abort ();
75
    }
76
}

powered by: WebSVN 2.1.0

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