1 /* frv simulator fr550 dependent profiling code.
3 Copyright (C) 2003-2013 Free Software Foundation, Inc.
6 This file is part of the GNU simulators.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #define WANT_CPU_FRVBF
28 #if WITH_PROFILE_MODEL_P
31 #include "profile-fr550.h"
33 /* Initialize cycle counting for an insn.
34 FIRST_P is non-zero if this is the first insn in a set of parallel
37 fr550_model_insn_before (SIM_CPU *cpu, int first_p)
41 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
42 d->cur_fr_load = d->prev_fr_load;
43 d->cur_fr_complex_1 = d->prev_fr_complex_1;
44 d->cur_fr_complex_2 = d->prev_fr_complex_2;
45 d->cur_ccr_complex = d->prev_ccr_complex;
46 d->cur_acc_mmac = d->prev_acc_mmac;
50 /* Record the cycles computed for an insn.
51 LAST_P is non-zero if this is the last insn in a set of parallel insns,
52 and we update the total cycle count.
53 CYCLES is the cycle count of the insn. */
55 fr550_model_insn_after (SIM_CPU *cpu, int last_p, int cycles)
59 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
60 d->prev_fr_load = d->cur_fr_load;
61 d->prev_fr_complex_1 = d->cur_fr_complex_1;
62 d->prev_fr_complex_2 = d->cur_fr_complex_2;
63 d->prev_ccr_complex = d->cur_ccr_complex;
64 d->prev_acc_mmac = d->cur_acc_mmac;
68 static void fr550_reset_fr_flags (SIM_CPU *cpu, INT fr);
69 static void fr550_reset_ccr_flags (SIM_CPU *cpu, INT ccr);
70 static void fr550_reset_acc_flags (SIM_CPU *cpu, INT acc);
73 set_use_is_fr_load (SIM_CPU *cpu, INT fr)
75 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
76 fr550_reset_fr_flags (cpu, (fr));
77 d->cur_fr_load |= (((DI)1) << (fr));
81 set_use_not_fr_load (SIM_CPU *cpu, INT fr)
83 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
84 d->cur_fr_load &= ~(((DI)1) << (fr));
88 use_is_fr_load (SIM_CPU *cpu, INT fr)
90 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
91 return d->prev_fr_load & (((DI)1) << (fr));
95 set_use_is_fr_complex_1 (SIM_CPU *cpu, INT fr)
97 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
98 fr550_reset_fr_flags (cpu, (fr));
99 d->cur_fr_complex_1 |= (((DI)1) << (fr));
103 set_use_not_fr_complex_1 (SIM_CPU *cpu, INT fr)
105 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
106 d->cur_fr_complex_1 &= ~(((DI)1) << (fr));
110 use_is_fr_complex_1 (SIM_CPU *cpu, INT fr)
112 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
113 return d->prev_fr_complex_1 & (((DI)1) << (fr));
117 set_use_is_fr_complex_2 (SIM_CPU *cpu, INT fr)
119 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
120 fr550_reset_fr_flags (cpu, (fr));
121 d->cur_fr_complex_2 |= (((DI)1) << (fr));
125 set_use_not_fr_complex_2 (SIM_CPU *cpu, INT fr)
127 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
128 d->cur_fr_complex_2 &= ~(((DI)1) << (fr));
132 use_is_fr_complex_2 (SIM_CPU *cpu, INT fr)
134 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
135 return d->prev_fr_complex_2 & (((DI)1) << (fr));
139 set_use_is_ccr_complex (SIM_CPU *cpu, INT ccr)
141 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
142 fr550_reset_ccr_flags (cpu, (ccr));
143 d->cur_ccr_complex |= (((SI)1) << (ccr));
147 set_use_not_ccr_complex (SIM_CPU *cpu, INT ccr)
149 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
150 d->cur_ccr_complex &= ~(((SI)1) << (ccr));
154 use_is_ccr_complex (SIM_CPU *cpu, INT ccr)
156 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
157 return d->prev_ccr_complex & (((SI)1) << (ccr));
161 set_use_is_acc_mmac (SIM_CPU *cpu, INT acc)
163 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
164 fr550_reset_acc_flags (cpu, (acc));
165 d->cur_acc_mmac |= (((DI)1) << (acc));
169 set_use_not_acc_mmac (SIM_CPU *cpu, INT acc)
171 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
172 d->cur_acc_mmac &= ~(((DI)1) << (acc));
176 use_is_acc_mmac (SIM_CPU *cpu, INT acc)
178 MODEL_FR550_DATA *d = CPU_MODEL_DATA (cpu);
179 return d->prev_acc_mmac & (((DI)1) << (acc));
183 fr550_reset_fr_flags (SIM_CPU *cpu, INT fr)
185 set_use_not_fr_load (cpu, fr);
186 set_use_not_fr_complex_1 (cpu, fr);
187 set_use_not_fr_complex_2 (cpu, fr);
191 fr550_reset_ccr_flags (SIM_CPU *cpu, INT ccr)
193 set_use_not_ccr_complex (cpu, ccr);
197 fr550_reset_acc_flags (SIM_CPU *cpu, INT acc)
199 set_use_not_acc_mmac (cpu, acc);
202 /* Detect overlap between two register ranges. Works if one of the registers
203 is -1 with width 1 (i.e. undefined), but not both. */
204 #define REG_OVERLAP(r1, w1, r2, w2) ( \
205 (r1) + (w1) - 1 >= (r2) && (r2) + (w2) - 1 >= (r1) \
208 /* Latency of floating point registers may be less than recorded when followed
209 by another floating point insn. */
211 adjust_float_register_busy (SIM_CPU *cpu,
212 INT in_FRi, int iwidth,
213 INT in_FRj, int jwidth,
214 INT out_FRk, int kwidth)
217 /* The latency of FRk may be less than previously recorded.
218 See Table 14-15 in the LSI. */
221 for (i = 0; i < iwidth; ++i)
223 if (! REG_OVERLAP (in_FRi + i, 1, out_FRk, kwidth))
224 if (use_is_fr_load (cpu, in_FRi + i))
225 decrease_FR_busy (cpu, in_FRi + i, 1);
227 enforce_full_fr_latency (cpu, in_FRi + i);
233 for (i = 0; i < jwidth; ++i)
235 if (! REG_OVERLAP (in_FRj + i, 1, in_FRi, iwidth)
236 && ! REG_OVERLAP (in_FRj + i, 1, out_FRk, kwidth))
237 if (use_is_fr_load (cpu, in_FRj + i))
238 decrease_FR_busy (cpu, in_FRj + i, 1);
240 enforce_full_fr_latency (cpu, in_FRj + i);
246 for (i = 0; i < kwidth; ++i)
248 if (! REG_OVERLAP (out_FRk + i, 1, in_FRi, iwidth)
249 && ! REG_OVERLAP (out_FRk + i, 1, in_FRj, jwidth))
251 if (use_is_fr_complex_1 (cpu, out_FRk + i))
252 decrease_FR_busy (cpu, out_FRk + i, 1);
253 else if (use_is_fr_complex_2 (cpu, out_FRk + i))
254 decrease_FR_busy (cpu, out_FRk + i, 2);
256 enforce_full_fr_latency (cpu, out_FRk + i);
263 restore_float_register_busy (SIM_CPU *cpu,
264 INT in_FRi, int iwidth,
265 INT in_FRj, int jwidth,
266 INT out_FRk, int kwidth)
269 /* The latency of FRk may be less than previously recorded.
270 See Table 14-15 in the LSI. */
273 for (i = 0; i < iwidth; ++i)
275 if (! REG_OVERLAP (in_FRi + i, 1, out_FRk, kwidth))
276 if (use_is_fr_load (cpu, in_FRi + i))
277 increase_FR_busy (cpu, in_FRi + i, 1);
283 for (i = 0; i < jwidth; ++i)
285 if (! REG_OVERLAP (in_FRj + i, 1, in_FRi, iwidth)
286 && ! REG_OVERLAP (in_FRj + i, 1, out_FRk, kwidth))
287 if (use_is_fr_load (cpu, in_FRj + i))
288 increase_FR_busy (cpu, in_FRj + i, 1);
294 for (i = 0; i < kwidth; ++i)
296 if (! REG_OVERLAP (out_FRk + i, 1, in_FRi, iwidth)
297 && ! REG_OVERLAP (out_FRk + i, 1, in_FRj, jwidth))
299 if (use_is_fr_complex_1 (cpu, out_FRk + i))
300 increase_FR_busy (cpu, out_FRk + i, 1);
301 else if (use_is_fr_complex_2 (cpu, out_FRk + i))
302 increase_FR_busy (cpu, out_FRk + i, 2);
308 /* Latency of floating point registers may be less than recorded when used in a
309 media insns and followed by another media insn. */
311 adjust_float_register_busy_for_media (SIM_CPU *cpu,
312 INT in_FRi, int iwidth,
313 INT in_FRj, int jwidth,
314 INT out_FRk, int kwidth)
317 /* The latency of FRk may be less than previously recorded.
318 See Table 14-15 in the LSI. */
321 for (i = 0; i < kwidth; ++i)
323 if (! REG_OVERLAP (out_FRk + i, 1, in_FRi, iwidth)
324 && ! REG_OVERLAP (out_FRk + i, 1, in_FRj, jwidth))
326 if (use_is_fr_complex_1 (cpu, out_FRk + i))
327 decrease_FR_busy (cpu, out_FRk + i, 1);
329 enforce_full_fr_latency (cpu, out_FRk + i);
336 restore_float_register_busy_for_media (SIM_CPU *cpu,
337 INT in_FRi, int iwidth,
338 INT in_FRj, int jwidth,
339 INT out_FRk, int kwidth)
344 for (i = 0; i < kwidth; ++i)
346 if (! REG_OVERLAP (out_FRk + i, 1, in_FRi, iwidth)
347 && ! REG_OVERLAP (out_FRk + i, 1, in_FRj, jwidth))
349 if (use_is_fr_complex_1 (cpu, out_FRk + i))
350 increase_FR_busy (cpu, out_FRk + i, 1);
356 /* Latency of accumulator registers may be less than recorded when used in a
357 media insns and followed by another media insn. */
359 adjust_acc_busy_for_mmac (SIM_CPU *cpu,
360 INT in_ACC, int inwidth,
361 INT out_ACC, int outwidth)
364 /* The latency of an accumulator may be less than previously recorded.
365 See Table 14-15 in the LSI. */
368 for (i = 0; i < inwidth; ++i)
370 if (use_is_acc_mmac (cpu, in_ACC + i))
371 decrease_ACC_busy (cpu, in_ACC + i, 1);
373 enforce_full_acc_latency (cpu, in_ACC + i);
378 for (i = 0; i < outwidth; ++i)
380 if (! REG_OVERLAP (out_ACC + i, 1, in_ACC, inwidth))
382 if (use_is_acc_mmac (cpu, out_ACC + i))
383 decrease_ACC_busy (cpu, out_ACC + i, 1);
385 enforce_full_acc_latency (cpu, out_ACC + i);
392 restore_acc_busy_for_mmac (SIM_CPU *cpu,
393 INT in_ACC, int inwidth,
394 INT out_ACC, int outwidth)
399 for (i = 0; i < inwidth; ++i)
401 if (use_is_acc_mmac (cpu, in_ACC + i))
402 increase_ACC_busy (cpu, in_ACC + i, 1);
407 for (i = 0; i < outwidth; ++i)
409 if (! REG_OVERLAP (out_ACC + i, 1, in_ACC, inwidth))
411 if (use_is_acc_mmac (cpu, out_ACC + i))
412 increase_ACC_busy (cpu, out_ACC + i, 1);
419 frvbf_model_fr550_u_exec (SIM_CPU *cpu, const IDESC *idesc,
420 int unit_num, int referenced)
422 return idesc->timing->units[unit_num].done;
426 frvbf_model_fr550_u_integer (SIM_CPU *cpu, const IDESC *idesc,
427 int unit_num, int referenced,
428 INT in_GRi, INT in_GRj, INT out_GRk,
433 /* icc0-icc4 are the upper 4 fields of the CCR. */
437 if (model_insn == FRV_INSN_MODEL_PASS_1)
439 /* The entire VLIW insn must wait if there is a dependency on a register
440 which is not ready yet. */
441 vliw_wait_for_GR (cpu, in_GRi);
442 vliw_wait_for_GR (cpu, in_GRj);
443 vliw_wait_for_GR (cpu, out_GRk);
444 vliw_wait_for_CCR (cpu, out_ICCi_1);
445 handle_resource_wait (cpu);
446 load_wait_for_GR (cpu, in_GRi);
447 load_wait_for_GR (cpu, in_GRj);
448 load_wait_for_GR (cpu, out_GRk);
449 trace_vliw_wait_cycles (cpu);
453 fr550_reset_ccr_flags (cpu, out_ICCi_1);
455 /* GRk is available immediately to the next VLIW insn as is ICCi_1. */
456 cycles = idesc->timing->units[unit_num].done;
461 frvbf_model_fr550_u_imul (SIM_CPU *cpu, const IDESC *idesc,
462 int unit_num, int referenced,
463 INT in_GRi, INT in_GRj, INT out_GRk, INT out_ICCi_1)
466 /* icc0-icc4 are the upper 4 fields of the CCR. */
470 if (model_insn == FRV_INSN_MODEL_PASS_1)
472 /* The entire VLIW insn must wait if there is a dependency on a register
473 which is not ready yet. */
474 vliw_wait_for_GR (cpu, in_GRi);
475 vliw_wait_for_GR (cpu, in_GRj);
476 vliw_wait_for_GRdouble (cpu, out_GRk);
477 vliw_wait_for_CCR (cpu, out_ICCi_1);
478 handle_resource_wait (cpu);
479 load_wait_for_GR (cpu, in_GRi);
480 load_wait_for_GR (cpu, in_GRj);
481 load_wait_for_GRdouble (cpu, out_GRk);
482 trace_vliw_wait_cycles (cpu);
486 /* GRk has a latency of 1 cycles. */
487 cycles = idesc->timing->units[unit_num].done;
488 update_GRdouble_latency (cpu, out_GRk, cycles + 1);
490 /* ICCi_1 has a latency of 1 cycle. */
491 update_CCR_latency (cpu, out_ICCi_1, cycles + 1);
493 fr550_reset_ccr_flags (cpu, out_ICCi_1);
499 frvbf_model_fr550_u_idiv (SIM_CPU *cpu, const IDESC *idesc,
500 int unit_num, int referenced,
501 INT in_GRi, INT in_GRj, INT out_GRk, INT out_ICCi_1)
507 /* icc0-icc4 are the upper 4 fields of the CCR. */
511 vliw = CPU_VLIW (cpu);
512 slot = vliw->next_slot - 1;
513 slot = (*vliw->current_vliw)[slot] - UNIT_I0;
515 if (model_insn == FRV_INSN_MODEL_PASS_1)
517 /* The entire VLIW insn must wait if there is a dependency on a register
518 which is not ready yet. */
519 vliw_wait_for_GR (cpu, in_GRi);
520 vliw_wait_for_GR (cpu, in_GRj);
521 vliw_wait_for_GR (cpu, out_GRk);
522 vliw_wait_for_CCR (cpu, out_ICCi_1);
523 vliw_wait_for_idiv_resource (cpu, slot);
524 handle_resource_wait (cpu);
525 load_wait_for_GR (cpu, in_GRi);
526 load_wait_for_GR (cpu, in_GRj);
527 load_wait_for_GR (cpu, out_GRk);
528 trace_vliw_wait_cycles (cpu);
532 /* GRk has a latency of 18 cycles! */
533 cycles = idesc->timing->units[unit_num].done;
534 update_GR_latency (cpu, out_GRk, cycles + 18);
536 /* ICCi_1 has a latency of 18 cycles. */
537 update_CCR_latency (cpu, out_ICCi_1, cycles + 18);
539 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
541 /* GNER has a latency of 18 cycles. */
542 update_SPR_latency (cpu, GNER_FOR_GR (out_GRk), cycles + 18);
545 /* the idiv resource has a latency of 18 cycles! */
546 update_idiv_resource_latency (cpu, slot, cycles + 18);
548 fr550_reset_ccr_flags (cpu, out_ICCi_1);
554 frvbf_model_fr550_u_branch (SIM_CPU *cpu, const IDESC *idesc,
555 int unit_num, int referenced,
556 INT in_GRi, INT in_GRj,
557 INT in_ICCi_2, INT in_FCCi_2)
560 FRV_PROFILE_STATE *ps;
562 if (model_insn == FRV_INSN_MODEL_PASS_1)
564 /* icc0-icc4 are the upper 4 fields of the CCR. */
568 /* The entire VLIW insn must wait if there is a dependency on a register
569 which is not ready yet. */
570 vliw_wait_for_GR (cpu, in_GRi);
571 vliw_wait_for_GR (cpu, in_GRj);
572 vliw_wait_for_CCR (cpu, in_ICCi_2);
573 vliw_wait_for_CCR (cpu, in_FCCi_2);
574 handle_resource_wait (cpu);
575 load_wait_for_GR (cpu, in_GRi);
576 load_wait_for_GR (cpu, in_GRj);
577 trace_vliw_wait_cycles (cpu);
581 /* When counting branches taken or not taken, don't consider branches after
582 the first taken branch in a vliw insn. */
583 ps = CPU_PROFILE_STATE (cpu);
584 if (! ps->vliw_branch_taken)
586 /* (1 << 4): The pc is the 5th element in inputs, outputs.
587 ??? can be cleaned up */
588 PROFILE_DATA *p = CPU_PROFILE_DATA (cpu);
589 int taken = (referenced & (1 << 4)) != 0;
592 ++PROFILE_MODEL_TAKEN_COUNT (p);
593 ps->vliw_branch_taken = 1;
596 ++PROFILE_MODEL_UNTAKEN_COUNT (p);
599 cycles = idesc->timing->units[unit_num].done;
604 frvbf_model_fr550_u_trap (SIM_CPU *cpu, const IDESC *idesc,
605 int unit_num, int referenced,
606 INT in_GRi, INT in_GRj,
607 INT in_ICCi_2, INT in_FCCi_2)
611 if (model_insn == FRV_INSN_MODEL_PASS_1)
613 /* icc0-icc4 are the upper 4 fields of the CCR. */
617 /* The entire VLIW insn must wait if there is a dependency on a register
618 which is not ready yet. */
619 vliw_wait_for_GR (cpu, in_GRi);
620 vliw_wait_for_GR (cpu, in_GRj);
621 vliw_wait_for_CCR (cpu, in_ICCi_2);
622 vliw_wait_for_CCR (cpu, in_FCCi_2);
623 handle_resource_wait (cpu);
624 load_wait_for_GR (cpu, in_GRi);
625 load_wait_for_GR (cpu, in_GRj);
626 trace_vliw_wait_cycles (cpu);
630 cycles = idesc->timing->units[unit_num].done;
635 frvbf_model_fr550_u_check (SIM_CPU *cpu, const IDESC *idesc,
636 int unit_num, int referenced,
637 INT in_ICCi_3, INT in_FCCi_3)
639 /* Modelling for this unit is the same as for fr500. */
640 return frvbf_model_fr500_u_check (cpu, idesc, unit_num, referenced,
641 in_ICCi_3, in_FCCi_3);
645 frvbf_model_fr550_u_set_hilo (SIM_CPU *cpu, const IDESC *idesc,
646 int unit_num, int referenced,
647 INT out_GRkhi, INT out_GRklo)
651 if (model_insn == FRV_INSN_MODEL_PASS_1)
653 /* The entire VLIW insn must wait if there is a dependency on a GR
654 which is not ready yet. */
655 vliw_wait_for_GR (cpu, out_GRkhi);
656 vliw_wait_for_GR (cpu, out_GRklo);
657 handle_resource_wait (cpu);
658 load_wait_for_GR (cpu, out_GRkhi);
659 load_wait_for_GR (cpu, out_GRklo);
660 trace_vliw_wait_cycles (cpu);
664 /* GRk is available immediately to the next VLIW insn. */
665 cycles = idesc->timing->units[unit_num].done;
671 frvbf_model_fr550_u_gr_load (SIM_CPU *cpu, const IDESC *idesc,
672 int unit_num, int referenced,
673 INT in_GRi, INT in_GRj,
674 INT out_GRk, INT out_GRdoublek)
678 if (model_insn == FRV_INSN_MODEL_PASS_1)
680 /* The entire VLIW insn must wait if there is a dependency on a register
681 which is not ready yet. */
682 vliw_wait_for_GR (cpu, in_GRi);
683 vliw_wait_for_GR (cpu, in_GRj);
684 vliw_wait_for_GR (cpu, out_GRk);
685 vliw_wait_for_GRdouble (cpu, out_GRdoublek);
686 handle_resource_wait (cpu);
687 load_wait_for_GR (cpu, in_GRi);
688 load_wait_for_GR (cpu, in_GRj);
689 load_wait_for_GR (cpu, out_GRk);
690 load_wait_for_GRdouble (cpu, out_GRdoublek);
691 trace_vliw_wait_cycles (cpu);
695 cycles = idesc->timing->units[unit_num].done;
697 /* The latency of GRk for a load will depend on how long it takes to retrieve
698 the the data from the cache or memory. */
699 update_GR_latency_for_load (cpu, out_GRk, cycles);
700 update_GRdouble_latency_for_load (cpu, out_GRdoublek, cycles);
702 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
704 /* GNER has a latency of 2 cycles. */
705 update_SPR_latency (cpu, GNER_FOR_GR (out_GRk), cycles + 2);
706 update_SPR_latency (cpu, GNER_FOR_GR (out_GRdoublek), cycles + 2);
713 frvbf_model_fr550_u_gr_store (SIM_CPU *cpu, const IDESC *idesc,
714 int unit_num, int referenced,
715 INT in_GRi, INT in_GRj,
716 INT in_GRk, INT in_GRdoublek)
720 if (model_insn == FRV_INSN_MODEL_PASS_1)
722 /* The entire VLIW insn must wait if there is a dependency on a register
723 which is not ready yet. */
724 vliw_wait_for_GR (cpu, in_GRi);
725 vliw_wait_for_GR (cpu, in_GRj);
726 vliw_wait_for_GR (cpu, in_GRk);
727 vliw_wait_for_GRdouble (cpu, in_GRdoublek);
728 handle_resource_wait (cpu);
729 load_wait_for_GR (cpu, in_GRi);
730 load_wait_for_GR (cpu, in_GRj);
731 load_wait_for_GR (cpu, in_GRk);
732 load_wait_for_GRdouble (cpu, in_GRdoublek);
733 trace_vliw_wait_cycles (cpu);
737 /* The target register is available immediately. */
738 cycles = idesc->timing->units[unit_num].done;
744 frvbf_model_fr550_u_fr_load (SIM_CPU *cpu, const IDESC *idesc,
745 int unit_num, int referenced,
746 INT in_GRi, INT in_GRj,
747 INT out_FRk, INT out_FRdoublek)
750 if (model_insn == FRV_INSN_MODEL_PASS_1)
752 /* The entire VLIW insn must wait if there is a dependency on a register
753 which is not ready yet.
754 The latency of the registers may be less than previously recorded,
755 depending on how they were used previously.
756 See Table 13-8 in the LSI. */
757 adjust_float_register_busy (cpu, -1, 1, -1, 1, out_FRk, 1);
758 adjust_float_register_busy (cpu, -1, 1, -1, 1, out_FRdoublek, 2);
759 vliw_wait_for_GR (cpu, in_GRi);
760 vliw_wait_for_GR (cpu, in_GRj);
761 vliw_wait_for_FR (cpu, out_FRk);
762 vliw_wait_for_FRdouble (cpu, out_FRdoublek);
763 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
765 vliw_wait_for_SPR (cpu, FNER_FOR_FR (out_FRk));
766 vliw_wait_for_SPR (cpu, FNER_FOR_FR (out_FRdoublek));
768 handle_resource_wait (cpu);
769 load_wait_for_GR (cpu, in_GRi);
770 load_wait_for_GR (cpu, in_GRj);
771 load_wait_for_FR (cpu, out_FRk);
772 load_wait_for_FRdouble (cpu, out_FRdoublek);
773 trace_vliw_wait_cycles (cpu);
777 cycles = idesc->timing->units[unit_num].done;
779 /* The latency of FRk for a load will depend on how long it takes to retrieve
780 the the data from the cache or memory. */
781 update_FR_latency_for_load (cpu, out_FRk, cycles);
782 update_FRdouble_latency_for_load (cpu, out_FRdoublek, cycles);
784 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
786 /* FNER has a latency of 3 cycles. */
787 update_SPR_latency (cpu, FNER_FOR_FR (out_FRk), cycles + 3);
788 update_SPR_latency (cpu, FNER_FOR_FR (out_FRdoublek), cycles + 3);
792 set_use_is_fr_load (cpu, out_FRk);
793 if (out_FRdoublek >= 0)
795 set_use_is_fr_load (cpu, out_FRdoublek);
796 set_use_is_fr_load (cpu, out_FRdoublek + 1);
803 frvbf_model_fr550_u_fr_store (SIM_CPU *cpu, const IDESC *idesc,
804 int unit_num, int referenced,
805 INT in_GRi, INT in_GRj,
806 INT in_FRk, INT in_FRdoublek)
810 if (model_insn == FRV_INSN_MODEL_PASS_1)
812 /* The entire VLIW insn must wait if there is a dependency on a register
813 which is not ready yet. */
814 adjust_float_register_busy (cpu, in_FRk, 1, -1, 1, -1, 1);
815 adjust_float_register_busy (cpu, in_FRdoublek, 2, -1, 1, -1, 1);
816 vliw_wait_for_GR (cpu, in_GRi);
817 vliw_wait_for_GR (cpu, in_GRj);
818 vliw_wait_for_FR (cpu, in_FRk);
819 vliw_wait_for_FRdouble (cpu, in_FRdoublek);
820 handle_resource_wait (cpu);
821 load_wait_for_GR (cpu, in_GRi);
822 load_wait_for_GR (cpu, in_GRj);
823 load_wait_for_FR (cpu, in_FRk);
824 load_wait_for_FRdouble (cpu, in_FRdoublek);
825 trace_vliw_wait_cycles (cpu);
829 /* The target register is available immediately. */
830 cycles = idesc->timing->units[unit_num].done;
836 frvbf_model_fr550_u_ici (SIM_CPU *cpu, const IDESC *idesc,
837 int unit_num, int referenced,
838 INT in_GRi, INT in_GRj)
842 if (model_insn == FRV_INSN_MODEL_PASS_1)
844 /* The entire VLIW insn must wait if there is a dependency on a register
845 which is not ready yet. */
846 vliw_wait_for_GR (cpu, in_GRi);
847 vliw_wait_for_GR (cpu, in_GRj);
848 handle_resource_wait (cpu);
849 load_wait_for_GR (cpu, in_GRi);
850 load_wait_for_GR (cpu, in_GRj);
851 trace_vliw_wait_cycles (cpu);
855 cycles = idesc->timing->units[unit_num].done;
856 request_cache_invalidate (cpu, CPU_INSN_CACHE (cpu), cycles);
861 frvbf_model_fr550_u_dci (SIM_CPU *cpu, const IDESC *idesc,
862 int unit_num, int referenced,
863 INT in_GRi, INT in_GRj)
867 if (model_insn == FRV_INSN_MODEL_PASS_1)
869 /* The entire VLIW insn must wait if there is a dependency on a register
870 which is not ready yet. */
871 vliw_wait_for_GR (cpu, in_GRi);
872 vliw_wait_for_GR (cpu, in_GRj);
873 handle_resource_wait (cpu);
874 load_wait_for_GR (cpu, in_GRi);
875 load_wait_for_GR (cpu, in_GRj);
876 trace_vliw_wait_cycles (cpu);
880 cycles = idesc->timing->units[unit_num].done;
881 request_cache_invalidate (cpu, CPU_DATA_CACHE (cpu), cycles);
886 frvbf_model_fr550_u_dcf (SIM_CPU *cpu, const IDESC *idesc,
887 int unit_num, int referenced,
888 INT in_GRi, INT in_GRj)
892 if (model_insn == FRV_INSN_MODEL_PASS_1)
894 /* The entire VLIW insn must wait if there is a dependency on a register
895 which is not ready yet. */
896 vliw_wait_for_GR (cpu, in_GRi);
897 vliw_wait_for_GR (cpu, in_GRj);
898 handle_resource_wait (cpu);
899 load_wait_for_GR (cpu, in_GRi);
900 load_wait_for_GR (cpu, in_GRj);
901 trace_vliw_wait_cycles (cpu);
905 cycles = idesc->timing->units[unit_num].done;
906 request_cache_flush (cpu, CPU_DATA_CACHE (cpu), cycles);
911 frvbf_model_fr550_u_icpl (SIM_CPU *cpu, const IDESC *idesc,
912 int unit_num, int referenced,
913 INT in_GRi, INT in_GRj)
917 if (model_insn == FRV_INSN_MODEL_PASS_1)
919 /* The entire VLIW insn must wait if there is a dependency on a register
920 which is not ready yet. */
921 vliw_wait_for_GR (cpu, in_GRi);
922 vliw_wait_for_GR (cpu, in_GRj);
923 handle_resource_wait (cpu);
924 load_wait_for_GR (cpu, in_GRi);
925 load_wait_for_GR (cpu, in_GRj);
926 trace_vliw_wait_cycles (cpu);
930 cycles = idesc->timing->units[unit_num].done;
931 request_cache_preload (cpu, CPU_INSN_CACHE (cpu), cycles);
936 frvbf_model_fr550_u_dcpl (SIM_CPU *cpu, const IDESC *idesc,
937 int unit_num, int referenced,
938 INT in_GRi, INT in_GRj)
942 if (model_insn == FRV_INSN_MODEL_PASS_1)
944 /* The entire VLIW insn must wait if there is a dependency on a register
945 which is not ready yet. */
946 vliw_wait_for_GR (cpu, in_GRi);
947 vliw_wait_for_GR (cpu, in_GRj);
948 handle_resource_wait (cpu);
949 load_wait_for_GR (cpu, in_GRi);
950 load_wait_for_GR (cpu, in_GRj);
951 trace_vliw_wait_cycles (cpu);
955 cycles = idesc->timing->units[unit_num].done;
956 request_cache_preload (cpu, CPU_DATA_CACHE (cpu), cycles);
961 frvbf_model_fr550_u_icul (SIM_CPU *cpu, const IDESC *idesc,
962 int unit_num, int referenced,
963 INT in_GRi, INT in_GRj)
967 if (model_insn == FRV_INSN_MODEL_PASS_1)
969 /* The entire VLIW insn must wait if there is a dependency on a register
970 which is not ready yet. */
971 vliw_wait_for_GR (cpu, in_GRi);
972 vliw_wait_for_GR (cpu, in_GRj);
973 handle_resource_wait (cpu);
974 load_wait_for_GR (cpu, in_GRi);
975 load_wait_for_GR (cpu, in_GRj);
976 trace_vliw_wait_cycles (cpu);
980 cycles = idesc->timing->units[unit_num].done;
981 request_cache_unlock (cpu, CPU_INSN_CACHE (cpu), cycles);
986 frvbf_model_fr550_u_dcul (SIM_CPU *cpu, const IDESC *idesc,
987 int unit_num, int referenced,
988 INT in_GRi, INT in_GRj)
992 if (model_insn == FRV_INSN_MODEL_PASS_1)
994 /* The entire VLIW insn must wait if there is a dependency on a register
995 which is not ready yet. */
996 vliw_wait_for_GR (cpu, in_GRi);
997 vliw_wait_for_GR (cpu, in_GRj);
998 handle_resource_wait (cpu);
999 load_wait_for_GR (cpu, in_GRi);
1000 load_wait_for_GR (cpu, in_GRj);
1001 trace_vliw_wait_cycles (cpu);
1005 cycles = idesc->timing->units[unit_num].done;
1006 request_cache_unlock (cpu, CPU_DATA_CACHE (cpu), cycles);
1011 frvbf_model_fr550_u_float_arith (SIM_CPU *cpu, const IDESC *idesc,
1012 int unit_num, int referenced,
1013 INT in_FRi, INT in_FRj,
1014 INT in_FRdoublei, INT in_FRdoublej,
1015 INT out_FRk, INT out_FRdoublek)
1018 FRV_PROFILE_STATE *ps;
1022 if (model_insn == FRV_INSN_MODEL_PASS_1)
1025 /* The preprocessing can execute right away. */
1026 cycles = idesc->timing->units[unit_num].done;
1028 /* The post processing must wait if there is a dependency on a FR
1029 which is not ready yet. */
1030 adjust_float_register_busy (cpu, in_FRi, 1, in_FRj, 1, out_FRk, 1);
1031 adjust_float_register_busy (cpu, in_FRdoublei, 2, in_FRdoublej, 2, out_FRdoublek, 2);
1032 ps = CPU_PROFILE_STATE (cpu);
1033 ps->post_wait = cycles;
1034 vliw = CPU_VLIW (cpu);
1035 slot = vliw->next_slot - 1;
1036 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1037 post_wait_for_float (cpu, slot);
1038 post_wait_for_FR (cpu, in_FRi);
1039 post_wait_for_FR (cpu, in_FRj);
1040 post_wait_for_FR (cpu, out_FRk);
1041 post_wait_for_FRdouble (cpu, in_FRdoublei);
1042 post_wait_for_FRdouble (cpu, in_FRdoublej);
1043 post_wait_for_FRdouble (cpu, out_FRdoublek);
1044 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1046 post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRk));
1047 post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRdoublek));
1049 restore_float_register_busy (cpu, in_FRi, 1, in_FRj, 1, out_FRk, 1);
1050 restore_float_register_busy (cpu, in_FRdoublei, 2, in_FRdoublej, 2, out_FRdoublek, 2);
1052 /* The latency of FRk will be at least the latency of the other inputs. */
1053 update_FR_latency (cpu, out_FRk, ps->post_wait);
1054 update_FRdouble_latency (cpu, out_FRdoublek, ps->post_wait);
1056 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1058 update_SPR_latency (cpu, FNER_FOR_FR (out_FRk), ps->post_wait);
1059 update_SPR_latency (cpu, FNER_FOR_FR (out_FRdoublek), ps->post_wait);
1062 /* Once initiated, post-processing will take 2 cycles. */
1063 update_FR_ptime (cpu, out_FRk, 2);
1064 update_FRdouble_ptime (cpu, out_FRdoublek, 2);
1065 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1067 update_SPR_ptime (cpu, FNER_FOR_FR (out_FRk), 2);
1068 update_SPR_ptime (cpu, FNER_FOR_FR (out_FRdoublek), 2);
1071 /* Mark this use of the register as a floating point op. */
1073 set_use_is_fr_complex_2 (cpu, out_FRk);
1074 if (out_FRdoublek >= 0)
1076 set_use_is_fr_complex_2 (cpu, out_FRdoublek);
1077 if (out_FRdoublek < 63)
1078 set_use_is_fr_complex_2 (cpu, out_FRdoublek + 1);
1081 /* the media point unit resource has a latency of 4 cycles */
1082 update_media_resource_latency (cpu, slot, cycles + 4);
1088 frvbf_model_fr550_u_float_dual_arith (SIM_CPU *cpu, const IDESC *idesc,
1089 int unit_num, int referenced,
1090 INT in_FRi, INT in_FRj,
1091 INT in_FRdoublei, INT in_FRdoublej,
1092 INT out_FRk, INT out_FRdoublek)
1101 FRV_PROFILE_STATE *ps;
1105 if (model_insn == FRV_INSN_MODEL_PASS_1)
1108 /* The preprocessing can execute right away. */
1109 cycles = idesc->timing->units[unit_num].done;
1111 /* The post processing must wait if there is a dependency on a FR
1112 which is not ready yet. */
1113 dual_FRi = DUAL_REG (in_FRi);
1114 dual_FRj = DUAL_REG (in_FRj);
1115 dual_FRk = DUAL_REG (out_FRk);
1116 dual_FRdoublei = DUAL_DOUBLE (in_FRdoublei);
1117 dual_FRdoublej = DUAL_DOUBLE (in_FRdoublej);
1118 dual_FRdoublek = DUAL_DOUBLE (out_FRdoublek);
1120 adjust_float_register_busy (cpu, in_FRi, 2, in_FRj, 2, out_FRk, 2);
1121 adjust_float_register_busy (cpu, in_FRdoublei, 4, in_FRdoublej, 4, out_FRdoublek, 4);
1122 ps = CPU_PROFILE_STATE (cpu);
1123 ps->post_wait = cycles;
1124 vliw = CPU_VLIW (cpu);
1125 slot = vliw->next_slot - 1;
1126 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1127 post_wait_for_float (cpu, slot);
1128 post_wait_for_FR (cpu, in_FRi);
1129 post_wait_for_FR (cpu, in_FRj);
1130 post_wait_for_FR (cpu, out_FRk);
1131 post_wait_for_FR (cpu, dual_FRi);
1132 post_wait_for_FR (cpu, dual_FRj);
1133 post_wait_for_FR (cpu, dual_FRk);
1134 post_wait_for_FRdouble (cpu, in_FRdoublei);
1135 post_wait_for_FRdouble (cpu, in_FRdoublej);
1136 post_wait_for_FRdouble (cpu, out_FRdoublek);
1137 post_wait_for_FRdouble (cpu, dual_FRdoublei);
1138 post_wait_for_FRdouble (cpu, dual_FRdoublej);
1139 post_wait_for_FRdouble (cpu, dual_FRdoublek);
1140 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1142 post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRk));
1143 post_wait_for_SPR (cpu, FNER_FOR_FR (dual_FRk));
1144 post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRdoublek));
1145 post_wait_for_SPR (cpu, FNER_FOR_FR (dual_FRdoublek));
1147 restore_float_register_busy (cpu, in_FRi, 2, in_FRj, 2, out_FRk, 2);
1148 restore_float_register_busy (cpu, in_FRdoublei, 4, in_FRdoublej, 4, out_FRdoublek, 4);
1150 /* The latency of FRk will be at least the latency of the other inputs. */
1151 update_FR_latency (cpu, out_FRk, ps->post_wait);
1152 update_FR_latency (cpu, dual_FRk, ps->post_wait);
1153 update_FRdouble_latency (cpu, out_FRdoublek, ps->post_wait);
1154 update_FRdouble_latency (cpu, dual_FRdoublek, ps->post_wait);
1156 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1158 update_SPR_latency (cpu, FNER_FOR_FR (out_FRk), ps->post_wait);
1159 update_SPR_latency (cpu, FNER_FOR_FR (dual_FRk), ps->post_wait);
1160 update_SPR_latency (cpu, FNER_FOR_FR (out_FRdoublek), ps->post_wait);
1161 update_SPR_latency (cpu, FNER_FOR_FR (dual_FRdoublek), ps->post_wait);
1164 /* Once initiated, post-processing will take 3 cycles. */
1165 update_FR_ptime (cpu, out_FRk, 3);
1166 update_FR_ptime (cpu, dual_FRk, 3);
1167 update_FRdouble_ptime (cpu, out_FRdoublek, 3);
1168 update_FRdouble_ptime (cpu, dual_FRdoublek, 3);
1170 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1172 update_SPR_ptime (cpu, FNER_FOR_FR (out_FRk), 3);
1173 update_SPR_ptime (cpu, FNER_FOR_FR (dual_FRk), 3);
1174 update_SPR_ptime (cpu, FNER_FOR_FR (out_FRdoublek), 3);
1175 update_SPR_ptime (cpu, FNER_FOR_FR (dual_FRdoublek), 3);
1178 /* Mark this use of the register as a floating point op. */
1180 fr550_reset_fr_flags (cpu, out_FRk);
1182 fr550_reset_fr_flags (cpu, dual_FRk);
1183 if (out_FRdoublek >= 0)
1185 fr550_reset_fr_flags (cpu, out_FRdoublek);
1186 if (out_FRdoublek < 63)
1187 fr550_reset_fr_flags (cpu, out_FRdoublek + 1);
1189 if (dual_FRdoublek >= 0)
1191 fr550_reset_fr_flags (cpu, dual_FRdoublek);
1192 if (dual_FRdoublek < 63)
1193 fr550_reset_fr_flags (cpu, dual_FRdoublek + 1);
1196 /* the media point unit resource has a latency of 5 cycles */
1197 update_media_resource_latency (cpu, slot, cycles + 5);
1203 frvbf_model_fr550_u_float_div (SIM_CPU *cpu, const IDESC *idesc,
1204 int unit_num, int referenced,
1205 INT in_FRi, INT in_FRj, INT out_FRk)
1210 FRV_PROFILE_STATE *ps;
1212 if (model_insn == FRV_INSN_MODEL_PASS_1)
1215 cycles = idesc->timing->units[unit_num].done;
1217 /* The post processing must wait if there is a dependency on a FR
1218 which is not ready yet. */
1219 adjust_float_register_busy (cpu, in_FRi, 1, in_FRj, 1, out_FRk, 1);
1220 ps = CPU_PROFILE_STATE (cpu);
1221 ps->post_wait = cycles;
1222 vliw = CPU_VLIW (cpu);
1223 slot = vliw->next_slot - 1;
1224 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1225 post_wait_for_float (cpu, slot);
1226 post_wait_for_fdiv (cpu, slot);
1227 post_wait_for_FR (cpu, in_FRi);
1228 post_wait_for_FR (cpu, in_FRj);
1229 post_wait_for_FR (cpu, out_FRk);
1230 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1231 post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRk));
1232 restore_float_register_busy (cpu, in_FRi, 1, in_FRj, 1, out_FRk, 1);
1234 /* The latency of FRk will be at least the latency of the other inputs. */
1235 /* Once initiated, post-processing will take 9 cycles. */
1236 update_FR_latency (cpu, out_FRk, ps->post_wait);
1237 update_FR_ptime (cpu, out_FRk, 9);
1239 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1241 /* FNER has a latency of 9 cycles. */
1242 update_SPR_latency (cpu, FNER_FOR_FR (out_FRk), ps->post_wait);
1243 update_SPR_ptime (cpu, FNER_FOR_FR (out_FRk), 9);
1246 /* The latency of the fdiv unit will be at least the latency of the other
1247 inputs. Once initiated, post-processing will take 9 cycles. */
1248 update_fdiv_resource_latency (cpu, slot, ps->post_wait + 9);
1250 /* the media point unit resource has a latency of 11 cycles */
1251 update_media_resource_latency (cpu, slot, cycles + 11);
1253 fr550_reset_fr_flags (cpu, out_FRk);
1259 frvbf_model_fr550_u_float_sqrt (SIM_CPU *cpu, const IDESC *idesc,
1260 int unit_num, int referenced,
1261 INT in_FRj, INT in_FRdoublej,
1262 INT out_FRk, INT out_FRdoublek)
1267 FRV_PROFILE_STATE *ps;
1269 if (model_insn == FRV_INSN_MODEL_PASS_1)
1272 cycles = idesc->timing->units[unit_num].done;
1274 /* The post processing must wait if there is a dependency on a FR
1275 which is not ready yet. */
1276 adjust_float_register_busy (cpu, -1, 1, in_FRj, 1, out_FRk, 1);
1277 adjust_float_register_busy (cpu, -1, 1, in_FRdoublej, 2, out_FRdoublek, 2);
1278 ps = CPU_PROFILE_STATE (cpu);
1279 ps->post_wait = cycles;
1280 vliw = CPU_VLIW (cpu);
1281 slot = vliw->next_slot - 1;
1282 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1283 post_wait_for_float (cpu, slot);
1284 post_wait_for_fsqrt (cpu, slot);
1285 post_wait_for_FR (cpu, in_FRj);
1286 post_wait_for_FR (cpu, out_FRk);
1287 post_wait_for_FRdouble (cpu, in_FRdoublej);
1288 post_wait_for_FRdouble (cpu, out_FRdoublek);
1289 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1291 post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRk));
1292 post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRdoublek));
1294 restore_float_register_busy (cpu, -1, 1, in_FRj, 1, out_FRk, 1);
1295 restore_float_register_busy (cpu, -1, 1, in_FRdoublej, 2, out_FRdoublek, 2);
1297 /* The latency of FRk will be at least the latency of the other inputs. */
1298 update_FR_latency (cpu, out_FRk, ps->post_wait);
1299 update_FRdouble_latency (cpu, out_FRdoublek, ps->post_wait);
1301 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1303 /* FNER has a latency of 14 cycles. */
1304 update_SPR_latency (cpu, FNER_FOR_FR (out_FRk), ps->post_wait);
1305 update_SPR_latency (cpu, FNER_FOR_FR (out_FRdoublek), ps->post_wait);
1308 /* Once initiated, post-processing will take 14 cycles. */
1309 update_FR_ptime (cpu, out_FRk, 14);
1310 update_FRdouble_ptime (cpu, out_FRdoublek, 14);
1312 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1314 /* FNER has a latency of 14 cycles. */
1315 update_SPR_ptime (cpu, FNER_FOR_FR (out_FRk), 14);
1316 update_SPR_ptime (cpu, FNER_FOR_FR (out_FRdoublek), 14);
1319 /* The latency of the sqrt unit will be the latency of the other
1320 inputs plus 14 cycles. */
1321 update_fsqrt_resource_latency (cpu, slot, ps->post_wait + 14);
1323 fr550_reset_fr_flags (cpu, out_FRk);
1324 if (out_FRdoublek != -1)
1326 fr550_reset_fr_flags (cpu, out_FRdoublek);
1327 fr550_reset_fr_flags (cpu, out_FRdoublek + 1);
1330 /* the media point unit resource has a latency of 16 cycles */
1331 update_media_resource_latency (cpu, slot, cycles + 16);
1337 frvbf_model_fr550_u_float_compare (SIM_CPU *cpu, const IDESC *idesc,
1338 int unit_num, int referenced,
1339 INT in_FRi, INT in_FRj,
1340 INT in_FRdoublei, INT in_FRdoublej,
1344 FRV_PROFILE_STATE *ps;
1348 if (model_insn == FRV_INSN_MODEL_PASS_1)
1351 /* The preprocessing can execute right away. */
1352 cycles = idesc->timing->units[unit_num].done;
1354 /* The post processing must wait if there is a dependency on a FR
1355 which is not ready yet. */
1356 adjust_float_register_busy (cpu, in_FRi, 1, in_FRj, 1, -1, 1);
1357 adjust_float_register_busy (cpu, in_FRdoublei, 2, in_FRdoublej, 2, -1, 1);
1358 ps = CPU_PROFILE_STATE (cpu);
1359 ps->post_wait = cycles;
1360 vliw = CPU_VLIW (cpu);
1361 slot = vliw->next_slot - 1;
1362 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1363 post_wait_for_float (cpu, slot);
1364 post_wait_for_FR (cpu, in_FRi);
1365 post_wait_for_FR (cpu, in_FRj);
1366 post_wait_for_FRdouble (cpu, in_FRdoublei);
1367 post_wait_for_FRdouble (cpu, in_FRdoublej);
1368 post_wait_for_CCR (cpu, out_FCCi_2);
1369 restore_float_register_busy (cpu, in_FRi, 1, in_FRj, 1, -1, 1);
1370 restore_float_register_busy (cpu, in_FRdoublei, 2, in_FRdoublej, 2, -1, 1);
1372 /* The latency of FCCi_2 will be the latency of the other inputs plus 2
1374 update_CCR_latency (cpu, out_FCCi_2, ps->post_wait + 2);
1376 /* the media point unit resource has a latency of 4 cycles */
1377 update_media_resource_latency (cpu, slot, cycles + 4);
1379 set_use_is_ccr_complex (cpu, out_FCCi_2);
1385 frvbf_model_fr550_u_float_dual_compare (SIM_CPU *cpu, const IDESC *idesc,
1386 int unit_num, int referenced,
1387 INT in_FRi, INT in_FRj,
1394 FRV_PROFILE_STATE *ps;
1398 if (model_insn == FRV_INSN_MODEL_PASS_1)
1401 /* The preprocessing can execute right away. */
1402 cycles = idesc->timing->units[unit_num].done;
1404 /* The post processing must wait if there is a dependency on a FR
1405 which is not ready yet. */
1406 ps = CPU_PROFILE_STATE (cpu);
1407 ps->post_wait = cycles;
1408 dual_FRi = DUAL_REG (in_FRi);
1409 dual_FRj = DUAL_REG (in_FRj);
1410 dual_FCCi_2 = out_FCCi_2 + 1;
1411 adjust_float_register_busy (cpu, in_FRi, 2, in_FRj, 2, -1, 1);
1412 vliw = CPU_VLIW (cpu);
1413 slot = vliw->next_slot - 1;
1414 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1415 post_wait_for_float (cpu, slot);
1416 post_wait_for_FR (cpu, in_FRi);
1417 post_wait_for_FR (cpu, in_FRj);
1418 post_wait_for_FR (cpu, dual_FRi);
1419 post_wait_for_FR (cpu, dual_FRj);
1420 post_wait_for_CCR (cpu, out_FCCi_2);
1421 post_wait_for_CCR (cpu, dual_FCCi_2);
1422 restore_float_register_busy (cpu, in_FRi, 2, in_FRj, 2, -1, 1);
1424 /* The latency of FCCi_2 will be the latency of the other inputs plus 3
1426 update_CCR_latency (cpu, out_FCCi_2, ps->post_wait + 3);
1427 update_CCR_latency (cpu, dual_FCCi_2, ps->post_wait + 3);
1429 set_use_is_ccr_complex (cpu, out_FCCi_2);
1430 if (dual_FCCi_2 >= 0)
1431 set_use_is_ccr_complex (cpu, dual_FCCi_2);
1433 /* the media point unit resource has a latency of 5 cycles */
1434 update_media_resource_latency (cpu, slot, cycles + 5);
1440 frvbf_model_fr550_u_float_convert (SIM_CPU *cpu, const IDESC *idesc,
1441 int unit_num, int referenced,
1442 INT in_FRj, INT in_FRintj, INT in_FRdoublej,
1443 INT out_FRk, INT out_FRintk,
1447 FRV_PROFILE_STATE *ps;
1451 if (model_insn == FRV_INSN_MODEL_PASS_1)
1454 /* The preprocessing can execute right away. */
1455 cycles = idesc->timing->units[unit_num].done;
1457 /* The post processing must wait if there is a dependency on a FR
1458 which is not ready yet. */
1459 ps = CPU_PROFILE_STATE (cpu);
1460 ps->post_wait = cycles;
1461 adjust_float_register_busy (cpu, -1, 1, in_FRj, 1, out_FRk, 1);
1462 adjust_float_register_busy (cpu, -1, 1, in_FRintj, 1, out_FRintk, 1);
1463 adjust_float_register_busy (cpu, -1, 1, in_FRdoublej, 2, out_FRdoublek, 2);
1464 vliw = CPU_VLIW (cpu);
1465 slot = vliw->next_slot - 1;
1466 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1467 post_wait_for_float (cpu, slot);
1468 post_wait_for_FR (cpu, in_FRj);
1469 post_wait_for_FR (cpu, in_FRintj);
1470 post_wait_for_FRdouble (cpu, in_FRdoublej);
1471 post_wait_for_FR (cpu, out_FRk);
1472 post_wait_for_FR (cpu, out_FRintk);
1473 post_wait_for_FRdouble (cpu, out_FRdoublek);
1474 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1476 post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRk));
1477 post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRintk));
1478 post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRdoublek));
1480 restore_float_register_busy (cpu, -1, 1, in_FRj, 1, out_FRk, 1);
1481 restore_float_register_busy (cpu, -1, 1, in_FRintj, 1, out_FRintk, 1);
1482 restore_float_register_busy (cpu, -1, 1, in_FRdoublej, 2, out_FRdoublek, 2);
1484 /* The latency of FRk will be at least the latency of the other inputs. */
1485 update_FR_latency (cpu, out_FRk, ps->post_wait);
1486 update_FR_latency (cpu, out_FRintk, ps->post_wait);
1487 update_FRdouble_latency (cpu, out_FRdoublek, ps->post_wait);
1489 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1491 update_SPR_latency (cpu, FNER_FOR_FR (out_FRk), ps->post_wait);
1492 update_SPR_latency (cpu, FNER_FOR_FR (out_FRintk), ps->post_wait);
1493 update_SPR_latency (cpu, FNER_FOR_FR (out_FRdoublek), ps->post_wait);
1496 /* Once initiated, post-processing will take 2 cycles. */
1497 update_FR_ptime (cpu, out_FRk, 2);
1498 update_FR_ptime (cpu, out_FRintk, 2);
1499 update_FRdouble_ptime (cpu, out_FRdoublek, 2);
1501 if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING))
1503 update_SPR_ptime (cpu, FNER_FOR_FR (out_FRk), 2);
1504 update_SPR_ptime (cpu, FNER_FOR_FR (out_FRintk), 2);
1505 update_SPR_ptime (cpu, FNER_FOR_FR (out_FRdoublek), 2);
1508 /* Mark this use of the register as a floating point op. */
1510 set_use_is_fr_complex_2 (cpu, out_FRk);
1511 if (out_FRintk >= 0)
1512 set_use_is_fr_complex_2 (cpu, out_FRintk);
1513 if (out_FRdoublek >= 0)
1515 set_use_is_fr_complex_2 (cpu, out_FRdoublek);
1516 set_use_is_fr_complex_2 (cpu, out_FRdoublek + 1);
1519 /* the media point unit resource has a latency of 4 cycles */
1520 update_media_resource_latency (cpu, slot, cycles + 4);
1526 frvbf_model_fr550_u_spr2gr (SIM_CPU *cpu, const IDESC *idesc,
1527 int unit_num, int referenced,
1528 INT in_spr, INT out_GRj)
1530 /* Modelling for this unit is the same as for fr500. */
1531 return frvbf_model_fr500_u_spr2gr (cpu, idesc, unit_num, referenced,
1536 frvbf_model_fr550_u_gr2spr (SIM_CPU *cpu, const IDESC *idesc,
1537 int unit_num, int referenced,
1538 INT in_GRj, INT out_spr)
1542 if (model_insn == FRV_INSN_MODEL_PASS_1)
1544 /* The entire VLIW insn must wait if there is a dependency on a register
1545 which is not ready yet. */
1546 vliw_wait_for_GR (cpu, in_GRj);
1547 vliw_wait_for_SPR (cpu, out_spr);
1548 handle_resource_wait (cpu);
1549 load_wait_for_GR (cpu, in_GRj);
1550 trace_vliw_wait_cycles (cpu);
1554 cycles = idesc->timing->units[unit_num].done;
1557 /* The latency of spr is ? cycles. */
1558 update_SPR_latency (cpu, out_spr, cycles + ?);
1565 frvbf_model_fr550_u_gr2fr (SIM_CPU *cpu, const IDESC *idesc,
1566 int unit_num, int referenced,
1567 INT in_GRj, INT out_FRk)
1571 if (model_insn == FRV_INSN_MODEL_PASS_1)
1573 /* The entire VLIW insn must wait if there is a dependency on a register
1574 which is not ready yet.
1575 The latency of the registers may be less than previously recorded,
1576 depending on how they were used previously.
1577 See Table 14-15 in the LSI. */
1578 adjust_float_register_busy (cpu, -1, 1, -1, 1, out_FRk, 1);
1579 vliw_wait_for_GR (cpu, in_GRj);
1580 vliw_wait_for_FR (cpu, out_FRk);
1581 handle_resource_wait (cpu);
1582 load_wait_for_GR (cpu, in_GRj);
1583 load_wait_for_FR (cpu, out_FRk);
1584 trace_vliw_wait_cycles (cpu);
1588 /* The latency of FRk is 1 cycles. */
1589 cycles = idesc->timing->units[unit_num].done;
1590 update_FR_latency (cpu, out_FRk, cycles + 1);
1592 set_use_is_fr_complex_1 (cpu, out_FRk);
1598 frvbf_model_fr550_u_swap (SIM_CPU *cpu, const IDESC *idesc,
1599 int unit_num, int referenced,
1600 INT in_GRi, INT in_GRj, INT out_GRk)
1604 if (model_insn == FRV_INSN_MODEL_PASS_1)
1606 /* The entire VLIW insn must wait if there is a dependency on a register
1607 which is not ready yet. */
1608 vliw_wait_for_GR (cpu, in_GRi);
1609 vliw_wait_for_GR (cpu, in_GRj);
1610 vliw_wait_for_GR (cpu, out_GRk);
1611 handle_resource_wait (cpu);
1612 load_wait_for_GR (cpu, in_GRi);
1613 load_wait_for_GR (cpu, in_GRj);
1614 load_wait_for_GR (cpu, out_GRk);
1615 trace_vliw_wait_cycles (cpu);
1619 cycles = idesc->timing->units[unit_num].done;
1621 /* The latency of GRk will depend on how long it takes to swap
1622 the the data from the cache or memory. */
1623 update_GR_latency_for_swap (cpu, out_GRk, cycles);
1629 frvbf_model_fr550_u_fr2fr (SIM_CPU *cpu, const IDESC *idesc,
1630 int unit_num, int referenced,
1631 INT in_FRj, INT out_FRk)
1635 if (model_insn == FRV_INSN_MODEL_PASS_1)
1637 /* The entire VLIW insn must wait if there is a dependency on a register
1638 which is not ready yet.
1639 The latency of the registers may be less than previously recorded,
1640 depending on how they were used previously.
1641 See Table 14-15 in the LSI. */
1642 adjust_float_register_busy (cpu, -1, 1, in_FRj, 1, out_FRk, 1);
1643 vliw_wait_for_FR (cpu, in_FRj);
1644 vliw_wait_for_FR (cpu, out_FRk);
1645 handle_resource_wait (cpu);
1646 load_wait_for_FR (cpu, in_FRj);
1647 load_wait_for_FR (cpu, out_FRk);
1648 trace_vliw_wait_cycles (cpu);
1652 /* The latency of FRj is 2 cycles. */
1653 cycles = idesc->timing->units[unit_num].done;
1654 update_FR_latency (cpu, out_FRk, cycles + 2);
1656 set_use_is_fr_complex_2 (cpu, out_FRk);
1662 frvbf_model_fr550_u_fr2gr (SIM_CPU *cpu, const IDESC *idesc,
1663 int unit_num, int referenced,
1664 INT in_FRk, INT out_GRj)
1668 if (model_insn == FRV_INSN_MODEL_PASS_1)
1670 /* The entire VLIW insn must wait if there is a dependency on a register
1671 which is not ready yet.
1672 The latency of the registers may be less than previously recorded,
1673 depending on how they were used previously.
1674 See Table 14-15 in the LSI. */
1675 adjust_float_register_busy (cpu, in_FRk, 1, -1, 1, -1, 1);
1676 vliw_wait_for_FR (cpu, in_FRk);
1677 vliw_wait_for_GR (cpu, out_GRj);
1678 handle_resource_wait (cpu);
1679 load_wait_for_FR (cpu, in_FRk);
1680 load_wait_for_GR (cpu, out_GRj);
1681 trace_vliw_wait_cycles (cpu);
1685 /* The latency of GRj is 1 cycle. */
1686 cycles = idesc->timing->units[unit_num].done;
1687 update_GR_latency (cpu, out_GRj, cycles + 1);
1693 frvbf_model_fr550_u_clrgr (SIM_CPU *cpu, const IDESC *idesc,
1694 int unit_num, int referenced,
1697 /* Modelling for this unit is the same as for fr500. */
1698 return frvbf_model_fr500_u_clrgr (cpu, idesc, unit_num, referenced, in_GRk);
1702 frvbf_model_fr550_u_clrfr (SIM_CPU *cpu, const IDESC *idesc,
1703 int unit_num, int referenced,
1706 /* Modelling for this unit is the same as for fr500. */
1707 return frvbf_model_fr500_u_clrfr (cpu, idesc, unit_num, referenced, in_FRk);
1711 frvbf_model_fr550_u_commit (SIM_CPU *cpu, const IDESC *idesc,
1712 int unit_num, int referenced,
1713 INT in_GRk, INT in_FRk)
1715 /* Modelling for this unit is the same as for fr500. */
1716 return frvbf_model_fr500_u_commit (cpu, idesc, unit_num, referenced,
1721 frvbf_model_fr550_u_media (SIM_CPU *cpu, const IDESC *idesc,
1722 int unit_num, int referenced,
1723 INT in_FRi, INT in_FRj, INT out_FRk)
1726 FRV_PROFILE_STATE *ps;
1730 if (model_insn == FRV_INSN_MODEL_PASS_1)
1733 /* The preprocessing can execute right away. */
1734 cycles = idesc->timing->units[unit_num].done;
1736 /* If the previous use of the registers was a media op,
1737 then their latency may be less than previously recorded.
1738 See Table 14-15 in the LSI. */
1739 adjust_float_register_busy_for_media (cpu, in_FRi, 1, in_FRj, 1, out_FRk, 1);
1741 /* The post processing must wait if there is a dependency on a FR
1742 which is not ready yet. */
1743 ps = CPU_PROFILE_STATE (cpu);
1744 ps->post_wait = cycles;
1745 vliw = CPU_VLIW (cpu);
1746 slot = vliw->next_slot - 1;
1747 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1748 post_wait_for_media (cpu, slot);
1749 post_wait_for_FR (cpu, in_FRi);
1750 post_wait_for_FR (cpu, in_FRj);
1751 post_wait_for_FR (cpu, out_FRk);
1753 /* Restore the busy cycles of the registers we used. */
1754 restore_float_register_busy_for_media (cpu, in_FRi, 1, in_FRj, 1, out_FRk, 1);
1756 /* The latency of tht output register will be at least the latency of the
1757 other inputs. Once initiated, post-processing will take 1 cycle. */
1760 update_FR_latency (cpu, out_FRk, ps->post_wait);
1761 update_FR_ptime (cpu, out_FRk, 1);
1762 /* Mark this use of the register as a media op. */
1763 set_use_is_fr_complex_1 (cpu, out_FRk);
1766 /* the floating point unit resource has a latency of 3 cycles */
1767 update_float_resource_latency (cpu, slot, cycles + 3);
1773 frvbf_model_fr550_u_media_quad (SIM_CPU *cpu, const IDESC *idesc,
1774 int unit_num, int referenced,
1775 INT in_FRi, INT in_FRj,
1782 FRV_PROFILE_STATE *ps;
1786 if (model_insn == FRV_INSN_MODEL_PASS_1)
1789 /* The preprocessing can execute right away. */
1790 cycles = idesc->timing->units[unit_num].done;
1792 dual_FRi = DUAL_REG (in_FRi);
1793 dual_FRj = DUAL_REG (in_FRj);
1794 dual_FRk = DUAL_REG (out_FRk);
1796 /* The latency of the registers may be less than previously recorded,
1797 depending on how they were used previously.
1798 See Table 14-15 in the LSI. */
1799 adjust_float_register_busy_for_media (cpu, in_FRi, 2, in_FRj, 2, out_FRk, 2);
1801 /* The post processing must wait if there is a dependency on a FR
1802 which is not ready yet. */
1803 ps = CPU_PROFILE_STATE (cpu);
1804 ps->post_wait = cycles;
1805 vliw = CPU_VLIW (cpu);
1806 slot = vliw->next_slot - 1;
1807 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1808 post_wait_for_media (cpu, slot);
1809 post_wait_for_FR (cpu, in_FRi);
1810 post_wait_for_FR (cpu, dual_FRi);
1811 post_wait_for_FR (cpu, in_FRj);
1812 post_wait_for_FR (cpu, dual_FRj);
1813 post_wait_for_FR (cpu, out_FRk);
1814 post_wait_for_FR (cpu, dual_FRk);
1816 /* Restore the busy cycles of the registers we used. */
1817 restore_float_register_busy_for_media (cpu, in_FRi, 2, in_FRj, 2, out_FRk, 2);
1819 /* The latency of the output register will be at least the latency of the
1820 other inputs. Once initiated, post-processing take 1 cycle. */
1821 update_FR_latency (cpu, out_FRk, ps->post_wait);
1822 update_FR_ptime (cpu, out_FRk, 1);
1823 set_use_is_fr_complex_1 (cpu, out_FRk);
1827 update_FR_latency (cpu, dual_FRk, ps->post_wait);
1828 update_FR_ptime (cpu, dual_FRk, 1);
1829 set_use_is_fr_complex_1 (cpu, dual_FRk);
1832 /* the floating point unit resource has a latency of 3 cycles */
1833 update_float_resource_latency (cpu, slot, cycles + 3);
1839 frvbf_model_fr550_u_media_dual_expand (SIM_CPU *cpu, const IDESC *idesc,
1840 int unit_num, int referenced,
1841 INT in_FRi, INT out_FRk)
1845 FRV_PROFILE_STATE *ps;
1849 if (model_insn == FRV_INSN_MODEL_PASS_1)
1852 /* The preprocessing can execute right away. */
1853 cycles = idesc->timing->units[unit_num].done;
1855 /* If the previous use of the registers was a media op,
1856 then their latency will be less than previously recorded.
1857 See Table 14-15 in the LSI. */
1858 dual_FRk = DUAL_REG (out_FRk);
1859 adjust_float_register_busy_for_media (cpu, in_FRi, 1, -1, 1, out_FRk, 2);
1861 /* The post processing must wait if there is a dependency on a FR
1862 which is not ready yet. */
1863 ps = CPU_PROFILE_STATE (cpu);
1864 ps->post_wait = cycles;
1865 vliw = CPU_VLIW (cpu);
1866 slot = vliw->next_slot - 1;
1867 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1868 post_wait_for_media (cpu, slot);
1869 post_wait_for_FR (cpu, in_FRi);
1870 post_wait_for_FR (cpu, out_FRk);
1871 post_wait_for_FR (cpu, dual_FRk);
1873 /* Restore the busy cycles of the registers we used. */
1874 restore_float_register_busy_for_media (cpu, in_FRi, 1, -1, 1, out_FRk, 2);
1876 /* The latency of the output register will be at least the latency of the
1877 other inputs. Once initiated, post-processing will take 1 cycle. */
1878 update_FR_latency (cpu, out_FRk, ps->post_wait);
1879 update_FR_ptime (cpu, out_FRk, 1);
1880 set_use_is_fr_complex_1 (cpu, out_FRk);
1884 update_FR_latency (cpu, dual_FRk, ps->post_wait);
1885 update_FR_ptime (cpu, dual_FRk, 1);
1886 set_use_is_fr_complex_1 (cpu, dual_FRk);
1889 /* the floating point unit resource has a latency of 3 cycles */
1890 update_float_resource_latency (cpu, slot, cycles + 3);
1896 frvbf_model_fr550_u_media_3_dual (SIM_CPU *cpu, const IDESC *idesc,
1897 int unit_num, int referenced,
1898 INT in_FRi, INT out_FRk)
1902 FRV_PROFILE_STATE *ps;
1906 if (model_insn == FRV_INSN_MODEL_PASS_1)
1909 /* The preprocessing can execute right away. */
1910 cycles = idesc->timing->units[unit_num].done;
1912 dual_FRi = DUAL_REG (in_FRi);
1914 /* The latency of the registers may be less than previously recorded,
1915 depending on how they were used previously.
1916 See Table 14-15 in the LSI. */
1917 adjust_float_register_busy_for_media (cpu, in_FRi, 2, -1, 1, out_FRk, 1);
1919 /* The post processing must wait if there is a dependency on a FR
1920 which is not ready yet. */
1921 ps = CPU_PROFILE_STATE (cpu);
1922 ps->post_wait = cycles;
1923 vliw = CPU_VLIW (cpu);
1924 slot = vliw->next_slot - 1;
1925 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1926 post_wait_for_media (cpu, slot);
1927 post_wait_for_FR (cpu, in_FRi);
1928 post_wait_for_FR (cpu, dual_FRi);
1929 post_wait_for_FR (cpu, out_FRk);
1931 /* Restore the busy cycles of the registers we used. */
1932 restore_float_register_busy_for_media (cpu, in_FRi, 2, -1, 1, out_FRk, 1);
1934 /* The latency of the output register will be at least the latency of the
1935 other inputs. Once initiated, post-processing takes 1 cycle. */
1936 update_FR_latency (cpu, out_FRk, ps->post_wait);
1937 update_FR_ptime (cpu, out_FRk, 1);
1939 set_use_is_fr_complex_1 (cpu, out_FRk);
1941 /* the floating point unit resource has a latency of 3 cycles */
1942 update_float_resource_latency (cpu, slot, cycles + 3);
1948 frvbf_model_fr550_u_media_3_acc (SIM_CPU *cpu, const IDESC *idesc,
1949 int unit_num, int referenced,
1950 INT in_FRj, INT in_ACC40Si,
1954 FRV_PROFILE_STATE *ps;
1958 if (model_insn == FRV_INSN_MODEL_PASS_1)
1961 /* The preprocessing can execute right away. */
1962 cycles = idesc->timing->units[unit_num].done;
1964 /* If the previous use of the registers was a media op,
1965 then their latency will be less than previously recorded.
1966 See Table 14-15 in the LSI. */
1967 adjust_float_register_busy_for_media (cpu, -1, 1, in_FRj, 1, out_FRk, 1);
1969 /* The post processing must wait if there is a dependency on a FR
1970 which is not ready yet. */
1971 ps = CPU_PROFILE_STATE (cpu);
1972 ps->post_wait = cycles;
1973 vliw = CPU_VLIW (cpu);
1974 slot = vliw->next_slot - 1;
1975 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
1976 post_wait_for_media (cpu, slot);
1977 post_wait_for_FR (cpu, in_FRj);
1978 post_wait_for_FR (cpu, out_FRk);
1979 post_wait_for_ACC (cpu, in_ACC40Si);
1981 /* Restore the busy cycles of the registers we used. */
1982 restore_float_register_busy_for_media (cpu, -1, 1, in_FRj, 1, out_FRk, 1);
1984 /* The latency of tht output register will be at least the latency of the
1985 other inputs. Once initiated, post-processing will take 1 cycle. */
1986 update_FR_latency (cpu, out_FRk, ps->post_wait);
1987 update_FR_ptime (cpu, out_FRk, 1);
1989 set_use_is_fr_complex_1 (cpu, out_FRk);
1991 /* the floating point unit resource has a latency of 3 cycles */
1992 update_float_resource_latency (cpu, slot, cycles + 3);
1998 frvbf_model_fr550_u_media_3_acc_dual (SIM_CPU *cpu, const IDESC *idesc,
1999 int unit_num, int referenced,
2000 INT in_ACC40Si, INT out_FRk)
2003 FRV_PROFILE_STATE *ps;
2009 if (model_insn == FRV_INSN_MODEL_PASS_1)
2012 /* The preprocessing can execute right away. */
2013 cycles = idesc->timing->units[unit_num].done;
2015 ACC40Si_1 = DUAL_REG (in_ACC40Si);
2016 dual_FRk = DUAL_REG (out_FRk);
2018 /* If the previous use of the registers was a media op,
2019 then their latency will be less than previously recorded.
2020 See Table 14-15 in the LSI. */
2021 adjust_float_register_busy_for_media (cpu, -1, 1, -1, 1, out_FRk, 2);
2023 /* The post processing must wait if there is a dependency on a FR
2024 which is not ready yet. */
2025 ps = CPU_PROFILE_STATE (cpu);
2026 ps->post_wait = cycles;
2027 vliw = CPU_VLIW (cpu);
2028 slot = vliw->next_slot - 1;
2029 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
2030 post_wait_for_media (cpu, slot);
2031 post_wait_for_ACC (cpu, in_ACC40Si);
2032 post_wait_for_ACC (cpu, ACC40Si_1);
2033 post_wait_for_FR (cpu, out_FRk);
2034 post_wait_for_FR (cpu, dual_FRk);
2036 /* Restore the busy cycles of the registers we used. */
2037 restore_float_register_busy_for_media (cpu, -1, 1, -1, 1, out_FRk, 2);
2039 /* The latency of the output register will be at least the latency of the
2040 other inputs. Once initiated, post-processing will take 1 cycle. */
2041 update_FR_latency (cpu, out_FRk, ps->post_wait);
2042 update_FR_ptime (cpu, out_FRk, 1);
2043 set_use_is_fr_complex_1 (cpu, out_FRk);
2046 update_FR_latency (cpu, dual_FRk, ps->post_wait);
2047 update_FR_ptime (cpu, dual_FRk, 1);
2048 set_use_is_fr_complex_1 (cpu, dual_FRk);
2051 /* the floating point unit resource has a latency of 3 cycles */
2052 update_float_resource_latency (cpu, slot, cycles + 3);
2058 frvbf_model_fr550_u_media_3_wtacc (SIM_CPU *cpu, const IDESC *idesc,
2059 int unit_num, int referenced,
2060 INT in_FRi, INT out_ACC40Sk)
2063 FRV_PROFILE_STATE *ps;
2067 if (model_insn == FRV_INSN_MODEL_PASS_1)
2070 /* The preprocessing can execute right away. */
2071 cycles = idesc->timing->units[unit_num].done;
2073 ps = CPU_PROFILE_STATE (cpu);
2075 /* The latency of the registers may be less than previously recorded,
2076 depending on how they were used previously.
2077 See Table 14-15 in the LSI. */
2078 adjust_float_register_busy_for_media (cpu, in_FRi, 1, -1, 1, -1, 1);
2080 /* The post processing must wait if there is a dependency on a FR
2081 which is not ready yet. */
2082 ps->post_wait = cycles;
2083 vliw = CPU_VLIW (cpu);
2084 slot = vliw->next_slot - 1;
2085 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
2086 post_wait_for_media (cpu, slot);
2087 post_wait_for_FR (cpu, in_FRi);
2088 post_wait_for_ACC (cpu, out_ACC40Sk);
2090 /* Restore the busy cycles of the registers we used. */
2091 restore_float_register_busy_for_media (cpu, in_FRi, 1, -1, 1, -1, 1);
2093 /* The latency of the output register will be at least the latency of the
2094 other inputs. Once initiated, post-processing will take 1 cycle. */
2095 update_ACC_latency (cpu, out_ACC40Sk, ps->post_wait);
2096 update_ACC_ptime (cpu, out_ACC40Sk, 1);
2097 set_use_is_acc_mmac (cpu, out_ACC40Sk);
2099 /* the floating point unit resource has a latency of 3 cycles */
2100 update_float_resource_latency (cpu, slot, cycles + 3);
2106 frvbf_model_fr550_u_media_3_mclracc (SIM_CPU *cpu, const IDESC *idesc,
2107 int unit_num, int referenced)
2110 FRV_PROFILE_STATE *ps;
2115 if (model_insn == FRV_INSN_MODEL_PASS_1)
2118 /* The preprocessing can execute right away. */
2119 cycles = idesc->timing->units[unit_num].done;
2121 ps = CPU_PROFILE_STATE (cpu);
2123 /* The post processing must wait if there is a dependency on a FR
2124 which is not ready yet. */
2125 ps->post_wait = cycles;
2126 vliw = CPU_VLIW (cpu);
2127 slot = vliw->next_slot - 1;
2128 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
2129 post_wait_for_media (cpu, slot);
2131 /* If A was 1 and the accumulator was ACC0, then we must check all
2132 accumulators. Otherwise just wait for the specified accumulator. */
2133 if (ps->mclracc_A && ps->mclracc_acc == 0)
2135 for (i = 0; i < 8; ++i)
2136 post_wait_for_ACC (cpu, i);
2139 post_wait_for_ACC (cpu, ps->mclracc_acc);
2141 /* The latency of the output registers will be at least the latency of the
2142 other inputs. Once initiated, post-processing will take 1 cycle. */
2143 if (ps->mclracc_A && ps->mclracc_acc == 0)
2145 for (i = 0; i < 8; ++i)
2147 update_ACC_latency (cpu, i, ps->post_wait);
2148 update_ACC_ptime (cpu, i, 1);
2149 set_use_is_acc_mmac (cpu, i);
2154 update_ACC_latency (cpu, ps->mclracc_acc, ps->post_wait);
2155 update_ACC_ptime (cpu, ps->mclracc_acc, 1);
2156 set_use_is_acc_mmac (cpu, ps->mclracc_acc);
2159 /* the floating point unit resource has a latency of 3 cycles */
2160 update_float_resource_latency (cpu, slot, cycles + 3);
2166 frvbf_model_fr550_u_media_set (SIM_CPU *cpu, const IDESC *idesc,
2167 int unit_num, int referenced,
2171 FRV_PROFILE_STATE *ps;
2175 if (model_insn == FRV_INSN_MODEL_PASS_1)
2178 /* The preprocessing can execute right away. */
2179 cycles = idesc->timing->units[unit_num].done;
2181 /* If the previous use of the registers was a media op,
2182 then their latency will be less than previously recorded.
2183 See Table 14-15 in the LSI. */
2184 adjust_float_register_busy_for_media (cpu, -1, 1, -1, 1, out_FRk, 1);
2186 /* The post processing must wait if there is a dependency on a FR
2187 which is not ready yet. */
2188 ps = CPU_PROFILE_STATE (cpu);
2189 ps->post_wait = cycles;
2190 vliw = CPU_VLIW (cpu);
2191 slot = vliw->next_slot - 1;
2192 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
2193 post_wait_for_media (cpu, slot);
2194 post_wait_for_FR (cpu, out_FRk);
2196 /* Restore the busy cycles of the registers we used. */
2197 restore_float_register_busy_for_media (cpu, -1, 1, -1, 1, out_FRk, 1);
2199 /* The latency of the output register will be at least the latency of the
2200 other inputs. Once initiated, post-processing takes 1 cycle. */
2201 update_FR_latency (cpu, out_FRk, ps->post_wait);
2202 update_FR_ptime (cpu, out_FRk, 1);
2203 fr550_reset_acc_flags (cpu, out_FRk);
2205 /* the floating point unit resource has a latency of 3 cycles */
2206 update_float_resource_latency (cpu, slot, cycles + 3);
2212 frvbf_model_fr550_u_media_4 (SIM_CPU *cpu, const IDESC *idesc,
2213 int unit_num, int referenced,
2214 INT in_FRi, INT in_FRj,
2215 INT out_ACC40Sk, INT out_ACC40Uk)
2220 FRV_PROFILE_STATE *ps;
2224 if (model_insn == FRV_INSN_MODEL_PASS_1)
2227 /* The preprocessing can execute right away. */
2228 cycles = idesc->timing->units[unit_num].done;
2230 ps = CPU_PROFILE_STATE (cpu);
2231 dual_ACC40Sk = DUAL_REG (out_ACC40Sk);
2232 dual_ACC40Uk = DUAL_REG (out_ACC40Uk);
2234 /* The latency of the registers may be less than previously recorded,
2235 depending on how they were used previously.
2236 See Table 14-15 in the LSI. */
2237 adjust_acc_busy_for_mmac (cpu, -1, 1, out_ACC40Sk, 2);
2238 adjust_acc_busy_for_mmac (cpu, -1, 1, out_ACC40Uk, 2);
2240 /* The post processing must wait if there is a dependency on a FR
2241 which is not ready yet. */
2242 ps->post_wait = cycles;
2243 vliw = CPU_VLIW (cpu);
2244 slot = vliw->next_slot - 1;
2245 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
2246 post_wait_for_media (cpu, slot);
2247 post_wait_for_FR (cpu, in_FRi);
2248 post_wait_for_FR (cpu, in_FRj);
2249 post_wait_for_ACC (cpu, out_ACC40Sk);
2250 post_wait_for_ACC (cpu, dual_ACC40Sk);
2251 post_wait_for_ACC (cpu, out_ACC40Uk);
2252 post_wait_for_ACC (cpu, dual_ACC40Uk);
2254 /* Restore the busy cycles of the registers we used. */
2255 restore_acc_busy_for_mmac (cpu, -1, 1, out_ACC40Sk, 2);
2256 restore_acc_busy_for_mmac (cpu, -1, 1, out_ACC40Uk, 2);
2258 /* The latency of the output register will be at least the latency of the
2259 other inputs. Once initiated, post-processing will take 1 cycles. */
2260 if (out_ACC40Sk >= 0)
2262 update_ACC_latency (cpu, out_ACC40Sk, ps->post_wait + 1);
2263 set_use_is_acc_mmac (cpu, out_ACC40Sk);
2265 if (dual_ACC40Sk >= 0)
2267 update_ACC_latency (cpu, dual_ACC40Sk, ps->post_wait + 1);
2268 set_use_is_acc_mmac (cpu, dual_ACC40Sk);
2270 if (out_ACC40Uk >= 0)
2272 update_ACC_latency (cpu, out_ACC40Uk, ps->post_wait + 1);
2273 set_use_is_acc_mmac (cpu, out_ACC40Uk);
2275 if (dual_ACC40Uk >= 0)
2277 update_ACC_latency (cpu, dual_ACC40Uk, ps->post_wait + 1);
2278 set_use_is_acc_mmac (cpu, dual_ACC40Uk);
2281 /* the floating point unit resource has a latency of 3 cycles */
2282 update_float_resource_latency (cpu, slot, cycles + 3);
2288 frvbf_model_fr550_u_media_4_acc (SIM_CPU *cpu, const IDESC *idesc,
2289 int unit_num, int referenced,
2290 INT in_ACC40Si, INT out_ACC40Sk)
2294 FRV_PROFILE_STATE *ps;
2298 if (model_insn == FRV_INSN_MODEL_PASS_1)
2301 /* The preprocessing can execute right away. */
2302 cycles = idesc->timing->units[unit_num].done;
2304 ACC40Si_1 = DUAL_REG (in_ACC40Si);
2306 ps = CPU_PROFILE_STATE (cpu);
2307 /* The latency of the registers may be less than previously recorded,
2308 depending on how they were used previously.
2309 See Table 14-15 in the LSI. */
2310 adjust_acc_busy_for_mmac (cpu, in_ACC40Si, 2, out_ACC40Sk, 1);
2312 /* The post processing must wait if there is a dependency on a register
2313 which is not ready yet. */
2314 ps->post_wait = cycles;
2315 vliw = CPU_VLIW (cpu);
2316 slot = vliw->next_slot - 1;
2317 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
2318 post_wait_for_media (cpu, slot);
2319 post_wait_for_ACC (cpu, in_ACC40Si);
2320 post_wait_for_ACC (cpu, ACC40Si_1);
2321 post_wait_for_ACC (cpu, out_ACC40Sk);
2323 /* Restore the busy cycles of the registers we used. */
2324 restore_acc_busy_for_mmac (cpu, in_ACC40Si, 2, out_ACC40Sk, 1);
2326 /* The latency of the output register will be at least the latency of the
2327 other inputs. Once initiated, post-processing will take 1 cycle. */
2328 update_ACC_latency (cpu, out_ACC40Sk, ps->post_wait + 1);
2329 set_use_is_acc_mmac (cpu, out_ACC40Sk);
2331 /* the floating point unit resource has a latency of 3 cycles */
2332 update_float_resource_latency (cpu, slot, cycles + 3);
2338 frvbf_model_fr550_u_media_4_acc_dual (SIM_CPU *cpu, const IDESC *idesc,
2339 int unit_num, int referenced,
2340 INT in_ACC40Si, INT out_ACC40Sk)
2347 FRV_PROFILE_STATE *ps;
2351 if (model_insn == FRV_INSN_MODEL_PASS_1)
2354 /* The preprocessing can execute right away. */
2355 cycles = idesc->timing->units[unit_num].done;
2357 ACC40Si_1 = DUAL_REG (in_ACC40Si);
2358 ACC40Si_2 = DUAL_REG (ACC40Si_1);
2359 ACC40Si_3 = DUAL_REG (ACC40Si_2);
2360 ACC40Sk_1 = DUAL_REG (out_ACC40Sk);
2362 ps = CPU_PROFILE_STATE (cpu);
2363 /* The latency of the registers may be less than previously recorded,
2364 depending on how they were used previously.
2365 See Table 14-15 in the LSI. */
2366 adjust_acc_busy_for_mmac (cpu, in_ACC40Si, 4, out_ACC40Sk, 2);
2368 /* The post processing must wait if there is a dependency on a register
2369 which is not ready yet. */
2370 ps->post_wait = cycles;
2371 vliw = CPU_VLIW (cpu);
2372 slot = vliw->next_slot - 1;
2373 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
2374 post_wait_for_media (cpu, slot);
2375 post_wait_for_ACC (cpu, in_ACC40Si);
2376 post_wait_for_ACC (cpu, ACC40Si_1);
2377 post_wait_for_ACC (cpu, ACC40Si_2);
2378 post_wait_for_ACC (cpu, ACC40Si_3);
2379 post_wait_for_ACC (cpu, out_ACC40Sk);
2380 post_wait_for_ACC (cpu, ACC40Sk_1);
2382 /* Restore the busy cycles of the registers we used. */
2383 restore_acc_busy_for_mmac (cpu, in_ACC40Si, 4, out_ACC40Sk, 2);
2385 /* The latency of the output register will be at least the latency of the
2386 other inputs. Once initiated, post-processing will take 1 cycle. */
2387 update_ACC_latency (cpu, out_ACC40Sk, ps->post_wait + 1);
2388 set_use_is_acc_mmac (cpu, out_ACC40Sk);
2391 update_ACC_latency (cpu, ACC40Sk_1, ps->post_wait + 1);
2392 set_use_is_acc_mmac (cpu, ACC40Sk_1);
2395 /* the floating point unit resource has a latency of 3 cycles */
2396 update_float_resource_latency (cpu, slot, cycles + 3);
2402 frvbf_model_fr550_u_media_4_add_sub (SIM_CPU *cpu, const IDESC *idesc,
2403 int unit_num, int referenced,
2404 INT in_ACC40Si, INT out_ACC40Sk)
2409 FRV_PROFILE_STATE *ps;
2413 if (model_insn == FRV_INSN_MODEL_PASS_1)
2416 /* The preprocessing can execute right away. */
2417 cycles = idesc->timing->units[unit_num].done;
2419 ACC40Si_1 = DUAL_REG (in_ACC40Si);
2420 ACC40Sk_1 = DUAL_REG (out_ACC40Sk);
2422 ps = CPU_PROFILE_STATE (cpu);
2423 /* The latency of the registers may be less than previously recorded,
2424 depending on how they were used previously.
2425 See Table 14-15 in the LSI. */
2426 adjust_acc_busy_for_mmac (cpu, in_ACC40Si, 2, out_ACC40Sk, 2);
2428 /* The post processing must wait if there is a dependency on a register
2429 which is not ready yet. */
2430 ps->post_wait = cycles;
2431 vliw = CPU_VLIW (cpu);
2432 slot = vliw->next_slot - 1;
2433 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
2434 post_wait_for_media (cpu, slot);
2435 post_wait_for_ACC (cpu, in_ACC40Si);
2436 post_wait_for_ACC (cpu, ACC40Si_1);
2437 post_wait_for_ACC (cpu, out_ACC40Sk);
2438 post_wait_for_ACC (cpu, ACC40Sk_1);
2440 /* Restore the busy cycles of the registers we used. */
2441 restore_acc_busy_for_mmac (cpu, in_ACC40Si, 2, out_ACC40Sk, 2);
2443 /* The latency of the output register will be at least the latency of the
2444 other inputs. Once initiated, post-processing will take 1 cycle. */
2445 update_ACC_latency (cpu, out_ACC40Sk, ps->post_wait + 1);
2446 set_use_is_acc_mmac (cpu, out_ACC40Sk);
2449 update_ACC_latency (cpu, ACC40Sk_1, ps->post_wait + 1);
2450 set_use_is_acc_mmac (cpu, ACC40Sk_1);
2453 /* the floating point unit resource has a latency of 3 cycles */
2454 update_float_resource_latency (cpu, slot, cycles + 3);
2460 frvbf_model_fr550_u_media_4_add_sub_dual (SIM_CPU *cpu, const IDESC *idesc,
2461 int unit_num, int referenced,
2462 INT in_ACC40Si, INT out_ACC40Sk)
2471 FRV_PROFILE_STATE *ps;
2475 if (model_insn == FRV_INSN_MODEL_PASS_1)
2478 /* The preprocessing can execute right away. */
2479 cycles = idesc->timing->units[unit_num].done;
2481 ACC40Si_1 = DUAL_REG (in_ACC40Si);
2482 ACC40Si_2 = DUAL_REG (ACC40Si_1);
2483 ACC40Si_3 = DUAL_REG (ACC40Si_2);
2484 ACC40Sk_1 = DUAL_REG (out_ACC40Sk);
2485 ACC40Sk_2 = DUAL_REG (ACC40Sk_1);
2486 ACC40Sk_3 = DUAL_REG (ACC40Sk_2);
2488 ps = CPU_PROFILE_STATE (cpu);
2489 /* The latency of the registers may be less than previously recorded,
2490 depending on how they were used previously.
2491 See Table 14-15 in the LSI. */
2492 adjust_acc_busy_for_mmac (cpu, in_ACC40Si, 4, out_ACC40Sk, 4);
2494 /* The post processing must wait if there is a dependency on a register
2495 which is not ready yet. */
2496 ps->post_wait = cycles;
2497 vliw = CPU_VLIW (cpu);
2498 slot = vliw->next_slot - 1;
2499 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
2500 post_wait_for_media (cpu, slot);
2501 post_wait_for_ACC (cpu, in_ACC40Si);
2502 post_wait_for_ACC (cpu, ACC40Si_1);
2503 post_wait_for_ACC (cpu, ACC40Si_2);
2504 post_wait_for_ACC (cpu, ACC40Si_3);
2505 post_wait_for_ACC (cpu, out_ACC40Sk);
2506 post_wait_for_ACC (cpu, ACC40Sk_1);
2507 post_wait_for_ACC (cpu, ACC40Sk_2);
2508 post_wait_for_ACC (cpu, ACC40Sk_3);
2510 /* Restore the busy cycles of the registers we used. */
2511 restore_acc_busy_for_mmac (cpu, in_ACC40Si, 4, out_ACC40Sk, 4);
2513 /* The latency of the output register will be at least the latency of the
2514 other inputs. Once initiated, post-processing will take 1 cycle. */
2515 update_ACC_latency (cpu, out_ACC40Sk, ps->post_wait + 1);
2516 set_use_is_acc_mmac (cpu, out_ACC40Sk);
2519 update_ACC_latency (cpu, ACC40Sk_1, ps->post_wait + 1);
2520 set_use_is_acc_mmac (cpu, ACC40Sk_1);
2524 update_ACC_latency (cpu, ACC40Sk_2, ps->post_wait + 1);
2525 set_use_is_acc_mmac (cpu, ACC40Sk_2);
2529 update_ACC_latency (cpu, ACC40Sk_3, ps->post_wait + 1);
2530 set_use_is_acc_mmac (cpu, ACC40Sk_3);
2533 /* the floating point unit resource has a latency of 3 cycles */
2534 update_float_resource_latency (cpu, slot, cycles + 3);
2540 frvbf_model_fr550_u_media_4_quad (SIM_CPU *cpu, const IDESC *idesc,
2541 int unit_num, int referenced,
2542 INT in_FRi, INT in_FRj,
2543 INT out_ACC40Sk, INT out_ACC40Uk)
2554 FRV_PROFILE_STATE *ps;
2558 if (model_insn == FRV_INSN_MODEL_PASS_1)
2561 /* The preprocessing can execute right away. */
2562 cycles = idesc->timing->units[unit_num].done;
2564 dual_FRi = DUAL_REG (in_FRi);
2565 dual_FRj = DUAL_REG (in_FRj);
2566 ACC40Sk_1 = DUAL_REG (out_ACC40Sk);
2567 ACC40Sk_2 = DUAL_REG (ACC40Sk_1);
2568 ACC40Sk_3 = DUAL_REG (ACC40Sk_2);
2569 ACC40Uk_1 = DUAL_REG (out_ACC40Uk);
2570 ACC40Uk_2 = DUAL_REG (ACC40Uk_1);
2571 ACC40Uk_3 = DUAL_REG (ACC40Uk_2);
2573 ps = CPU_PROFILE_STATE (cpu);
2574 /* The latency of the registers may be less than previously recorded,
2575 depending on how they were used previously.
2576 See Table 14-15 in the LSI. */
2577 adjust_float_register_busy_for_media (cpu, in_FRi, 2, in_FRj, 2, -1, 1);
2578 adjust_acc_busy_for_mmac (cpu, -1, 1, out_ACC40Sk, 4);
2579 adjust_acc_busy_for_mmac (cpu, -1, 1, out_ACC40Uk, 4);
2581 /* The post processing must wait if there is a dependency on a FR
2582 which is not ready yet. */
2583 ps->post_wait = cycles;
2584 vliw = CPU_VLIW (cpu);
2585 slot = vliw->next_slot - 1;
2586 slot = (*vliw->current_vliw)[slot] - UNIT_FM0;
2587 post_wait_for_media (cpu, slot);
2588 post_wait_for_FR (cpu, in_FRi);
2589 post_wait_for_FR (cpu, dual_FRi);
2590 post_wait_for_FR (cpu, in_FRj);
2591 post_wait_for_FR (cpu, dual_FRj);
2592 post_wait_for_ACC (cpu, out_ACC40Sk);
2593 post_wait_for_ACC (cpu, ACC40Sk_1);
2594 post_wait_for_ACC (cpu, ACC40Sk_2);
2595 post_wait_for_ACC (cpu, ACC40Sk_3);
2596 post_wait_for_ACC (cpu, out_ACC40Uk);
2597 post_wait_for_ACC (cpu, ACC40Uk_1);
2598 post_wait_for_ACC (cpu, ACC40Uk_2);
2599 post_wait_for_ACC (cpu, ACC40Uk_3);
2601 /* Restore the busy cycles of the registers we used. */
2602 restore_float_register_busy_for_media (cpu, in_FRi, 2, in_FRj, 2, -1, 1);
2603 restore_acc_busy_for_mmac (cpu, -1, 1, out_ACC40Sk, 4);
2604 restore_acc_busy_for_mmac (cpu, -1, 1, out_ACC40Uk, 4);
2606 /* The latency of the output register will be at least the latency of the
2607 other inputs. Once initiated, post-processing will take 1 cycle. */
2608 if (out_ACC40Sk >= 0)
2610 update_ACC_latency (cpu, out_ACC40Sk, ps->post_wait + 1);
2612 set_use_is_acc_mmac (cpu, out_ACC40Sk);
2615 update_ACC_latency (cpu, ACC40Sk_1, ps->post_wait + 1);
2617 set_use_is_acc_mmac (cpu, ACC40Sk_1);
2621 update_ACC_latency (cpu, ACC40Sk_2, ps->post_wait + 1);
2623 set_use_is_acc_mmac (cpu, ACC40Sk_2);
2627 update_ACC_latency (cpu, ACC40Sk_3, ps->post_wait + 1);
2629 set_use_is_acc_mmac (cpu, ACC40Sk_3);
2632 else if (out_ACC40Uk >= 0)
2634 update_ACC_latency (cpu, out_ACC40Uk, ps->post_wait + 1);
2636 set_use_is_acc_mmac (cpu, out_ACC40Uk);
2639 update_ACC_latency (cpu, ACC40Uk_1, ps->post_wait + 1);
2641 set_use_is_acc_mmac (cpu, ACC40Uk_1);
2645 update_ACC_latency (cpu, ACC40Uk_2, ps->post_wait + 1);
2647 set_use_is_acc_mmac (cpu, ACC40Uk_2);
2651 update_ACC_latency (cpu, ACC40Uk_3, ps->post_wait + 1);
2653 set_use_is_acc_mmac (cpu, ACC40Uk_3);
2657 /* the floating point unit resource has a latency of 3 cycles */
2658 update_float_resource_latency (cpu, slot, cycles + 3);
2663 #endif /* WITH_PROFILE_MODEL_P */