target-i386: Push DisasContext into load/store helpers

Rather than add s->mem_index into a combined size+mem_index
argument, pass the context down.  This will allow cleaning
up s->mem_index later.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Stop encoding DisasContext.mem_index

Now that we don't combine mem_index with operand size info,
we don't need to encode it.  Which tidies many places that
access it.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Use new tcg_gen_qemu_ld_* helpers

In preference to the older helpers.  Loads only in this patch.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Use new tcg_gen_qemu_st_* helpers

In preference to the older helpers.  Stores only in this patch.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Replace OT_* constants with MO_* constants

The MO_8/16/32/64 constants have the same encoding and meaning
as the OT_BYTE/WORD/LONG/QUAD.  Since we rely on them being the
same, for the qemu_ld/st helpers, standardize on the common names.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Remove gen_op_ld_T0_A0

Propagate its definition into all users.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Remove gen_op_ldu_T0_A0

Propagate its definition into all users.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Remove gen_op_ld_T1_A0

Propagate its definition into all users.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Remove gen_op_lds_T0_A0

Replace its users by gen_op_ld_v with the MO_SIGN bit set.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Introduce gen_op_st_rm_T0_A0

Too many places have the same test vs OR_TMP0 to indicate
a write back to memory.  Hoist that to a subroutine.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Remove gen_op_st_T0_A0

Propagate its definition into all users.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Remove gen_op_st_T1_A0

Propagate its definition into all users.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Fix typo in gen_push_T1

By inspection, obviously we should be storing T[1] not T[0].
This could only happen for x86_64 in 64-bit mode with 0x66
prefix to call insn -- i.e. never.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Tidy mov[sz][bw]

We can use the MO_SIGN bit to tidy the reg-reg switch statement
as well as pass it on to gen_op_ld_v, eliminating one call.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Tidy movsl

Always perform a sign-extending load.  In the extremely unlikely
case that we've used an 0x66 prefix, the extension to 64-bits is
unnecessary but not wrong; the store will still examine only 16 bits.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Remove unused arguments to gen_lea_modrm

The reg_ptr and offset_ptr outputs are universally unused.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Use MO_BE for movbe

Fold the bswap into the memory operation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Tidy gen_op_mov_TN_reg+tcg_gen_trunc_tl_i32

For the 16 and 32-bit cases, we don't need to truncate via
a temporary register.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Tidy load + truncate

We can now use tcg_gen_qemu_ld_i32 directly to avoid the truncation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-i386: Tidy extend + store

We can now use tcg_gen_qemu_st_i32 directly to avoid the extension.

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