Statistics
| Branch: | Revision:

root / target-i386 / translate.c @ 1c90ef26

History | View | Annotate | Download (271 kB)

# Date Author Comment
78261634 01/07/2014 10:39 pm Richard Henderson

target-i386: Tidy ljmp

Remove an unnecessary move opcode.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

74bdfbda 01/07/2014 10:39 pm Richard Henderson

target-i386: Rename gen_op_jmp_T0 to gen_op_jmp_v

And make the destination argument explicit.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

830a19a4 01/07/2014 10:38 pm Richard Henderson

target-i386: Tidy some size computation

Clean up relics of multiple size domains: - MO_16 + 1 => - 1 + 1 => 0.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

33b7891b 01/07/2014 10:36 pm Richard Henderson

target-i386: Remove gen_op_mov_reg_A0

Replace with its definition.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

c56baccf 01/07/2014 10:36 pm Richard Henderson

target-i386: Remove gen_op_mov_TN_reg

Replace with its definition.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

fd5185ec 01/07/2014 10:32 pm Richard Henderson

target-i386: Remove gen_op_addl_T0_T1

Replace with its definition.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

68773f84 01/07/2014 10:32 pm Richard Henderson

target-i386: Remove gen_op_mov_reg_T1

Replace with its definition.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

480a762d 01/07/2014 10:30 pm Richard Henderson

target-i386: Remove gen_op_mov_reg_T0

Replace with its definition.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

fac0aff9 01/07/2014 10:16 pm Richard Henderson

target-i386: Tidy cpu_regs initialization

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

7effd625 01/07/2014 09:40 pm Richard Henderson

target-i386: Tidy addr16 code in gen_lea_modrm

Unlike the addr32, there was no bug. But we can use the same
technique to reduce the number of TCG ops.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

432baffe 01/07/2014 09:40 pm Richard Henderson

target-i386: Combine gen_push_T* into gen_push_v

Reduce ifdefs, share more code between paths, reduce the number of TCG
ops generated.

Add forgotten zero-extension in the TARGET_X86_64, !CODE64, ss32 case.

Reviewed-by: Peter Maydell <>...

8e31d234 01/07/2014 09:40 pm Richard Henderson

target_i386: Clean up gen_pop_T0

Reduce ifdefs, share more code between paths, reduce the number of TCG
ops generated. Avoid re-computing the size of the operation across
gen_pop_T0 and gen_pop_update.

Add forgotten zero-extension in the TARGET_X86_64, !CODE64, ss32 case....

ab4e4aec 01/07/2014 09:40 pm Richard Henderson

target-i386: Change dflag to TCGMemOp

Changing the domain to TCGMemOp makes it easier to interoperate
with other portions of the rest of the translator.

We now only have one domain for size operands inside the translator,
which makes things less confusing all the way around. There are...

6f17675a 01/07/2014 09:38 pm Richard Henderson

target-i386: Change gen_op_mov_reg_A0 size parameter to TCGMemOp

Change the domain of the parameter and update all callers.
Which lets us defer completely to gen_op_mov_reg_v.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

1d71ddb1 01/07/2014 09:38 pm Richard Henderson

target-i386: Change aflag to TCGMemOp

Changing the domain to TCGMemOp makes it easier to interoperate
with other portions of the rest of the translator.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

d3f4bbe3 01/07/2014 09:37 pm Richard Henderson

target-i386: Change gen_op_add_reg_* size parameter to TCGMemOp

These functions used the aflags/dflags domain, which is log2-1
of the byte size. Confusingly, they used enumeration values
from the log2 domain.

Change the domain of the parameter and update all callers....

c92aa1ad 01/07/2014 09:37 pm Richard Henderson

target-i386: Change gen_op_j*z_ecx size parameter to TCGMemOp

Change the domain of the parameter and update all callers.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

d67dc9e6 01/07/2014 09:37 pm Richard Henderson

target-i386: Use TCGMemOp for 'ot' variables

The 'ot' variables (operand type?) hold the log2(byte size) of
the operand being manipulated. This is the same as the MO_SIZE
subset of the TCGMemOp. Indeed, we often pass 'ot' to the
tcg_gen_qemu_ld/st functions....

2b98a7d7 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_movl_T0_T1

Replace it with its definition.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

a7e5c7de 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_andl_A0_ffff

