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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [slp-20.c] - Blame information for rev 338

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], 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
 
37
  /* check results:  */
38
  for (i = 0; i < N; i++)
39
    {
40
      if (out[i*4] != b0
41
         || out[i*4 + 1] != b1
42
         || out[i*4 + 2] != b2
43
         || out[i*4 + 3] != b3)
44
        abort ();
45
 
46
      if (out2[i*4] != b0
47
         || out2[i*4 + 1] != b1
48
         || out2[i*4 + 2] != b4
49
         || out2[i*4 + 3] != b5)
50
        abort ();
51
    }
52
 
53
  for (i = 0; i < N; i++)
54
    {
55
      b0 = a0 + 8;
56
      b1 = a1 + 7;
57
      b2 = a2 + 6;
58
      b3 = a3 + 5;
59
      b4 = a4 + 4;
60
      b5 = a5 + 3;
61
      b6 = a6 + 2;
62
      b7 = a7 + 1;
63
      b8 = a8 + 9;
64
 
65
      out[i*4] = b0;
66
      out[i*4 + 1] = b1;
67
      out[i*4 + 2] = b2;
68
      out[i*4 + 3] = b3;
69
 
70
      out2[i*8] = b0;
71
      out2[i*8 + 1] = b1;
72
      out2[i*8 + 2] = b4;
73
      out2[i*8 + 3] = b5;
74
      out2[i*8 + 4] = b6;
75
      out2[i*8 + 5] = b2;
76
      out2[i*8 + 6] = b7;
77
      out2[i*8 + 7] = b8;
78
    }
79
 
80
  /* check results:  */
81
  for (i = 0; i < N; i++)
82
    {
83
      if (out[i*4] != b0
84
         || out[i*4 + 1] != b1
85
         || out[i*4 + 2] != b2
86
         || out[i*4 + 3] != b3)
87
        abort ();
88
 
89
      if (out2[i*8] != b0
90
         || out2[i*8 + 1] != b1
91
         || out2[i*8 + 2] != b4
92
         || out2[i*8 + 3] != b5
93
         || out2[i*8 + 4] != b6
94
         || out2[i*8 + 5] != b2
95
         || out2[i*8 + 6] != b7
96
         || out2[i*8 + 7] != b8)
97
        abort ();
98
    }
99
 
100
 
101
  return 0;
102
}
103
 
104
int main (void)
105
{
106
  check_vect ();
107
 
108
  main1 (8,7,6,5,4,3,2,1,0);
109
 
110
  return 0;
111
}
112
 
113
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect"  } } */
114
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect"  } } */
115
/* { dg-final { cleanup-tree-dump "vect" } } */
116
 

powered by: WebSVN 2.1.0

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