unsigned int tbl; __asm__("mftbl %0" : "=r" (tbl));
[side note: mftbl is not a PowerPC insn, nor an assembler extended mnemonic. I have no idea why libopcodes accepts it].
I'm wondering why it's wasting a register.
Did you compile with optimization on? If so, what compiler version did you use? I tried with 3.4.1 and it works just fine. If you still have problems, please show the exact code (full routine, compilable as-is).
Am I specifying the constraint incorrectly?
No, it's fine.
Segher