[LLVMdev] another mips16 puzzle
reed kotler
rkotler at mips.com
Tue Aug 7 19:08:40 PDT 2012
i'm trying to formulate the optimal way to do comparison testing for
mips 16.
on mips32 there are no condition codes.
you can test a<b and place the result in a register in mip32.
on mips16 you can do the same, however, the register is always T8==24.
T8 is not directly accessible by most mips16 instructions, but can be
directly
moved to a generally accessible mips16 register, and can also used in
tests for a conditional
branch.
later you can conditionally branch based on this register
it's possible for me to make a pseudo instruction which needs a virtual
register and always do something like:
T8 = a < b; VR = T8;
But that can be very inefficient.
if (a < b) ...
Does not need a virtual register since the condition branch is going to
implicitly use T8.
Also, there is the problem of spilling T8.
Spilling these non directly accessible mips16 registers presents a
problem because you need to move them to a generally accessible register
first in order to do that.
Then there is the possibility of
b = a < b;
if (b)....
....
if (b) ...
possibly never storing b and just keep testing against T8.
More information about the llvm-dev
mailing list