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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-100.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_int } */
2
 
3
#include <stdlib.h>
4
#include <stdarg.h>
5
#include "tree-vect.h"
6
 
7
#define N 9
8
 
9
struct extraction
10
{
11
  int a[N];
12
  int b[N];
13
};
14
 
15
static int a[N] = {1,2,3,4,5,6,7,8,9};
16
static int b[N] = {2,3,4,5,6,7,8,9,0};
17
 
18
__attribute__ ((noinline))
19
int main1 () {
20
  int i;
21
  struct extraction *p;
22
 
23
  p = (struct extraction *) malloc (sizeof (struct extraction));
24
 
25
  /* Vectorizable: alias analysis determines that p can't point to a and/or b.  */
26
  for (i = 0; i < N; i++)
27
    {
28
      p->a[i] = a[i];
29
      p->b[i] = b[i];
30
    }
31
 
32
  /* check results: */
33
  for (i = 0; i < N; i++)
34
    {
35
       if (p->a[i] != a[i] || p->b[i] != b[i])
36
         abort();
37
    }
38
 
39
  return 0;
40
}
41
 
42
__attribute__ ((noinline))
43
int main2 () {
44
  int i;
45
  int c[N] = {1,2,3,4,5,6,7,8,9};
46
  int d[N] = {2,3,4,5,6,7,8,9,0};
47
  struct extraction *p;
48
  p = (struct extraction *) malloc (sizeof (struct extraction));
49
 
50
  /* Vectorizable: c and d are local arrays.  */
51
  for (i = 0; i < N; i++)
52
    {
53
      p->a[i] = c[i];
54
      p->b[i] = d[i];
55
    }
56
 
57
  /* check results: */
58
  for (i = 0; i < N; i++)
59
    {
60
       if (p->a[i] != c[i] || p->b[i] != d[i])
61
         abort();
62
    }
63
 
64
  return 0;
65
}
66
 
67
int main (void)
68
{
69
  check_vect ();
70
 
71
  main1 ();
72
  main2 ();
73
 
74
  return 0;
75
}
76
 
77
/* Requires versioning.  */
78
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 0 "vect" } } */
79
/* { dg-final { cleanup-tree-dump "vect" } } */
80
 

powered by: WebSVN 2.1.0

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