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

Subversion Repositories openrisc

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

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

powered by: WebSVN 2.1.0

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