Another, possibly simpler way to do this is to use a table of bits, and then you can reference it directly. For instance:
BITFLAGS DATA >0001,>0002,>0004,>0008
then anywhere you need them:
(where the +6 is because you wanted bit 3). It costs you 32 bytes for the table, but you could only store the flags you actually use. The test itself is one instruction, and while it'll be slower than the TB, not by much. (Especially if you can get the table into scratchpad, though I would not do that unless you do a LOT of bit tests). Still costs 6 bytes, though. You can make it four bytes by keeping FLAGS in a dedicated register, though -- with 15 GP registers that's more possible than on some machines.
Edited by Tursi, Sat Feb 4, 2012 5:40 AM.