summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr42389.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/pr42389.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr42389.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr42389.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr42389.c b/gcc/testsuite/gcc.dg/pr42389.c
new file mode 100644
index 000000000..c398012f2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr42389.c
@@ -0,0 +1,87 @@
+/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fselective-scheduling -fsel-sched-pipelining -fsched-pressure" } */
+
+struct s_linked_f_pointer
+{
+ struct s_linked_f_pointer *next;
+ float *fptr;
+};
+struct s_trace
+{
+ int index;
+};
+struct s_rr_cost
+{
+ float base_cost;
+ float acc_cost;
+};
+extern int num_nets;
+extern struct s_trace **trace_head;
+extern struct s_rr_cost *rr_cost;
+struct s_rr_route
+{
+ float cost;
+};
+static int heap_tail;
+extern struct s_linked_f_pointer *rr_modified_head;
+extern struct s_rr_route *rr_route;
+
+void
+empty_heap (void)
+{
+ heap_tail = 1;
+}
+
+void
+reset_path_costs (void)
+{
+ struct s_linked_f_pointer *mod_ptr;
+ if (rr_modified_head != ((void *) 0))
+ {
+ mod_ptr = rr_modified_head;
+ while (mod_ptr->next != ((void *) 0))
+ {
+ *(mod_ptr->fptr) = 1.e30;
+ mod_ptr = mod_ptr->next;
+ }
+ rr_modified_head = ((void *) 0);
+ }
+}
+
+static void
+route_net (int inet)
+{
+ int i;
+ for (i = 1; i < inet; i++)
+ reset_path_costs ();
+ empty_heap ();
+ reset_path_costs ();
+}
+
+void
+pathfinder_update_one_cost (int inet, float pres_fac, float acc_fac)
+{
+ struct s_trace *tptr;
+ int inode = 0;
+
+ tptr = trace_head[inet];
+ inode = tptr->index;
+ rr_route[inode].cost = rr_cost[inode].base_cost + rr_cost[inode].acc_cost;
+}
+
+int
+try_route (int n, float x, float y)
+{
+ int inet, itry;
+ float pres_fac;
+ for (itry = 1; itry <= n; itry++)
+ {
+ for (inet = 0; inet < num_nets; inet++)
+ {
+ route_net (inet);
+ pathfinder_update_one_cost (inet, pres_fac, x);
+ }
+ pres_fac *= y;
+ }
+}
+