tcg-mips: Rearrange register allocation

Use FP (also known as S8) as a normal call-saved register.

Include T0 in the allocation order and call-clobbered list
even though it's currently used as a TCG temporary.

Put the argument registers at the end of the allocation order.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Introduce TCG_TMP0,1

Use these instead of hard-coding the registers to use for temporaries.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Use T9 for TCG_TMP1

T0 is an argument register for the n32 and n64 abis.  T9 is the call
address register for the abis, and is more directly under the control
of the backend.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Use EXT for AND on mips32r2

At the same time, tidy deposit by introducing tcg_out_opc_bf.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Name the opcode enumeration

And use it in the opcode emission functions.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Fix subtract immediate range

Since we must use ADDUI, we would generate incorrect code for -32768,
and fail to accept subtract of +32768.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Hoist args loads

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Commonize opcode implementations

Most opcodes fall in to one of a couple of patterns.
Trade code space for data space and combine them.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Add mips64 opcodes

Since the mips manual tables are in octal, reorg all of the opcodes
into that format for clarity.  Note that the 64-bit opcodes are as
yet unused.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Support 64-bit opcodes

Bulk patch adding 64-bit opcodes into tcg_out_op.  Note that
mips64 is as yet neither complete nor enabled.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Adjust move functions for mips64

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Adjust load/store functions for mips64

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Adjust prologue for mips64

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Adjust qemu_ld/st slow paths for mips64

At the same time, change the helpers to return the next parameter
index, rather than writing into a pointer.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Adjust calling conventions for mips64

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Adjust qemu_ld/st for mips64

At the same time, use extract in the tlb_load for mips32r2.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Simplify setcond

Use a table to fold comparisons to less-than.
Also, move the function up in the file for futher simplifications.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Simplify brcond

Use the same table to fold comparisons as with setcond.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Simplify setcond2

Using tcg_unsigned_cond and tcg_high_cond.
Also, move the function up in the file for future cleanups.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Improve setcond eq/ne vs zeros

The original code results in one too many insns per zero
present in the input.  And since comparing 64-bit numbers
vs zero is common...

Signed-off-by: Richard Henderson <rth@twiddle.net>