Thanks Eli. Somehow I was assuming the scheduler would insert NOPs to enforce latencies<div>The CPU I'm dealing with doesn't automatically stall, i.e. latency must be ensured by the program. </div><div>As an alternative to a pass, is it feasible to modify the scheduler to do so (optionally) or it would be too complicated.</div>

<div>If possible, what would be the right place to look ?</div><div><br></div><div>Thanks so much</div><div>Miguel</div><div><br><br><div class="gmail_quote">On Tue, Aug 16, 2011 at 3:54 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Mon, Aug 15, 2011 at 4:03 PM, Miguel G <<a href="mailto:miguel@esenciatech.com">miguel@esenciatech.com</a>> wrote:<br>


> Hi everyone<br>
> I'm fairly new with LLVM and I've been searching around but couldn't find<br>
> info on this subject.<br>
> I started working on a target for a new cpu and I realizing my initial<br>
> simple understanding of instruction itineraries may be completely off.<br>
> I'm trying to model a CPU that has a latency of 2 cycles for multiplications<br>
> fully pipelined (so it can start a new one after one cycle)<br>
> First of all, is there a document that describes the instruction itinerary<br>
> model in some detail ?<br>
> For example looking at MBlaze target MBlaeSchedule.td I can see something<br>
> like<br>
> MblazeSchedule.td<br>
> ...<br>
> def IIImul             : InstrItinClass;<br>
> ...<br>
>   InstrItinData<IIImul             , [InstrStage<17, [IMULDIV]>]>,<br>
><br>
> Does that mean Mul's are expected to have a latency of 17 clks ? Mips target<br>
> has something similar.<br>
<br>
</div>Yes.<br>
<div class="im"><br>
> In Mblaze case I can see the result being used the very next cycle<br>
>         mul       r3, r6, r5<br>
>         addik     r3, r3, 4<br>
> similarly for my target (instead of 17 I'm specifying 2 above) and for Mips<br>
> I get the same result. Same for loads where I'm also specifying a larger<br>
> latency<br>
<br>
</div>Specifying a schedule doesn't really do anything if there isn't<br>
anything which can be scheduled between the two instructions.<br>
<div class="im"><br>
> What would be the right way to specify a latency of 2 with 1 clk initiation<br>
> interval for instance<br>
<br>
</div>If you need to insert NOP's between certain instructions, you should<br>
use a separate pass to do that.  See MipsDelaySlotFiller.cpp for an<br>
example of such a pass.<br>
<font color="#888888"><br>
-Eli<br>
</font></blockquote></div><br></div>