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