[llvm-dev] Hexagon and choosing of slots

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 23 11:02:59 PST 2015


On 11/23/2015 12:26 PM, Rail Shafigulin via llvm-dev wrote:
> I'm curious how does hexagon hardware decide which slot to use for a
> given instruction? Is there special hardware to make that decision? I'm
> asking because I didn't see any information about which slot to use for
> a given packet. Is it even possible to pass this kind of information
> through assembly? Say hardware sees a packet and the packet tells it
> which slot to use.

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.

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
   addr:    slot3
   addr+4:  slot2
   addr+8:  slot1
   addr+12: slot0
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:
   addr:    slot2
   addr+4:  slot0
is ok, but
   addr:    slot1
   addr+4:  slot0
is not.

There are also bits in each encoding word that indicate the end of the 
packet: those must also be set properly by the compiler.

-Krzysztof

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation


More information about the llvm-dev mailing list