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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vshift-3.c] - Blame information for rev 774

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

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

powered by: WebSVN 2.1.0

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