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-106-alias.c] - Blame information for rev 154

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