From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson To: law@cygnus.com, Jerry Quinn Cc: egcs@egcs.cygnus.com Subject: Re: Fwd: Questions on PA machine description? Date: Thu, 25 Mar 1999 15:10:00 -0000 Message-id: <19990325151052.A28577@cygnus.com> References: <36F96A7D.F0DBDF47@americasm01.nt.com> <4324.922351870@upchuck> <19990325135639.A27147@cygnus.com> <19990325135639.A27147@cygnus.com> X-SW-Source: 1999-03/msg00830.html On Thu, Mar 25, 1999 at 01:56:39PM -0800, Richard Henderson wrote: > The following change seems to do the right thing for Alpha EV5 > wrt compare+cmove. The previous patch wouldn't bootstrap the compiler. I goofed on stepping through the ready list insns. r~ Index: haifa-sched.c =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/gcc/haifa-sched.c,v retrieving revision 1.85 diff -c -p -d -r1.85 haifa-sched.c *** haifa-sched.c 1999/03/13 17:38:17 1.85 --- haifa-sched.c 1999/03/25 23:08:02 *************** insn_cost (insn, link, used) *** 3146,3160 **** and LINK_COST_ZERO. */ if (LINK_COST_FREE (link)) ! cost = 1; #ifdef ADJUST_COST else if (!LINK_COST_ZERO (link)) { int ncost = cost; ADJUST_COST (used, link, insn, ncost); ! if (ncost <= 1) ! LINK_COST_FREE (link) = ncost = 1; if (cost == ncost) LINK_COST_ZERO (link) = 1; cost = ncost; --- 3146,3163 ---- and LINK_COST_ZERO. */ if (LINK_COST_FREE (link)) ! cost = 0; #ifdef ADJUST_COST else if (!LINK_COST_ZERO (link)) { int ncost = cost; ADJUST_COST (used, link, insn, ncost); ! if (ncost < 1) ! { ! LINK_COST_FREE (link) = 1; ! ncost = 0; ! } if (cost == ncost) LINK_COST_ZERO (link) = 1; cost = ncost; *************** schedule_insn (insn, ready, n_ready, clo *** 4444,4450 **** if (current_nr_blocks > 1 && INSN_BB (next) != target_bb) fprintf (dump, "/b%d ", INSN_BLOCK (next)); ! if (effective_cost <= 1) fprintf (dump, "into ready\n"); else fprintf (dump, "into queue with cost=%d\n", effective_cost); --- 4447,4453 ---- if (current_nr_blocks > 1 && INSN_BB (next) != target_bb) fprintf (dump, "/b%d ", INSN_BLOCK (next)); ! if (effective_cost < 1) fprintf (dump, "into ready\n"); else fprintf (dump, "into queue with cost=%d\n", effective_cost); *************** schedule_insn (insn, ready, n_ready, clo *** 4453,4459 **** /* Adjust the priority of NEXT and either put it on the ready list or queue it. */ adjust_priority (next); ! if (effective_cost <= 1) ready[n_ready++] = next; else queue_insn (next, effective_cost); --- 4456,4462 ---- /* Adjust the priority of NEXT and either put it on the ready list or queue it. */ adjust_priority (next); ! if (effective_cost < 1) ready[n_ready++] = next; else queue_insn (next, effective_cost); *************** schedule_block (bb, rgn_n_insns) *** 6921,6941 **** debug_ready_list (ready, n_ready); } ! /* Issue insns from ready list. ! It is important to count down from n_ready, because n_ready may change ! as insns are issued. */ can_issue_more = issue_rate; ! for (i = n_ready - 1; i >= 0 && can_issue_more; i--) { ! rtx insn = ready[i]; int cost = actual_hazard (insn_unit (insn), insn, clock_var, 0); ! if (cost > 1) ! { ! queue_insn (insn, cost); ! ready[i] = ready[--n_ready]; /* remove insn from ready list */ ! } ! else if (cost == 0) { /* an interblock motion? */ if (INSN_BB (insn) != target_bb) --- 6924,6940 ---- debug_ready_list (ready, n_ready); } ! /* Issue insns from ready list. */ can_issue_more = issue_rate; ! while (n_ready != 0 && can_issue_more) { ! /* Select and remove the insn from the ready list. */ ! rtx insn = ready[--n_ready]; int cost = actual_hazard (insn_unit (insn), insn, clock_var, 0); ! if (cost >= 1) ! queue_insn (insn, cost); ! else { /* an interblock motion? */ if (INSN_BB (insn) != target_bb) *************** schedule_block (bb, rgn_n_insns) *** 7010,7018 **** #endif n_ready = schedule_insn (insn, ready, n_ready, clock_var); - - /* remove insn from ready list */ - ready[i] = ready[--n_ready]; /* close this block after scheduling its jump */ if (GET_CODE (last_scheduled_insn) == JUMP_INSN) --- 7009,7014 ---- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson To: law@cygnus.com, Jerry Quinn Cc: egcs@egcs.cygnus.com Subject: Re: Fwd: Questions on PA machine description? Date: Wed, 31 Mar 1999 23:46:00 -0000 Message-ID: <19990325151052.A28577@cygnus.com> References: <36F96A7D.F0DBDF47@americasm01.nt.com> <4324.922351870@upchuck> <19990325135639.A27147@cygnus.com> X-SW-Source: 1999-03n/msg00835.html Message-ID: <19990331234600.r_xy8Wd7HK2Nrfkuz9HIWIGxdSuUh2cT3yzbKa9HkzE@z> On Thu, Mar 25, 1999 at 01:56:39PM -0800, Richard Henderson wrote: > The following change seems to do the right thing for Alpha EV5 > wrt compare+cmove. The previous patch wouldn't bootstrap the compiler. I goofed on stepping through the ready list insns. r~ Index: haifa-sched.c =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/gcc/haifa-sched.c,v retrieving revision 1.85 diff -c -p -d -r1.85 haifa-sched.c *** haifa-sched.c 1999/03/13 17:38:17 1.85 --- haifa-sched.c 1999/03/25 23:08:02 *************** insn_cost (insn, link, used) *** 3146,3160 **** and LINK_COST_ZERO. */ if (LINK_COST_FREE (link)) ! cost = 1; #ifdef ADJUST_COST else if (!LINK_COST_ZERO (link)) { int ncost = cost; ADJUST_COST (used, link, insn, ncost); ! if (ncost <= 1) ! LINK_COST_FREE (link) = ncost = 1; if (cost == ncost) LINK_COST_ZERO (link) = 1; cost = ncost; --- 3146,3163 ---- and LINK_COST_ZERO. */ if (LINK_COST_FREE (link)) ! cost = 0; #ifdef ADJUST_COST else if (!LINK_COST_ZERO (link)) { int ncost = cost; ADJUST_COST (used, link, insn, ncost); ! if (ncost < 1) ! { ! LINK_COST_FREE (link) = 1; ! ncost = 0; ! } if (cost == ncost) LINK_COST_ZERO (link) = 1; cost = ncost; *************** schedule_insn (insn, ready, n_ready, clo *** 4444,4450 **** if (current_nr_blocks > 1 && INSN_BB (next) != target_bb) fprintf (dump, "/b%d ", INSN_BLOCK (next)); ! if (effective_cost <= 1) fprintf (dump, "into ready\n"); else fprintf (dump, "into queue with cost=%d\n", effective_cost); --- 4447,4453 ---- if (current_nr_blocks > 1 && INSN_BB (next) != target_bb) fprintf (dump, "/b%d ", INSN_BLOCK (next)); ! if (effective_cost < 1) fprintf (dump, "into ready\n"); else fprintf (dump, "into queue with cost=%d\n", effective_cost); *************** schedule_insn (insn, ready, n_ready, clo *** 4453,4459 **** /* Adjust the priority of NEXT and either put it on the ready list or queue it. */ adjust_priority (next); ! if (effective_cost <= 1) ready[n_ready++] = next; else queue_insn (next, effective_cost); --- 4456,4462 ---- /* Adjust the priority of NEXT and either put it on the ready list or queue it. */ adjust_priority (next); ! if (effective_cost < 1) ready[n_ready++] = next; else queue_insn (next, effective_cost); *************** schedule_block (bb, rgn_n_insns) *** 6921,6941 **** debug_ready_list (ready, n_ready); } ! /* Issue insns from ready list. ! It is important to count down from n_ready, because n_ready may change ! as insns are issued. */ can_issue_more = issue_rate; ! for (i = n_ready - 1; i >= 0 && can_issue_more; i--) { ! rtx insn = ready[i]; int cost = actual_hazard (insn_unit (insn), insn, clock_var, 0); ! if (cost > 1) ! { ! queue_insn (insn, cost); ! ready[i] = ready[--n_ready]; /* remove insn from ready list */ ! } ! else if (cost == 0) { /* an interblock motion? */ if (INSN_BB (insn) != target_bb) --- 6924,6940 ---- debug_ready_list (ready, n_ready); } ! /* Issue insns from ready list. */ can_issue_more = issue_rate; ! while (n_ready != 0 && can_issue_more) { ! /* Select and remove the insn from the ready list. */ ! rtx insn = ready[--n_ready]; int cost = actual_hazard (insn_unit (insn), insn, clock_var, 0); ! if (cost >= 1) ! queue_insn (insn, cost); ! else { /* an interblock motion? */ if (INSN_BB (insn) != target_bb) *************** schedule_block (bb, rgn_n_insns) *** 7010,7018 **** #endif n_ready = schedule_insn (insn, ready, n_ready, clock_var); - - /* remove insn from ready list */ - ready[i] = ready[--n_ready]; /* close this block after scheduling its jump */ if (GET_CODE (last_scheduled_insn) == JUMP_INSN) --- 7009,7014 ----