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-22.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 (unsigned short a0, unsigned short a1, unsigned short a2,
11
       unsigned short a3, unsigned short a4, unsigned short a5,
12
       unsigned short a6, unsigned short a7, unsigned short a8)
13
{
14
  int i;
15
  unsigned short out[N*8], out2[N*8], out3[N*8], b0, b1, b2, b3, b4, b5, b6, b7, b8;
16
 
17
  for (i = 0; i < N; i++)
18
    {
19
      b0 = a0 + 8;
20
      b1 = a1 + 7;
21
      b2 = a2 + 6;
22
      b3 = a3 + 5;
23
      b4 = a4 + 4;
24
      b5 = a5 + 3;
25
 
26
      out[i*4] = b0;
27
      out[i*4 + 1] = b1;
28
      out[i*4 + 2] = b2;
29
      out[i*4 + 3] = b3;
30
 
31
      out2[i*4] = b0;
32
      out2[i*4 + 1] = b1;
33
      out2[i*4 + 2] = b4;
34
      out2[i*4 + 3] = b5;
35
 
36
      out3[i*4] = b2;
37
      out3[i*4 + 1] = b1;
38
      out3[i*4 + 2] = b4;
39
      out3[i*4 + 3] = b5;
40
    }
41
 
42
  /* check results:  */
43
  for (i = 0; i < N; i++)
44
    {
45
      if (out[i*4] != b0
46
         || out[i*4 + 1] != b1
47
         || out[i*4 + 2] != b2
48
         || out[i*4 + 3] != b3)
49
        abort ();
50
 
51
 
52
      if (out2[i*4] != b0
53
         || out2[i*4 + 1] != b1
54
         || out2[i*4 + 2] != b4
55
         || out2[i*4 + 3] != b5)
56
        abort ();
57
 
58
      if (out3[i*4] != b2
59
         || out3[i*4 + 1] != b1
60
         || out3[i*4 + 2] != b4
61
         || out3[i*4 + 3] != b5)
62
        abort ();
63
    }
64
 
65
  for (i = 0; i < N; i++)
66
    {
67
      b0 = a0 + 8;
68
      b1 = a1 + 7;
69
      b2 = a2 + 6;
70
      b3 = a3 + 5;
71
      b4 = a4 + 4;
72
      b5 = a5 + 3;
73
      b6 = a6 + 2;
74
      b7 = a7 + 1;
75
      b8 = a8 + 9;
76
 
77
      out[i*4] = b0;
78
      out[i*4 + 1] = b1;
79
      out[i*4 + 2] = b2;
80
      out[i*4 + 3] = b3;
81
 
82
      out2[i*8] = b0;
83
      out2[i*8 + 1] = b1;
84
      out2[i*8 + 2] = b4;
85
      out2[i*8 + 3] = b5;
86
      out2[i*8 + 4] = b6;
87
      out2[i*8 + 5] = b2;
88
      out2[i*8 + 6] = b7;
89
      out2[i*8 + 7] = b8;
90
 
91
      out3[2*i + 1] = a0;
92
      out3[2*i] = b8;
93
    }
94
 
95
  /* check results:  */
96
  for (i = 0; i < N; i++)
97
    {
98
      if (out[i*4] != b0
99
         || out[i*4 + 1] != b1
100
         || out[i*4 + 2] != b2
101
         || out[i*4 + 3] != b3)
102
        abort ();
103
 
104
      if (out2[i*8] != b0
105
         || out2[i*8 + 1] != b1
106
         || out2[i*8 + 2] != b4
107
         || out2[i*8 + 3] != b5
108
         || out2[i*8 + 4] != b6
109
         || out2[i*8 + 5] != b2
110
         || out2[i*8 + 6] != b7
111
         || out2[i*8 + 7] != b8)
112
        abort ();
113
 
114
      if (out3[2*i] != b8
115
          || out3[2*i+1] != a0)
116
        abort();
117
    }
118
 
119
 
120
  return 0;
121
}
122
 
123
int main (void)
124
{
125
  check_vect ();
126
 
127
  main1 (8,7,6,5,4,3,2,1,0);
128
 
129
  return 0;
130
}
131
 
132
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect"  } } */
133
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 6 "vect"  } } */
134
/* { dg-final { cleanup-tree-dump "vect" } } */
135
 

powered by: WebSVN 2.1.0

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