tcg: Tidy generated code for tcg_outN

Aliasing was forcing s->code_ptr to be re-read after the store.
Keep the pointer in a local variable to help the compiler.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg: Add muluh and mulsh opcodes

Use them in places where mulu2 and muls2 are used.
Optimize mulx2 with dead low part to mulxh.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-mips: Implement mulsh, muluh

With the optimization in tcg_liveness_analysis,
we can avoid the MFLO when it is unused.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-ppc64: Implement muluh, mulsh

Using these instead of mulu2 and muls2 lets us avoid having to argument
overlap analysis in the backend.  Normal register allocation will DTRT.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg: Constant fold div, rem

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Set ext based on TCG_OPF_64BIT

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Change all ext variables to bool

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Don't handle mov/movi in tcg_out_op

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Hoist common argument loads in tcg_out_op

This reduces the code size of the function significantly.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Change enum aarch64_arith_opc to AArch64Insn

And since we're no longer talking about opcodes, change the
values to be shifted into the opcode field, avoiding a shift
at runtime.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Merge enum aarch64_srr_opc with AArch64Insn

And since we're no longer talking about opcodes, merge the 0x1ac02000
data2 primary opcode with the shift subcode to create the full insn.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Introduce tcg_fmt_* functions

Now that we've converted opcode fields to pre-shifted insns, we
can merge the implementation of arithmetic and shift insns.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Introduce tcg_fmt_Rdn_aimm

This merges the implementation of tcg_out_addi and tcg_out_subi.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Implement mov with tcg_fmt_* functions

Avoid the magic numbers in the current implementation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Handle constant operands to add, sub, and compare

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Handle constant operands to and, or, xor

Handle a simplified set of logical immediates for the moment.

The way gcc and binutils do it, with 52k worth of tables, and
a binary search depth of log2(5334) = 13, seems slow for the
most common cases.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Support andc, orc, eqv, not

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Handle zero as first argument to sub

In order to properly handle neg, as generated by TCG generic code.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Support movcond

Also tidy the implementation of setcond in order to share code.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg-aarch64: Support deposit

Also tidy the implementation of ubfm, sbfm, extr in order to share code.

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