H. J. Lu wrote:
If an instruction has latency 3 and throughput 1, should I write it as
(define_insn_reservation "simple" 3
(eq_attr "memory" "none")
"p0")
or
(define_insn_reservation "simple" 3
(eq_attr "memory" "none")
"p0,nothing*2")
Are they equivalent?
Yes.
What happens when there are fewer reservation
cycles than default latency?
They are different things. Latency is used for finding data ready
delays (priorities used to order insns according their critical path
length). When input data are ready for an insn, the reservations are
checked to find that there are enough functional units to execute the
insn. So there is no correlation between latency time and reservations
with the compiler point of view.
Frequently, reservation is shorter than the latency because after a few
cycles there will be never reservation hazards because further execution
is fully pipelined (in other words we always have enough functional
units for the further execution). In this case we can omit reservation
of the corresponding functional units. Latency time less than the
reservation length is also permitted but usually it has no sense
(although we can describe all execution pipeline stages like prefetching
and decoding. Latency times usually are given only for actual operation
execution without such stages).
Vlad