OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [xop-vshift-1.c] - Blame information for rev 704

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O3 -mxop" } */
3
/* { dg-require-effective-target xop } */
4
 
5
#ifndef CHECK_H
6
#define CHECK_H "xop-check.h"
7
#endif
8
 
9
#ifndef TEST
10
#define TEST xop_test
11
#endif
12
 
13
#include CHECK_H
14
 
15
#define N 64
16
 
17
#ifndef TYPE1
18
#define TYPE1 int
19
#define TYPE2 long long
20
#endif
21
 
22
/* mingw runtime don't provide random().  */
23
#ifdef __MINGW32__
24
#define random rand
25
#endif
26
 
27
signed TYPE1 a[N], b[N], g[N];
28
unsigned TYPE1 c[N], h[N];
29
signed TYPE2 d[N], e[N], j[N];
30
unsigned TYPE2 f[N], k[N];
31
 
32
__attribute__((noinline)) void
33
f1 (void)
34
{
35
  int i;
36
  for (i = 0; i < N; i++)
37
    g[i] = a[i] << b[i];
38
}
39
 
40
__attribute__((noinline)) void
41
f2 (void)
42
{
43
  int i;
44
  for (i = 0; i < N; i++)
45
    g[i] = a[i] >> b[i];
46
}
47
 
48
__attribute__((noinline)) void
49
f3 (void)
50
{
51
  int i;
52
  for (i = 0; i < N; i++)
53
    h[i] = c[i] >> b[i];
54
}
55
 
56
__attribute__((noinline)) void
57
f4 (void)
58
{
59
  int i;
60
  for (i = 0; i < N; i++)
61
    j[i] = d[i] << e[i];
62
}
63
 
64
__attribute__((noinline)) void
65
f5 (void)
66
{
67
  int i;
68
  for (i = 0; i < N; i++)
69
    j[i] = d[i] >> e[i];
70
}
71
 
72
__attribute__((noinline)) void
73
f6 (void)
74
{
75
  int i;
76
  for (i = 0; i < N; i++)
77
    k[i] = f[i] >> e[i];
78
}
79
 
80
__attribute__((noinline)) void
81
f7 (void)
82
{
83
  int i;
84
  for (i = 0; i < N; i++)
85
    j[i] = d[i] << b[i];
86
}
87
 
88
__attribute__((noinline)) void
89
f8 (void)
90
{
91
  int i;
92
  for (i = 0; i < N; i++)
93
    j[i] = d[i] >> b[i];
94
}
95
 
96
__attribute__((noinline)) void
97
f9 (void)
98
{
99
  int i;
100
  for (i = 0; i < N; i++)
101
    k[i] = f[i] >> b[i];
102
}
103
 
104
static void
105
TEST ()
106
{
107
  int i;
108
  for (i = 0; i < N; i++)
109
    {
110
      asm ("");
111
      c[i] = (random () << 1) | (random () & 1);
112
      b[i] = (i * 85) & (sizeof (TYPE1) * __CHAR_BIT__ - 1);
113
      a[i] = c[i];
114
      d[i] = (random () << 1) | (random () & 1);
115
      d[i] |= (unsigned long long) c[i] << 32;
116
      e[i] = (i * 85) & (sizeof (TYPE2) * __CHAR_BIT__ - 1);
117
      f[i] = d[i];
118
    }
119
  f1 ();
120
  f3 ();
121
  f4 ();
122
  f6 ();
123
  for (i = 0; i < N; i++)
124
    if (g[i] != (signed TYPE1) (a[i] << b[i])
125
        || h[i] != (unsigned TYPE1) (c[i] >> b[i])
126
        || j[i] != (signed TYPE2) (d[i] << e[i])
127
        || k[i] != (unsigned TYPE2) (f[i] >> e[i]))
128
      abort ();
129
  f2 ();
130
  f5 ();
131
  f9 ();
132
  for (i = 0; i < N; i++)
133
    if (g[i] != (signed TYPE1) (a[i] >> b[i])
134
        || j[i] != (signed TYPE2) (d[i] >> e[i])
135
        || k[i] != (unsigned TYPE2) (f[i] >> b[i]))
136
      abort ();
137
  f7 ();
138
  for (i = 0; i < N; i++)
139
    if (j[i] != (signed TYPE2) (d[i] << b[i]))
140
      abort ();
141
  f8 ();
142
  for (i = 0; i < N; i++)
143
    if (j[i] != (signed TYPE2) (d[i] >> b[i]))
144
      abort ();
145
}

powered by: WebSVN 2.1.0

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