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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-cond-9.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-require-effective-target vect_cond_mixed } */
2
 
3
#include "tree-vect.h"
4
 
5
#define N 1024
6
float a[N], b[N], c[N], d[N];
7
int j[N];
8
unsigned char k[N];
9
 
10
__attribute__((noinline, noclone)) void
11
f1 (void)
12
{
13
  int i;
14
  for (i = 0; i < N; ++i)
15
    {
16
      unsigned int x = a[i] < b[i] ? -1 : 0;
17
      unsigned int y = c[i] < d[i] ? -1 : 0;
18
      j[i] = (x & y) >> 31;
19
    }
20
}
21
 
22
__attribute__((noinline, noclone)) void
23
f2 (void)
24
{
25
  int i;
26
  for (i = 0; i < N; ++i)
27
    {
28
      int x = a[i] < b[i];
29
      int y = c[i] < d[i];
30
      j[i] = x & y;
31
    }
32
}
33
 
34
__attribute__((noinline, noclone)) void
35
f3 (void)
36
{
37
  int i;
38
  for (i = 0; i < N; ++i)
39
    j[i] = (a[i] < b[i]) & (c[i] < d[i]);
40
}
41
 
42
__attribute__((noinline, noclone)) void
43
f4 (void)
44
{
45
  int i;
46
  for (i = 0; i < N; ++i)
47
    {
48
      int x = a[i] < b[i];
49
      int y = c[i] < d[i];
50
      k[i] = x & y;
51
    }
52
}
53
 
54
__attribute__((noinline, noclone)) void
55
f5 (void)
56
{
57
  int i;
58
  for (i = 0; i < N; ++i)
59
    k[i] = (a[i] < b[i]) & (c[i] < d[i]);
60
}
61
 
62
__attribute__((noinline, noclone)) void
63
f6 (void)
64
{
65
  int i;
66
  for (i = 0; i < N; ++i)
67
    {
68
      unsigned int x = a[i] < b[i] ? -1 : 0;
69
      unsigned int y = c[i] < d[i] ? -1 : 0;
70
      j[i] = (x | y) >> 31;
71
    }
72
}
73
 
74
__attribute__((noinline, noclone)) void
75
f7 (void)
76
{
77
  int i;
78
  for (i = 0; i < N; ++i)
79
    {
80
      int x = a[i] < b[i];
81
      int y = c[i] < d[i];
82
      j[i] = x | y;
83
    }
84
}
85
 
86
__attribute__((noinline, noclone)) void
87
f8 (void)
88
{
89
  int i;
90
  for (i = 0; i < N; ++i)
91
    j[i] = (a[i] < b[i]) | (c[i] < d[i]);
92
}
93
 
94
__attribute__((noinline, noclone)) void
95
f9 (void)
96
{
97
  int i;
98
  for (i = 0; i < N; ++i)
99
    {
100
      int x = a[i] < b[i];
101
      int y = c[i] < d[i];
102
      k[i] = x | y;
103
    }
104
}
105
 
106
__attribute__((noinline, noclone)) void
107
f10 (void)
108
{
109
  int i;
110
  for (i = 0; i < N; ++i)
111
    k[i] = (a[i] < b[i]) | (c[i] < d[i]);
112
}
113
 
114
int
115
main ()
116
{
117
  int i;
118
 
119
  check_vect ();
120
 
121
  for (i = 0; i < N; i++)
122
    {
123
      switch (i % 9)
124
        {
125
        case 0: asm (""); a[i] = - i - 1; b[i] = i + 1; break;
126
        case 1: a[i] = 0; b[i] = 0; break;
127
        case 2: a[i] = i + 1; b[i] = - i - 1; break;
128
        case 3: a[i] = i; b[i] = i + 7; break;
129
        case 4: a[i] = i; b[i] = i; break;
130
        case 5: a[i] = i + 16; b[i] = i + 3; break;
131
        case 6: a[i] = - i - 5; b[i] = - i; break;
132
        case 7: a[i] = - i; b[i] = - i; break;
133
        case 8: a[i] = - i; b[i] = - i - 7; break;
134
        }
135
    }
136
  for (i = 0; i < N; i++)
137
    {
138
      switch ((i / 9) % 3)
139
        {
140
        case 0: c[i] = a[i / 9]; d[i] = b[i / 9]; break;
141
        case 1: c[i] = a[i / 9 + 3]; d[i] = b[i / 9 + 3]; break;
142
        case 2: c[i] = a[i / 9 + 6]; d[i] = b[i / 9 + 6]; break;
143
        }
144
    }
145
  f1 ();
146
  for (i = 0; i < N; i++)
147
    if (j[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
148
      abort ();
149
  __builtin_memset (j, -6, sizeof (j));
150
  f2 ();
151
  for (i = 0; i < N; i++)
152
    if (j[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
153
      abort ();
154
  __builtin_memset (j, -6, sizeof (j));
155
  f3 ();
156
  for (i = 0; i < N; i++)
157
    if (j[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
158
      abort ();
159
  __builtin_memset (j, -6, sizeof (j));
160
  f4 ();
161
  for (i = 0; i < N; i++)
162
    if (k[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
163
      abort ();
164
  __builtin_memset (k, -6, sizeof (k));
165
  f5 ();
166
  for (i = 0; i < N; i++)
167
    if (k[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
168
      abort ();
169
  __builtin_memset (k, -6, sizeof (k));
170
  f6 ();
171
  for (i = 0; i < N; i++)
172
    if (j[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
173
      abort ();
174
  __builtin_memset (j, -6, sizeof (j));
175
  f7 ();
176
  for (i = 0; i < N; i++)
177
    if (j[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
178
      abort ();
179
  __builtin_memset (j, -6, sizeof (j));
180
  f8 ();
181
  for (i = 0; i < N; i++)
182
    if (j[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
183
      abort ();
184
  __builtin_memset (j, -6, sizeof (j));
185
  f9 ();
186
  for (i = 0; i < N; i++)
187
    if (k[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
188
      abort ();
189
  __builtin_memset (k, -6, sizeof (k));
190
  f10 ();
191
  for (i = 0; i < N; i++)
192
    if (k[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
193
      abort ();
194
  __builtin_memset (k, -6, sizeof (k));
195
 
196
  return 0;
197
}
198
 
199
/* { dg-final { scan-tree-dump-times "note: vectorized 1 loops" 10 "vect" } } */
200
/* { dg-final { cleanup-tree-dump "vect" } } */

powered by: WebSVN 2.1.0

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