PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr25413a.c
blobb9bef5f5b7796c9e03433169d0a290807561937c
1 /* { dg-require-effective-target vect_double } */
3 #include "tree-vect.h"
5 #define N 8
7 typedef __SIZE_TYPE__ size_t;
9 extern void *malloc (size_t __size) __attribute__ ((__nothrow__,
10 __malloc__));
12 typedef double num_t;
13 static const num_t num__infty = ((num_t)1.0)/((num_t)0.0);
15 struct oct_tt;
16 typedef struct oct_tt oct_t;
18 typedef unsigned int var_t;
19 typedef enum {
20 OCT_EMPTY = 0,
21 OCT_NORMAL = 1,
22 OCT_CLOSED = 2
23 } oct_state;
25 struct oct_tt {
26 var_t n;
28 int ref;
30 oct_state state;
31 struct oct_tt* closed;
33 num_t* c;
36 void* octfapg_mm_malloc (size_t t);
37 oct_t* octfapg_alloc (var_t n);
38 oct_t* octfapg_full_copy (oct_t* m);
40 struct mmalloc_tt;
41 typedef struct mmalloc_tt mmalloc_t;
43 struct mmalloc_tt
45 int id;
47 int nb_alloc;
48 int nb_realloc;
49 int nb_free;
51 size_t rem;
52 size_t max;
53 size_t tot;
57 typedef struct
59 size_t size;
61 mmalloc_t* mm;
62 int id;
64 double dummy;
66 } mmheader_t;
68 void*
69 octfapg_mm_malloc (size_t t)
71 char* m = (char*)malloc(t+sizeof(mmheader_t));
72 return m+sizeof(mmheader_t);
75 oct_t* octfapg_empty (var_t n);
77 oct_t*
78 octfapg_empty (const var_t n)
80 oct_t* m;
81 /*octfapg_timing_enter("oct_empty",3);*/
82 m = ((oct_t*) octfapg_mm_malloc (sizeof(oct_t)));
83 m->n = n;
84 m->ref = 1;
85 m->state = OCT_EMPTY;
86 m->closed = (oct_t*)((void *)0);
87 m->c = (num_t*)((void *)0);
88 /*octfapg_timing_exit("oct_empty",3);*/
89 return m;
92 oct_t*
93 octfapg_alloc (const var_t n)
95 size_t nn = (2*(size_t)(n)*((size_t)(n)+1));
96 oct_t* m;
97 m = octfapg_empty(n);
98 m->c = ((num_t*) octfapg_mm_malloc (sizeof(num_t)*(nn)));
100 m->state = OCT_NORMAL;
101 m->closed = (oct_t*)((void *)0);
102 return m;
105 oct_t*
106 octfapg_universe (const var_t n)
108 oct_t* m;
109 size_t i, nn = (2*(size_t)(n)*((size_t)(n)+1));
110 m = octfapg_alloc(n);
111 for (i=0;i<nn;i++) *(m->c+i) = num__infty;
112 for (i=0;i<2*n;i++) *(m->c+((size_t)(i)+(((size_t)(i)+1)*((size_t)(i)+1))/2)) = (num_t)(0);
113 m->state = OCT_CLOSED;
114 return m;
117 int main (void)
119 int i;
120 check_vect ();
122 oct_t *p = octfapg_universe(10);
123 return 0;
126 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
127 /* { dg-final { scan-tree-dump-times "vector alignment may not be reachable" 1 "vect" { target { ! vector_alignment_reachable } } } } */
128 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { ! vector_alignment_reachable } } } } */
129 /* { dg-final { cleanup-tree-dump "vect" } } */