2018-04-09 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / sms-9.c
blobc8dc28104aa37affc5250155ec12e742765ac732
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves" } */
4 #include <stdlib.h>
5 #include <stdarg.h>
7 struct df_ref_info
9 unsigned int *begin;
10 unsigned int *count;
13 extern void *memset (void *s, int c, __SIZE_TYPE__ n);
16 __attribute__ ((noinline))
17 int
18 df_reorganize_refs_by_reg_by_insn (struct df_ref_info *ref_info,
19 int num, unsigned int start)
21 unsigned int m = num;
22 unsigned int offset = 77;
23 unsigned int r;
25 for (r = start; r < m; r++)
27 ref_info->begin[r] = offset;
28 offset += ref_info->count[r];
29 ref_info->count[r] = 0;
32 return offset;
35 int
36 main ()
38 struct df_ref_info temp;
39 int num = 100;
40 unsigned int start = 5;
41 int i, offset;
43 temp.begin = malloc (100 * sizeof (unsigned int));
44 temp.count = malloc (100 * sizeof (unsigned int));
46 memset (temp.begin, 0, sizeof (unsigned int) * num);
47 memset (temp.count, 0, sizeof (unsigned int) * num);
49 for (i = 0; i < num; i++)
50 temp.count[i] = i + 1;
52 offset = df_reorganize_refs_by_reg_by_insn (&temp, num, start);
54 if (offset != 5112)
55 abort ();
57 free (temp.begin);
58 free (temp.count);
59 return 0;