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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [slp-21.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-require-effective-target vect_int } */
2
 
3
#include <stdarg.h>
4
#include <stdio.h>
5
#include "tree-vect.h"
6
 
7
#define N 128 
8
 
9
int
10
main1 ()
11
{
12
  unsigned short i;
13
  unsigned short out[N*8], out2[N*8], b0, b1, b2, b3, b4, a0, a1, a2, a3, b5;
14
  unsigned short in[N*8];
15
 
16
  for (i = 0; i < N*8; i++)
17
    {
18
      in[i] = i;
19
    }
20
 
21
  /* Different operations in both cases - vectorization with interleaving.  */
22
  for (i = 0; i < N; i++)
23
    {
24
      a0 = in[i*4];
25
      a1 = in[i*4 + 1];
26
      a2 = in[i*4 + 2];
27
      a3 = in[i*4 + 3];
28
 
29
      b0 = a0 * 8;
30
      b1 = a1 + 7;
31
      b2 = a2 + 6;
32
      b3 = a3 * 5;
33
 
34
      b4 = a2 + 4;
35
      b5 = a3 + 3;
36
 
37
      out[i*4] = b0;
38
      out[i*4 + 1] = b1;
39
      out[i*4 + 2] = b2;
40
      out[i*4 + 3] = b3;
41
 
42
      out2[i*4] = b0;
43
      out2[i*4 + 1] = b1;
44
      out2[i*4 + 2] = b4;
45
      out2[i*4 + 3] = b5;
46
    }
47
 
48
  /* check results:  */
49
  for (i = 0; i < N; i++)
50
    {
51
      a0 = in[i*4];
52
      a1 = in[i*4 + 1];
53
      a2 = in[i*4 + 2];
54
      a3 = in[i*4 + 3];
55
 
56
      b0 = a0 * 8;
57
      b1 = a1 + 7;
58
      b2 = a2 + 6;
59
      b3 = a3 * 5;
60
 
61
      b4 = a2 + 4;
62
      b5 = a3 + 3;
63
 
64
      if (out[i*4] != b0
65
         || out[i*4 + 1] != b1
66
         || out[i*4 + 2] != b2
67
         || out[i*4 + 3] != b3)
68
        abort ();
69
 
70
      if (out2[i*4] != b0
71
         || out2[i*4 + 1] != b1
72
         || out2[i*4 + 2] != b4
73
         || out2[i*4 + 3] != b5)
74
        abort ();
75
    }
76
 
77
  /* Different operations in the first case - vectorization with interleaving.  */
78
  for (i = 0; i < N; i++)
79
    {
80
      a0 = in[i*4];
81
      a1 = in[i*4 + 1];
82
      a2 = in[i*4 + 2];
83
      a3 = in[i*4 + 3];
84
 
85
      b0 = a0 + 8;
86
      b1 = a1 + 7;
87
      b2 = a2 + 6;
88
      b3 = a3 * 5;
89
 
90
      b4 = a2 + 4;
91
      b5 = a3 + 3;
92
 
93
      out[i*4] = b0;
94
      out[i*4 + 1] = b1;
95
      out[i*4 + 2] = b2;
96
      out[i*4 + 3] = b3;
97
 
98
      out2[i*4] = b0;
99
      out2[i*4 + 1] = b1;
100
      out2[i*4 + 2] = b4;
101
      out2[i*4 + 3] = b5;
102
    }
103
 
104
  /* check results:  */
105
  for (i = 0; i < N; i++)
106
    {
107
      a0 = in[i*4];
108
      a1 = in[i*4 + 1];
109
      a2 = in[i*4 + 2];
110
      a3 = in[i*4 + 3];
111
 
112
      b0 = a0 + 8;
113
      b1 = a1 + 7;
114
      b2 = a2 + 6;
115
      b3 = a3 * 5;
116
 
117
      b4 = a2 + 4;
118
      b5 = a3 + 3;
119
 
120
      if (out[i*4] != b0
121
         || out[i*4 + 1] != b1
122
         || out[i*4 + 2] != b2
123
         || out[i*4 + 3] != b3)
124
        abort ();
125
 
126
      if (out2[i*4] != b0
127
         || out2[i*4 + 1] != b1
128
         || out2[i*4 + 2] != b4
129
         || out2[i*4 + 3] != b5)
130
        abort ();
131
    }
132
 
133
 
134
  /* Different operations in the second case - vectorization with interleaving.  */
135
  for (i = 0; i < N; i++)
136
    {
137
      a0 = in[i*4];
138
      a1 = in[i*4 + 1];
139
      a2 = in[i*4 + 2];
140
      a3 = in[i*4 + 3];
141
 
142
      b0 = a0 + 8;
143
      b1 = a1 + 7;
144
      b2 = a2 + 6;
145
      b3 = a3 + 5;
146
 
147
      b4 = a2 * 4;
148
      b5 = a3 + 3;
149
 
150
      out[i*4] = b0;
151
      out[i*4 + 1] = b1;
152
      out[i*4 + 2] = b2;
153
      out[i*4 + 3] = b3;
154
 
155
      out2[i*4] = b0;
156
      out2[i*4 + 1] = b1;
157
      out2[i*4 + 2] = b4;
158
      out2[i*4 + 3] = b5;
159
    }
160
 
161
  /* check results:  */
162
  for (i = 0; i < N; i++)
163
    {
164
      a0 = in[i*4];
165
      a1 = in[i*4 + 1];
166
      a2 = in[i*4 + 2];
167
      a3 = in[i*4 + 3];
168
 
169
      b0 = a0 + 8;
170
      b1 = a1 + 7;
171
      b2 = a2 + 6;
172
      b3 = a3 + 5;
173
 
174
      b4 = a2 * 4;
175
      b5 = a3 + 3;
176
 
177
      if (out[i*4] != b0
178
         || out[i*4 + 1] != b1
179
         || out[i*4 + 2] != b2
180
         || out[i*4 + 3] != b3)
181
        abort ();
182
 
183
      if (out2[i*4] != b0
184
         || out2[i*4 + 1] != b1
185
         || out2[i*4 + 2] != b4
186
         || out2[i*4 + 3] != b5)
187
        abort ();
188
    }
189
 
190
 
191
  return 0;
192
}
193
 
194
int main (void)
195
{
196
  check_vect ();
197
 
198
  main1 ();
199
 
200
  return 0;
201
}
202
 
203
/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect"  { target { vect_strided || vect_extract_even_odd } } } } */
204
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target  { ! { vect_strided || vect_extract_even_odd } } } } } */
205
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_strided }  } } */
206
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect"  { target { ! { vect_strided } } } } } */
207
/* { dg-final { cleanup-tree-dump "vect" } } */
208
 

powered by: WebSVN 2.1.0

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