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-10.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
_Bool k[N];
8
 
9
__attribute__((noinline, noclone)) void
10
f1 (void)
11
{
12
  int i;
13
  for (i = 0; i < N; ++i)
14
    {
15
      int x = a[i] < b[i];
16
      int y = c[i] < d[i];
17
      k[i] = x & y;
18
    }
19
}
20
 
21
__attribute__((noinline, noclone)) void
22
f2 (void)
23
{
24
  int i;
25
  for (i = 0; i < N; ++i)
26
    k[i] = (a[i] < b[i]) & (c[i] < d[i]);
27
}
28
 
29
__attribute__((noinline, noclone)) void
30
f3 (void)
31
{
32
  int i;
33
  for (i = 0; i < N; ++i)
34
    {
35
      int x = a[i] < b[i];
36
      int y = c[i] < d[i];
37
      k[i] = x | y;
38
    }
39
}
40
 
41
__attribute__((noinline, noclone)) void
42
f4 (void)
43
{
44
  int i;
45
  for (i = 0; i < N; ++i)
46
    k[i] = (a[i] < b[i]) | (c[i] < d[i]);
47
}
48
 
49
__attribute__((noinline, noclone)) void
50
f5 (_Bool *p)
51
{
52
  int i;
53
  for (i = 0; i < N; ++i)
54
    {
55
      int x = a[i] < b[i];
56
      int y = c[i] < d[i];
57
      p[i] = x & y;
58
    }
59
}
60
 
61
__attribute__((noinline, noclone)) void
62
f6 (_Bool *p)
63
{
64
  int i;
65
  for (i = 0; i < N; ++i)
66
    p[i] = (a[i] < b[i]) & (c[i] < d[i]);
67
}
68
 
69
__attribute__((noinline, noclone)) void
70
f7 (_Bool *p)
71
{
72
  int i;
73
  for (i = 0; i < N; ++i)
74
    {
75
      int x = a[i] < b[i];
76
      int y = c[i] < d[i];
77
      p[i] = x | y;
78
    }
79
}
80
 
81
__attribute__((noinline, noclone)) void
82
f8 (_Bool *p)
83
{
84
  int i;
85
  for (i = 0; i < N; ++i)
86
    p[i] = (a[i] < b[i]) | (c[i] < d[i]);
87
}
88
 
89
int
90
main ()
91
{
92
  int i;
93
 
94
  check_vect ();
95
 
96
  for (i = 0; i < N; i++)
97
    {
98
      switch (i % 9)
99
        {
100
        case 0: asm (""); a[i] = - i - 1; b[i] = i + 1; break;
101
        case 1: a[i] = 0; b[i] = 0; break;
102
        case 2: a[i] = i + 1; b[i] = - i - 1; break;
103
        case 3: a[i] = i; b[i] = i + 7; break;
104
        case 4: a[i] = i; b[i] = i; break;
105
        case 5: a[i] = i + 16; b[i] = i + 3; break;
106
        case 6: a[i] = - i - 5; b[i] = - i; break;
107
        case 7: a[i] = - i; b[i] = - i; break;
108
        case 8: a[i] = - i; b[i] = - i - 7; break;
109
        }
110
    }
111
  for (i = 0; i < N; i++)
112
    {
113
      switch ((i / 9) % 3)
114
        {
115
        case 0: c[i] = a[i / 9]; d[i] = b[i / 9]; break;
116
        case 1: c[i] = a[i / 9 + 3]; d[i] = b[i / 9 + 3]; break;
117
        case 2: c[i] = a[i / 9 + 6]; d[i] = b[i / 9 + 6]; break;
118
        }
119
    }
120
  f1 ();
121
  for (i = 0; i < N; i++)
122
    if (k[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
123
      abort ();
124
  __builtin_memset (k, 0, sizeof (k));
125
  f2 ();
126
  for (i = 0; i < N; i++)
127
    if (k[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
128
      abort ();
129
  __builtin_memset (k, 0, sizeof (k));
130
  f3 ();
131
  for (i = 0; i < N; i++)
132
    if (k[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
133
      abort ();
134
  __builtin_memset (k, 0, sizeof (k));
135
  f4 ();
136
  for (i = 0; i < N; i++)
137
    if (k[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
138
      abort ();
139
  __builtin_memset (k, 0, sizeof (k));
140
  f5 (k);
141
  for (i = 0; i < N; i++)
142
    if (k[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
143
      abort ();
144
  __builtin_memset (k, 0, sizeof (k));
145
  f6 (k);
146
  for (i = 0; i < N; i++)
147
    if (k[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
148
      abort ();
149
  __builtin_memset (k, 0, sizeof (k));
150
  f7 (k);
151
  for (i = 0; i < N; i++)
152
    if (k[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
153
      abort ();
154
  __builtin_memset (k, 0, sizeof (k));
155
  f8 (k);
156
  for (i = 0; i < N; i++)
157
    if (k[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
158
      abort ();
159
  __builtin_memset (k, 0, sizeof (k));
160
 
161
  return 0;
162
}
163
 
164
/* { dg-final { scan-tree-dump-times "note: vectorized 1 loops" 8 "vect" } } */
165
/* { 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.