Replace it with tcg_gen_ext16u_tl, and in two cases merge with a
previous move from cpu_regs.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

d5601ad0 01/07/2014 09:36 pm Richard Henderson

target-i386: Tidy extend + store

We can now use tcg_gen_qemu_st_i32 directly to avoid the extension.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

a7fbcbe5 01/07/2014 09:36 pm Richard Henderson

target-i386: Tidy extend + move

For the known MO_32/MO_64 cases, we don't need to extend a 32-bit temp
into a 64-bit temp before storing into the hardware register.

We do need the extension for the MO_8/MO_16 cases, in order for the
deposit_tl operation to work, so leave those alone....

97212c88 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_movl_T0_0

Propagate its definition into all users.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

1b90d56e 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_movl_T0_im*

Propagate the definition of gen_op_movl_T0_im to all users.
The function gen_op_movl_T0_imu was unused.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

0ae657b1 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_movl_T0_im*

Propagate the definitions into all users. The only time that
gen_op_movl_T1_imu was used, the input was type 'unsigned',
so the replacement works identically.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

3250cff8 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_mov*_A0_im

Propagate the definitions into all users. In two cases, this allows
us to share code between the 32-bit and 64-bit immediate moves.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

cc0bce88 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_movtl_T*_im

Propagate the definitions into all users.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

40b90233 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_andl_T0_ffff

Replace it with tcg_gen_ext16u_tl. In four places we can combine that
with a previous move into cpu_T0, and in one place we can infer that
the zero-extension has already happened via the previous load.

Reviewed-by: Peter Maydell <>...

f0706f0c 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_andl_T0_im

Replace it with its definition.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

fd8ca9f6 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_st_T0_A0

Propagate its definition into all users.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

b5afc104 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_st_T1_A0

Propagate its definition into all users.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

ee3138da 01/07/2014 09:36 pm Richard Henderson

target-i386: Fix typo in gen_push_T1

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

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

c8fbc479 01/07/2014 09:36 pm Richard Henderson

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.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

4b1fe067 01/07/2014 09:36 pm Richard Henderson

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.

Reviewed-by: Peter Maydell <>...

4eeb3939 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove unused arguments to gen_lea_modrm

The reg_ptr and offset_ptr outputs are universally unused.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

3655a19f 01/07/2014 09:36 pm Richard Henderson

target-i386: Use MO_BE for movbe

Fold the bswap into the memory operation.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

24b9c00f 01/07/2014 09:36 pm Richard Henderson

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.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

80b02013 01/07/2014 09:36 pm Richard Henderson

target-i386: Tidy load + truncate

We can now use tcg_gen_qemu_ld_i32 directly to avoid the truncation.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

909be183 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_ld_T0_A0

Propagate its definition into all users.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

cc1a80df 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_ldu_T0_A0

Propagate its definition into all users.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

0f712e10 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_ld_T1_A0

Propagate its definition into all users.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

dc732b76 01/07/2014 09:36 pm Richard Henderson

target-i386: Remove gen_op_lds_T0_A0

Replace its users by gen_op_ld_v with the MO_SIGN bit set.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

d4faa3e0 01/07/2014 09:36 pm Richard Henderson

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.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

4ba9938c 01/07/2014 09:36 pm Richard Henderson

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.

Reviewed-by: Peter Maydell <>...

3523e4bd 01/07/2014 09:05 pm Richard Henderson

target-i386: Use new tcg_gen_qemu_st_* helpers

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

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

3c5f4116 01/07/2014 09:05 pm Richard Henderson

target-i386: Use new tcg_gen_qemu_ld_* helpers

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

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

5c42a7cd 01/07/2014 09:05 pm Richard Henderson

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.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

323d1876 01/07/2014 09:05 pm Richard Henderson

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.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

7865eec4 11/21/2013 06:01 pm Richard Henderson

target-i386: Fix addr32 prefix in gen_lea_modrm

Fix the following run-test-x86_64 testsuite failures:

-lea (%eax) = 0000000000000001
-lea (
%ebx) = 0000000000000002
-lea (%ecx) = 0000000000000004
-lea (
%edx) = 0000000000000008
-lea (%%esi) = 0000000000000010...

81f3053b 11/21/2013 05:55 pm Paolo Bonzini

target-i386: yield to another VCPU on PAUSE

