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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-106.c] - Blame information for rev 801

Go to most recent revision | 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
static int a[N] = {1,2,3,4,5,6,7,8,9};
10
static int b[N] = {2,3,4,5,6,7,8,9,0};
11
 
12
__attribute__ ((noinline))
13
int main1 () {
14
  int i;
15
  int *p, *q, *p1, *q1;
16
  p = (unsigned int *) malloc (sizeof (unsigned int) * N);
17
  q = (unsigned int *) malloc (sizeof (unsigned int) * N);
18
 
19
  p1 = p; q1 = q;
20
 
21
  /* Vectorizable, before pointer plus we would get a redundant cast
22
     (caused by pointer arithmetics), alias analysis fails to distinguish
23
     between the pointers.  */
24
  for (i = 0; i < N; i++)
25
    {
26
      *(q + i) = a[i];
27
      *(p + i) = b[i];
28
    }
29
 
30
  /* check results: */
31
  for (i = 0; i < N; i++)
32
    {
33
       if (*q != a[i] || *p != b[i])
34
         abort();
35
       q++;
36
       p++;
37
    }
38
 
39
  q = q1;
40
  p = p1;
41
  /* Vectorizable.  */
42
  for (i = 0; i < N; i++)
43
    {
44
      *q = b[i];
45
      *p = a[i];
46
      q++;
47
      p++;
48
    }
49
 
50
  q = q1;
51
  p = p1;
52
  /* check results: */
53
  for (i = 0; i < N; i++)
54
    {
55
       if (*q != b[i] || *p != a[i])
56
         abort();
57
       q++;
58
       p++;
59
    }
60
 
61
  return 0;
62
}
63
 
64
int main (void)
65
{
66
  check_vect ();
67
 
68
  return main1 ();
69
}
70
 
71
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
72
/* { dg-final { cleanup-tree-dump "vect" } } */
73
 

powered by: WebSVN 2.1.0

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