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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-require-effective-target vect_condition } */
2
#include "tree-vect.h"
3
 
4
#define N 32
5
int a[N], b[N];
6
int d[N], e[N];
7
int k[N];
8
 
9
__attribute__((noinline, noclone)) void
10
f1 (void)
11
{
12
  int i;
13
  for (i = 0; i < N/4; i++)
14
    {
15
      k[4*i] = a[4*i] < b[4*i] ? 17 : 0;
16
      k[4*i+1] = a[4*i+1] < b[4*i+1] ? 17 : 0;
17
      k[4*i+2] = a[4*i+2] < b[4*i+2] ? 17 : 0;
18
      k[4*i+3] = a[4*i+3] < b[4*i+3] ? 17 : 0;
19
    }
20
}
21
 
22
__attribute__((noinline, noclone)) void
23
f2 (void)
24
{
25
  int i;
26
  for (i = 0; i < N/2; ++i)
27
    {
28
      k[2*i] = a[2*i] < b[2*i] ? 0 : 24;
29
      k[2*i+1] = a[2*i+1] < b[2*i+1] ? 7 : 4;
30
    }
31
}
32
 
33
__attribute__((noinline, noclone)) void
34
f3 (void)
35
{
36
  int i;
37
  for (i = 0; i < N/2; ++i)
38
    {
39
      k[2*i] = a[2*i] < b[2*i] ? 51 : 12;
40
      k[2*i+1] = a[2*i+1] > b[2*i+1] ? 51 : 12;
41
    }
42
}
43
 
44
__attribute__((noinline, noclone)) void
45
f4 (void)
46
{
47
  int i;
48
  for (i = 0; i < N/2; ++i)
49
    {
50
      int d0 = d[2*i], e0 = e[2*i];
51
      int d1 = d[2*i+1], e1 = e[2*i+1];
52
      k[2*i] = a[2*i] >= b[2*i] ? d0 : e0;
53
      k[2*i+1] = a[2*i+1] >= b[2*i+1] ? d1 : e1;
54
    }
55
}
56
 
57
int
58
main ()
59
{
60
  int i;
61
 
62
  check_vect ();
63
 
64
  for (i = 0; i < N; i++)
65
    {
66
      switch (i % 9)
67
        {
68
        case 0: asm (""); a[i] = - i - 1; b[i] = i + 1; break;
69
        case 1: a[i] = 0; b[i] = 0; break;
70
        case 2: a[i] = i + 1; b[i] = - i - 1; break;
71
        case 3: a[i] = i; b[i] = i + 7; break;
72
        case 4: a[i] = i; b[i] = i; break;
73
        case 5: a[i] = i + 16; b[i] = i + 3; break;
74
        case 6: a[i] = - i - 5; b[i] = - i; break;
75
        case 7: a[i] = - i; b[i] = - i; break;
76
        case 8: a[i] = - i; b[i] = - i - 7; break;
77
        }
78
      d[i] = i;
79
      e[i] = 2 * i;
80
    }
81
  f1 ();
82
  for (i = 0; i < N; i++)
83
    if (k[i] != ((i % 3) == 0 ? 17 : 0))
84
      abort ();
85
 
86
  f2 ();
87
  for (i = 0; i < N; i++)
88
    {
89
      switch (i % 9)
90
        {
91
        case 0:
92
        case 6:
93
          if (k[i] != ((i/9 % 2) == 0 ? 0 : 7))
94
            abort ();
95
          break;
96
        case 1:
97
        case 5:
98
        case 7:
99
          if (k[i] != ((i/9 % 2) == 0 ? 4 : 24))
100
            abort ();
101
          break;
102
        case 2:
103
        case 4:
104
        case 8:
105
          if (k[i] != ((i/9 % 2) == 0 ? 24 : 4))
106
            abort ();
107
          break;
108
        case 3:
109
          if (k[i] != ((i/9 % 2) == 0 ? 7 : 0))
110
            abort ();
111
          break;
112
        }
113
    }
114
 
115
  f3 ();
116
 
117
  f4 ();
118
  for (i = 0; i < N; i++)
119
    if (k[i] != ((i % 3) == 0 ? e[i] : d[i]))
120
      abort ();
121
 
122
  return 0;
123
}
124
 
125
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" } } */
126
/* { 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.