After commit b1bbfe7 (aio / timers: On timer modification, qemu_notify
or aio_notify, 2013-08-21) FreeBSD guests report a huge slowdown.

The problem shows up as soon as FreeBSD turns out its periodic (~1 ms)
tick, but the timers are only the trigger for a pre-existing problem....

5cd8f621 10/10/2013 09:43 pm Richard Henderson

tcg: Move helper registration into tcg_context_init

No longer needs to be done on a per-target basis.

Signed-off-by: Richard Henderson <>

bff93281 09/12/2013 09:24 pm Peter Maydell

target-i386: Only provide CMOV and friends if feature bit set

The instructions CMOVcc, FCMOVcc and F[U]COMI[P] should only be
present if the CMOV feature bit is set. Add missing feature bit
checks so we correctly fault if emulating a 486 or 586.
This fixes bug LP:1201446....

8cfd0495 09/02/2013 07:08 pm Richard Henderson

tcg: Change tcg_gen_exit_tb argument to uintptr_t

And update all users.

Reviewed-by: Aurelien Jarno <>
Signed-off-by: Richard Henderson <>

ed2803da 07/23/2013 03:41 am Andreas Färber

cpu: Move singlestep_enabled field from CPU_COMMON to CPUState

Prepares for changing cpu_single_step() argument to CPUState.

Acked-by: Michael Walle <> (for lm32)
Signed-off-by: Andreas Färber <>

467215c2 07/09/2013 10:33 pm Andreas Färber

target-i386: Change gen_intermediate_code_internal() argument to X86CPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <>
Signed-off-by: Andreas Färber <>

dec3fc96 05/31/2013 08:51 pm Richard Henderson

target-i386: Fix aflag logic for CODE64 and the 0x67 prefix

The code reorganization in commit 4a6fd938 broke handling of PREFIX_ADR.
While fixing this, tidy and comment the code so that it's more obvious
what's going on in setting both aflag and dflag.

The TARGET_X86_64 ifdef can be eliminated because CODE64 expands to the...

38ebb396 05/10/2013 08:59 pm Aurelien Jarno

target-i386: ROR r8/r16 imm instruction fix

Fix EFLAGS corruption by ROR r8/r16 imm instruction located at the end
of the TB, similarly to commit 089305ac for the non-immediate case.

Reported-by: Hervé Poussineau <>
Reviewed-by: Richard Henderson <>...

0514ef2f 05/02/2013 01:27 am Eduardo Habkost

target-i386: Replace cpuid_*features fields with a feature word array

This replaces the feature-bit fields on both X86CPU and x86_def_t
structs with an array.

