OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [no-vfa-vect-43.c] - Blame information for rev 384

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-require-effective-target vect_float } */
2
 
3
#include <stdarg.h>
4
#include "tree-vect.h"
5
 
6
#define N 256
7
 
8
__attribute__ ((noinline))
9
void bar (float *pa, float *pb, float *pc)
10
{
11
  int i;
12
 
13
  /* check results:  */
14
  for (i = 0; i < N; i++)
15
    {
16
      if (pa[i] != (pb[i] * pc[i]))
17
        abort ();
18
    }
19
 
20
  return;
21
}
22
 
23
 
24
__attribute__ ((noinline)) int
25
main1 (float *pa, float *pb, float *pc)
26
{
27
  int i;
28
  float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
29
  float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
30
 
31
  for (i = 0; i < N; i++)
32
    {
33
      b[i] = pb[i];
34
      c[i] = pc[i];
35
    }
36
 
37
  /* Vectorizable: pa may not alias pb and/or pc, even though their
38
     addresses escape.  &pa would need to escape to point to escaped memory.  */
39
  for (i = 0; i < N; i++)
40
    {
41
      pa[i] = b[i] * c[i];
42
    }
43
 
44
  bar (pa,b,c);
45
 
46
  return 0;
47
}
48
 
49
__attribute__ ((noinline)) int
50
main2 (float *pa, float *pb, float *pc)
51
{
52
  int i;
53
  float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
54
  float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
55
 
56
  for (i = 0; i < N; i++)
57
    {
58
      b[i] = pb[i];
59
      c[i] = pc[i];
60
    }
61
 
62
  /* Vectorizable: pb and pc addresses do not escape.  */
63
  for (i = 0; i < N; i++)
64
    {
65
      pa[i] = b[i] * c[i];
66
    }
67
 
68
  /* check results:  */
69
  for (i = 0; i < N; i++)
70
    {
71
      if (pa[i] != (b[i] * c[i]))
72
        abort ();
73
    }
74
 
75
  return 0;
76
}
77
 
78
int main (void)
79
{
80
  int i;
81
  float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
82
  float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
83
  float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
84
 
85
  check_vect ();
86
 
87
  main1 (a,b,c);
88
  main2 (a,b,c);
89
  return 0;
90
}
91
 
92
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" } } */
93
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 6 "vect" { target vect_no_align } } } */
94
/* { 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.