问题的关键是 SPU 有几个条件指令,例如 selb、 shufb 和位操作,它们可以不用分支就能实现条件操作。
The key is that the SPU has several conditional instructions, such as selb, shufb, and the bit operations, which allow conditional operations to occur without branching.
例如,如果一个条件标上了“likely”,那么编译器可以把代码的True部分直接放在分支指令后面(这样就不需要执行分支指令)。
For example, if the conditional is marked "likely" then the compiler can place the True portion of the code immediately following the branch (which will not be taken).
本文基于ARM 9tdmi内核,从指令调整、寄存器分配、条件分支和循环结构等方面对汇编代码的优化方法进行了详细的论述。
This article gives a detail discussion on the assembled code optimization from instruction arrangement, register division, condition selection branch and cycle structure based on the core of ARM9TDMI.
应用推荐