With this, we will be able to simplify code that simply does the same
operation on all feature words (e.g. kvm_check_features_against_host(),...

089305ac 04/20/2013 10:27 pm Pavel Dovgaluk

i386 ROR r8/r16 instruction fix

Fixed EFLAGS corruption by ROR r8/r16 instruction located at the end of the TB.

Signed-off-by: Pavel Dovgalyuk <>
Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

d640045a 04/13/2013 02:51 pm Aurelien Jarno

target-i386: add AES-NI instructions

Reviewed-by: Edgar E. Iglesias <>
Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

e71827bc 04/13/2013 02:51 pm Aurelien Jarno

target-i386: add pclmulqdq instruction

Reviewed-by: Richard Henderson <>
Reviewed-by: Edgar E. Iglesias <>
Signed-off-by: Aurelien Jarno <>

34c6addd 04/01/2013 07:49 pm Aurelien Jarno

target-i386: SSE4.1: fix pinsrb instruction

gen_op_mov_TN_reg() loads the value in cpu_T0, so this temporary should
be used instead of cpu_tmp0.

Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

c53de1a2 03/23/2013 04:26 pm Richard Henderson

target-i386: Fix flags computation for ADOX

When starting from CC_OP_DYNAMIC, and issuing adox before adcx,
a typo used the wrong value for the resulting CC_OP.

Cc: Blue Swirl <>
Reported-by: Torbjorn Granlund <>
Signed-off-by: Richard Henderson <>...

085d8134 03/22/2013 02:25 pm Peter Maydell

Fix typos and misspellings

Fix various typos and misspellings. The bulk of these were found with
codespell.

Signed-off-by: Peter Maydell <>
Reviewed-by: Stefan Weil <>
Signed-off-by: Stefan Hajnoczi <>

806f352d 03/03/2013 04:29 pm Peter Maydell

gen-icount.h: Rename gen_icount_start/end to gen_tb_start/end

The gen_icount_start/end functions are now somewhat misnamed since they
are useful for generic "start/end of TB" code, used for more than just
icount. Rename them to gen_tb_start/end.

Signed-off-by: Peter Maydell <>...

a4bcea3d 02/27/2013 09:06 pm Richard Henderson

target-i386: Use mulu2 and muls2

These correspond very closely to the insns that we're emulating.

Signed-off-by: Richard Henderson <>
Signed-off-by: Blue Swirl <>

76f13133 02/23/2013 07:25 pm Richard Henderson

target-i386: Use add2 to implement the ADX extension

Signed-off-by: Richard Henderson <>
Signed-off-by: Blue Swirl <>

a41f62f5 02/20/2013 09:05 am Richard Henderson

target-i386: Use movcond to implement shift flags.

With this being all straight-line code, it can get deleted
when the cc variables die.

Signed-off-by: Richard Henderson <>

34d80a55 02/20/2013 09:05 am Richard Henderson

target-i386: Use movcond to implement rotate flags.

With this being all straight-line code, it can get deleted
when the cc variables die.

Signed-off-by: Richard Henderson <>

e2f515cf 02/20/2013 09:05 am Richard Henderson

target-i386: Discard CC_OP computation in set_cc_op also

The shift and rotate insns use movcond to set CC_OP, and thus
achieve a conditional EFLAGS setting. By discarding CC_OP in
a later flags setting insn, we can discard that movcond.

Signed-off-by: Richard Henderson <>

f437d0a3 02/20/2013 09:05 am Richard Henderson

target-i386: Use movcond to implement shiftd.

With this being all straight-line code, it can get deleted
when the cc variables die.

Signed-off-by: Richard Henderson <>

cd7f97ca 02/20/2013 09:05 am Richard Henderson

target-i386: Implement ADX extension

Signed-off-by: Richard Henderson <>

321c5351 02/20/2013 09:05 am Richard Henderson

target-i386: Implement tzcnt and fix lzcnt

We weren't computing flags for lzcnt at all. At the same time,
adjust the implementation of bsf/bsr to avoid the local branch,
using movcond instead.

Signed-off-by: Richard Henderson <>

436ff2d2 02/20/2013 09:05 am Richard Henderson

target-i386: Add CC_OP_CLR

Special case xor with self. We need not even store the known
zero into cc_src.

Signed-off-by: Richard Henderson <>

02ea1e6b 02/19/2013 01:52 am Richard Henderson

target-i386: Implement BZHI

Signed-off-by: Richard Henderson <>

5f1f4b17 02/19/2013 01:52 am Richard Henderson

target-i386: Implement MULX

Signed-off-by: Richard Henderson <>

0592f74a 02/19/2013 01:52 am Richard Henderson

target-i386: Implement PDEP, PEXT

Signed-off-by: Richard Henderson <>

4a554890 02/19/2013 01:52 am Richard Henderson

target-i386: Implement SHLX, SARX, SHRX

Signed-off-by: Richard Henderson <>

e2c3c2c5 02/19/2013 01:52 am Richard Henderson

target-i386: Implement RORX

Signed-off-by: Richard Henderson <>

bc4b43dc 02/19/2013 01:52 am Richard Henderson

target-i386: Implement BLSR, BLSMSK, BLSI

Do all of group 17 at one time for ease.

Signed-off-by: Richard Henderson <>

701ed211 02/19/2013 01:39 am Richard Henderson

target-i386: Decode the VEX prefixes

No actual required uses of these encodings yet.

Signed-off-by: Richard Henderson <>

111994ee 02/19/2013 01:39 am Richard Henderson

target-i386: Implement MOVBE

Signed-off-by: Richard Henderson <>

7073fbad 02/19/2013 01:39 am Richard Henderson

target-i386: Implement ANDN

As this is the first of the BMI insns to be implemented,
this carries quite a bit more baggage than normal.

Signed-off-by: Richard Henderson <>

c7ab7565 02/19/2013 01:39 am Richard Henderson

target-i386: Implement BEXTR

Signed-off-by: Richard Henderson <>

4a6fd938 02/19/2013 01:39 am Richard Henderson

target-i386: Tidy prefix parsing

Avoid duplicating switch statement between 32 and 64-bit modes.

Signed-off-by: Richard Henderson <>

988c3eb0 02/19/2013 01:39 am Richard Henderson

target-i386: Use CC_SRC2 for ADC and SBB

Add another slot in ENV and store two of the three inputs. This lets us
do less work when carry-out is not needed, and avoids the unpredictable
CC_OP after translating these insns.

Signed-off-by: Richard Henderson <>

db9f2597 02/19/2013 01:25 am Richard Henderson

target-i386: Make helper_cc_compute_{all,c} const

Pass the data in explicitly, rather than indirectly via env.
This avoids all sorts of unnecessary register spillage.

Signed-off-by: Richard Henderson <>

63633fe6 02/19/2013 01:03 am Richard Henderson

target-i386: use gen_op for cmps/scas

Replace low-level ops with a higher-level "cmp %al, (A0)" in the case
of scas, and "cmp T0, (A0)" in the case of cmps.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Richard Henderson <>

dc259201 02/19/2013 01:03 am Richard Henderson

target-i386: introduce gen_jcc1_noeob

A jump that ends a basic block or otherwise falls back to CC_OP_DYNAMIC
will always have to call gen_op_set_cc_op. However, not all jumps end
a basic block, so introduce a variant that does not do this.

This was partially undone earlier (i386: drop cc_op argument of gen_jcc1),...

891a5133 02/19/2013 01:03 am Richard Henderson

target-i386: Update cc_op before TCG branches

Placing the CC_OP_DYNAMIC at the join is less effective than
before the branch, as the branch will have forced global registers
to their home locations. This way we have a chance to discard
CC_SRC2 before it gets stored....

a3251186 02/19/2013 01:03 am Richard Henderson

target-i386: optimize flags checking after sub using CC_SRCT

After a comparison or subtraction, the original value of the LHS will
currently be reconstructed using an addition. However, in most cases
it is already available: store it in a temp-local variable and save 1...

c365395e 02/19/2013 01:03 am Paolo Bonzini

target-i386: optimize setcc instructions

Reconstruct the arguments for complex conditions involving CC_OP_SUBx (BE,
L, LE). In the others do it via setcond and gen_setcc_slow (which is
not that slow in many cases).

Signed-off-by: Paolo Bonzini <>...

bec93d72 02/19/2013 01:03 am Richard Henderson

target-i386: introduce CCPrepare

Introduce a struct that describes how to build a cond operation
that checks for a given x86 condition code. For now, just change
gen_compute_eflags_
to return the new struct, generate code for
the CCPrepare struct, and go on as before....

276e6b5f 02/19/2013 01:03 am Richard Henderson

target-i386: introduce gen_prepare_cc

This makes the i386 front-end able to create CCPrepare structs for all
condition, not just those that come from a single flag. In particular,
JCC_L and JCC_LE can be optimized because gen_prepare_cc is not forced
to return a result in bit 0 (unlike gen_setcc_slow)....

943131ca 02/19/2013 01:03 am Paolo Bonzini

target-i386: use CCPrepare to generate conditional jumps

This simplifies all the jump generation code. CCPrepare allows the
code to create an efficient brcond always, so there is no need to
duplicate the setcc and jcc code.

Signed-off-by: Paolo Bonzini <>...

69d1aa31 02/19/2013 01:03 am Richard Henderson

target-i386: inline gen_prepare_cc_slow

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Richard Henderson <>

cc8b6f5b 02/19/2013 01:03 am Paolo Bonzini

target-i386: cleanup temporary macros for CCPrepare

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Richard Henderson <>

f32d3781 02/19/2013 01:03 am Paolo Bonzini

target-i386: introduce gen_cmovcc1

Signed-off-by: Richard Henderson <>

57eb0cc8 02/19/2013 01:03 am Richard Henderson

target-i386: expand cmov via movcond

Signed-off-by: Richard Henderson <>

3b9d3cf1 02/19/2013 01:03 am Paolo Bonzini

target-i386: kill cpu_T3

It is almost unused, and it is simpler to pass a TCG value directly
to gen_shiftd_rm_T1_T3. This value is then written to t2 without
going through a temporary register.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Richard Henderson <>