1 /* { dg-do run } */
2 /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves" } */
3
4 #include <stdlib.h>
5 #include <stdarg.h>
6
7 struct df_ref_info
8 {
9 unsigned int *begin;
10 unsigned int *count;
11 };
12
13 extern void *memset (void *s, int c, __SIZE_TYPE__ n);
14
15
16 __attribute__ ((noinline))
17 int
df_reorganize_refs_by_reg_by_insn(struct df_ref_info * ref_info,int num,unsigned int start)18 df_reorganize_refs_by_reg_by_insn (struct df_ref_info *ref_info,
19 int num, unsigned int start)
20 {
21 unsigned int m = num;
22 unsigned int offset = 77;
23 unsigned int r;
24
25 for (r = start; r < m; r++)
26 {
27 ref_info->begin[r] = offset;
28 offset += ref_info->count[r];
29 ref_info->count[r] = 0;
30 }
31
32 return offset;
33 }
34
35 int
main()36 main ()
37 {
38 struct df_ref_info temp;
39 int num = 100;
40 unsigned int start = 5;
41 int i, offset;
42
43 temp.begin = malloc (100 * sizeof (unsigned int));
44 temp.count = malloc (100 * sizeof (unsigned int));
45
46 memset (temp.begin, 0, sizeof (unsigned int) * num);
47 memset (temp.count, 0, sizeof (unsigned int) * num);
48
49 for (i = 0; i < num; i++)
50 temp.count[i] = i + 1;
51
52 offset = df_reorganize_refs_by_reg_by_insn (&temp, num, start);
53
54 if (offset != 5112)
55 abort ();
56
57 free (temp.begin);
58 free (temp.count);
59 return 0;
60 }
61