x86 decoding of multi-uop instructions

时间:2016-04-25 09:40:32

标签: performance x86 micro-optimization

Agner Fog in his microarch.pdf says:

Decoding becomes more efficient because an instruction that generates one fused μop can go into any of the three decoders while an instruction that generates two μops can go only to decoder D0.

I know that the decoders take x86 machine code as input (like the assembler output from mov eax, eax), and produce micro-ops as output.

How is it determined which decoder should decodes particular instruction before decoding? Maybe pre-decoders?

1 个答案:

答案 0 :(得分:2)

Agner的microarch PDF解释了解码,以及多uop指令会发生什么。

如果多uop指令不是正被解码的块中的第一个insn,则解码在该insn处结束。在下一个周期中,解码从多ump insn开始,因此它将触及可以处理多uop指令的复杂解码器。

这就是3-1-3-1重复模式比3-3-1-1重复模式解码的原因。

预解码器仅标记指令长度/边界。他们还不知道哪些insn会解码为多个uops。这需要实际解码指令,因此无法将指令流混洗以将复杂指令发送到复杂解码器。

这就是当您在解码器上遇到瓶颈时,指令排序很重要的原因。对于具有uop缓存的CPU,解码性能通常不重要。如果是,则存在代码大小问题。很有可能,代码运行得足够频繁,因为它的性能很重要,但很少见,因为它不会在uop缓存中变热。

相关问题