annotate gcc/testsuite/gcc.dg/sms-10.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do run } */
kono
parents:
diff changeset
2 /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 typedef __SIZE_TYPE__ size_t;
kono
parents:
diff changeset
6 extern void *malloc (size_t);
kono
parents:
diff changeset
7 extern void free (void *);
kono
parents:
diff changeset
8 extern void abort (void);
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 struct regstat_n_sets_and_refs_t
kono
parents:
diff changeset
11 {
kono
parents:
diff changeset
12 int sets;
kono
parents:
diff changeset
13 int refs;
kono
parents:
diff changeset
14 };
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 struct regstat_n_sets_and_refs_t *regstat_n_sets_and_refs;
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 struct df_reg_info
kono
parents:
diff changeset
19 {
kono
parents:
diff changeset
20 unsigned int n_refs;
kono
parents:
diff changeset
21 };
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 struct df_d
kono
parents:
diff changeset
24 {
kono
parents:
diff changeset
25 struct df_reg_info **def_regs;
kono
parents:
diff changeset
26 struct df_reg_info **use_regs;
kono
parents:
diff changeset
27 };
kono
parents:
diff changeset
28 struct df_d *df;
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 static inline int
kono
parents:
diff changeset
31 REG_N_SETS (int regno)
kono
parents:
diff changeset
32 {
kono
parents:
diff changeset
33 return regstat_n_sets_and_refs[regno].sets;
kono
parents:
diff changeset
34 }
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 __attribute__ ((noinline))
kono
parents:
diff changeset
37 int max_reg_num (void)
kono
parents:
diff changeset
38 {
kono
parents:
diff changeset
39 return 100;
kono
parents:
diff changeset
40 }
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 __attribute__ ((noinline))
kono
parents:
diff changeset
43 void regstat_init_n_sets_and_refs (void)
kono
parents:
diff changeset
44 {
kono
parents:
diff changeset
45 unsigned int i;
kono
parents:
diff changeset
46 unsigned int max_regno = max_reg_num ();
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 for (i = 0; i < max_regno; i++)
kono
parents:
diff changeset
49 {
kono
parents:
diff changeset
50 (regstat_n_sets_and_refs[i].sets = (df->def_regs[(i)]->n_refs));
kono
parents:
diff changeset
51 (regstat_n_sets_and_refs[i].refs =
kono
parents:
diff changeset
52 (df->use_regs[(i)]->n_refs) + REG_N_SETS (i));
kono
parents:
diff changeset
53 }
kono
parents:
diff changeset
54 }
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 int a_sets[100] =
kono
parents:
diff changeset
57 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
kono
parents:
diff changeset
58 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
kono
parents:
diff changeset
59 40, 41, 42,
kono
parents:
diff changeset
60 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
kono
parents:
diff changeset
61 62, 63, 64,
kono
parents:
diff changeset
62 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
kono
parents:
diff changeset
63 84, 85, 86,
kono
parents:
diff changeset
64 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
kono
parents:
diff changeset
65 };
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 int a_refs[100] =
kono
parents:
diff changeset
68 { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
kono
parents:
diff changeset
69 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76,
kono
parents:
diff changeset
70 78, 80, 82,
kono
parents:
diff changeset
71 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116,
kono
parents:
diff changeset
72 118, 120,
kono
parents:
diff changeset
73 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150,
kono
parents:
diff changeset
74 152, 154, 156,
kono
parents:
diff changeset
75 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186,
kono
parents:
diff changeset
76 188, 190, 192,
kono
parents:
diff changeset
77 194, 196, 198
kono
parents:
diff changeset
78 };
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 int
kono
parents:
diff changeset
81 main ()
kono
parents:
diff changeset
82 {
kono
parents:
diff changeset
83 struct df_reg_info *b[100], *c[100];
kono
parents:
diff changeset
84 struct df_d df1;
kono
parents:
diff changeset
85 size_t s = sizeof (struct df_reg_info);
kono
parents:
diff changeset
86 struct regstat_n_sets_and_refs_t a[100];
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 df = &df1;
kono
parents:
diff changeset
89 regstat_n_sets_and_refs = a;
kono
parents:
diff changeset
90 int i;
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 for (i = 0; i < 100; i++)
kono
parents:
diff changeset
93 {
kono
parents:
diff changeset
94 b[i] = (struct df_reg_info *) malloc (s);
kono
parents:
diff changeset
95 b[i]->n_refs = i;
kono
parents:
diff changeset
96 c[i] = (struct df_reg_info *) malloc (s);
kono
parents:
diff changeset
97 c[i]->n_refs = i;
kono
parents:
diff changeset
98 }
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 df1.def_regs = b;
kono
parents:
diff changeset
101 df1.use_regs = c;
kono
parents:
diff changeset
102 regstat_init_n_sets_and_refs ();
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 for (i = 0; i < 100; i++)
kono
parents:
diff changeset
105 if ((a[i].sets != a_sets[i]) || (a[i].refs != a_refs[i]))
kono
parents:
diff changeset
106 abort ();
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 for (i = 0; i < 100; i++)
kono
parents:
diff changeset
109 {
kono
parents:
diff changeset
110 free (b[i]);
kono
parents:
diff changeset
111 free (c[i]);
kono
parents:
diff changeset
112 }
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 return 0;
kono
parents:
diff changeset
115 }
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 /* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* } } } */
kono
parents:
diff changeset
118