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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-100.c] - Blame information for rev 816

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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