<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></span>
On Hexagon, the slot assignment is determined by the layout of the instructions in memory.  The order of the instructions in the packet does not matter either in the IR, nor in the .s file, but it does when the packet is encoded into the actual machine code.  In LLVM, the Hexagon shuffler orders the instructions just prior to encoding.<br>
<br>
Specifically, the instructions in the packet are encoded "in reverse", i.e. the instruction that will go to the highest slot will be encoded first, then the instruction that will go to the second highest slot, etc.  In case of a packet with 4 instructions, it will be<br>
  addr:    slot3<br>
  addr+4:  slot2<br>
  addr+8:  slot1<br>
  addr+12: slot0<br>
Not all slots have to be occupied. If they are not, the hardware will assign the slots based on the instruction, but within a packet the slots must be in a decreasing order.  For example:<br>
  addr:    slot2<br>
  addr+4:  slot0<br>
is ok, but<br>
  addr:    slot1<br>
  addr+4:  slot0<br>
is not.<br>
<br>
There are also bits in each encoding word that indicate the end of the packet: those must also be set properly by the compiler.<span class="HOEnZb"><font color="#888888"><br>
<br>
-Krzysztof<br>
<br>
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</font></span></blockquote></div><br>Would you mind pointing me to the source code where actual shuffling occurs. I looked through lib/Target/Hexagon but was not able to find it. Is shuffling now part of a core code?</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks,<br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>R</div></div></div></div></div>
</div></div>