Debian Codegraph @

gcc/testsuite/gcc.dg/vect/pr118852.c

raw
1 /* { dg-add-options vect_early_break } */
2 /* { dg-require-profiling "-fprofile-generate" } */
3 /* { dg-additional-options "-fallow-store-data-races -fprofile-arcs" } */
4 /* { dg-additional-options "-msse4.2 -mprefer-vector-width=128" { target { x86_64-*-* i?86-*-* } } } */
5
6 #include "tree-vect.h"
7
8 typedef unsigned int hashval_t;
9 struct htab {
10 void ** entries;
11 unsigned long size;
12 };
13 typedef struct htab *htab_t;
14 unsigned long htab_size (htab_t h)
15 {
16 return h->size;
17 }
18 typedef struct
19 {
20 htab_t htab;
21 void * *slot;
22 void * *limit;
23 } htab_iterator;
24
25 static inline void *
26 first_htab_element (htab_iterator *hti, htab_t table)
27 {
28 hti->htab = table;
29 hti->slot = table->entries;
30 hti->limit = hti->slot + htab_size (table);
31 do
32 {
33 void * x = *(hti->slot);
34 if (x != ((void *) 0) && x != ((void *) 1))
35 break;
36 } while (++(hti->slot) < hti->limit);
37
38 if (hti->slot < hti->limit)
39 return *(hti->slot);
40 return (void *) 0;
41 }
42
43 static inline unsigned char
44 end_htab_p (const htab_iterator *hti)
45 {
46 if (hti->slot >= hti->limit)
47 return 1;
48 return 0;
49 }
50
51 static inline void *
52 next_htab_element (htab_iterator *hti)
53 {
54 while (++(hti->slot) < hti->limit)
55 {
56 void * x = *(hti->slot);
57 if (x != ((void *) 0) && x != ((void *) 1))
58 return x;
59 }
60 return (void *) 0;
61 }
62
63 typedef unsigned long vn_nary_op_t;
64
65 typedef struct vn_tables_s
66 {
67 htab_t nary;
68 } *vn_tables_t;
69
70 vn_tables_t valid_info;
71
72 void __attribute__((noipa))
73 announce (vn_nary_op_t p)
74 {
75 static vn_nary_op_t prev = 0;
76 if (prev == 0x70904f0 && p != 0x70904c0)
77 __builtin_abort ();
78 prev = p;
79 }
80
81 void __attribute__((noipa))
82 set_hashtable_value_ids_1 (void)
83 {
84 htab_iterator hi;
85 vn_nary_op_t vno;
86 for (vno = (vn_nary_op_t) first_htab_element (&(hi), (valid_info->nary)); !end_htab_p (&(hi)); vno = (vn_nary_op_t) next_htab_element (&(hi)))
87 announce (vno);
88 }
89
90 int main()
91 {
92 if (sizeof (void *) != sizeof (vn_nary_op_t))
93 return 0;
94 check_vect ();
95 valid_info = __builtin_malloc (sizeof (struct vn_tables_s));
96 valid_info->nary = __builtin_malloc (sizeof (struct htab));
97 valid_info->nary->entries = __builtin_malloc (sizeof (void *) * 32);
98 valid_info->nary->size = 31;
99 static vn_nary_op_t x[] = { 0x70905e0, 0x0, 0x0, 0x7090610, 0x7090550, 0x7090400, 0x70903a0, 0x0,
100 0x0, 0x70904f0, 0x0, 0x0, 0x0, 0x0, 0x70904c0, 0x7090520, 0x7090460,
101 0x7090490, 0x7090430, 0x0, 0x0, 0x0, 0x7090640, 0x0, 0x0, 0x70903d0, 0x0,
102 0x7090580, 0x0, 0x0, 0x70905b0};
103 __builtin_memcpy (valid_info->nary->entries, x, sizeof (void *) * 31);
104 set_hashtable_value_ids_1 ();
105 }