qemu-e2k/target-i386
Richard Henderson a3251186fc 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
or 2 TCG ops (2 if the result of the addition needs to be extended).

The temp-local can be declared dead as soon as the cc_op changes again,
or also before the translation block ends because gen_prepare_cc will
always make a copy before returning it.  All this magic, plus copy
propagation and dead-code elimination, ensures that the temp local will
(almost) never be spilled.

Example (cmp $0x21,%rax + jbe):

 Before                                     After
----------------------------------------------------------------------------
 movi_i64 tmp1,$0x21                        movi_i64 tmp1,$0x21
 movi_i64 cc_src,$0x21                      movi_i64 cc_src,$0x21
 sub_i64 cc_dst,rax,tmp1                    sub_i64 cc_dst,rax,tmp1
 add_i64 tmp7,cc_dst,cc_src
 movi_i32 cc_op,$0x11                       movi_i32 cc_op,$0x11
 brcond_i64 tmp7,cc_src,leu,$0x0            discard loc11
                                            brcond_i64 rax,cc_src,leu,$0x0

 Before                                     After
----------------------------------------------------------------------------
  mov    (%r14),%rbp                        mov    (%r14),%rbp
  mov    %rbp,%rbx                          mov    %rbp,%rbx
  sub    $0x21,%rbx                         sub    $0x21,%rbx
  lea    0x21(%rbx),%r12
  movl   $0x11,0xa0(%r14)                   movl   $0x11,0xa0(%r14)
  movq   $0x21,0x90(%r14)                   movq   $0x21,0x90(%r14)
  mov    %rbx,0x98(%r14)                    mov    %rbx,0x98(%r14)
  cmp    $0x21,%r12                     |   cmp    $0x21,%rbp
  jbe    ...                                jbe    ...

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-02-18 15:03:58 -08:00
..
Makefile.objs x86: switch to AREG0 free mode 2012-08-14 19:01:26 +00:00
TODO target-i386: fix {min,max}{pd,ps,sd,ss} SSE2 instructions 2012-01-11 09:55:28 +01:00
arch_dump.c exec: change RAM list to a TAILQ 2012-12-20 23:08:47 +01:00
arch_memory_mapping.c target-i386: fix bits 39:32 of the final physical address when using 4M page 2013-01-09 15:12:20 -02:00
cc_helper.c x86: Implement SMEP and SMAP 2012-10-01 08:04:22 -05:00
cc_helper_template.h x86: avoid AREG0 for condition code helpers 2012-08-14 19:01:25 +00:00
cpu-qom.h target-i386: Update X86CPU to QOM realizefn 2013-02-16 14:50:56 +01:00
cpu.c target-i386: Split command line parsing out of cpu_x86_register() 2013-02-16 14:51:01 +01:00
cpu.h target-i386: Name the cc_op enumeration 2013-02-18 15:03:56 -08:00
excp_helper.c softmmu: move include files to include/sysemu/ 2012-12-19 08:32:45 +01:00
fpu_helper.c exec: move include files to include/exec/ 2012-12-19 08:31:31 +01:00
helper.c target-i386: Move cpu_x86_init() 2013-02-16 14:51:00 +01:00
helper.h exec: move include files to include/exec/ 2012-12-19 08:31:31 +01:00
hyperv.c hyper-v: introduce Hyper-V support infrastructure. 2012-01-19 08:32:12 -02:00
hyperv.h hyperv: fix build on non-KVM hosts 2012-01-23 20:04:51 +00:00
int_helper.c misc: move include files to include/qemu/ 2012-12-19 08:32:39 +01:00
ioport-user.c exec: move include files to include/exec/ 2012-12-19 08:31:31 +01:00
kvm-stub.c kvm: Move kvm_allows_irq0_override() to target-i386, fix return type 2012-08-09 16:16:55 +03:00
kvm.c cpu: Move exit_request field to CPUState 2013-02-16 14:51:00 +01:00
kvm_i386.h softmmu: move include files to include/sysemu/ 2012-12-19 08:32:45 +01:00
machine.c target-i386: Define DR7 bit field constants 2013-01-15 09:14:35 +01:00
mem_helper.c exec: move include files to include/exec/ 2012-12-19 08:31:31 +01:00
misc_helper.c target-i386: Use switch in check_hw_breakpoints() 2013-01-15 09:23:50 +01:00
ops_sse.h x86: avoid AREG0 for FPU helpers 2012-08-14 19:01:25 +00:00
ops_sse_header.h x86: avoid AREG0 for FPU helpers 2012-08-14 19:01:25 +00:00
seg_helper.c target-i386: Introduce hw_{local,global}_breakpoint_enabled() 2013-01-15 09:14:48 +01:00
shift_helper_template.h target-i386: compute eflags outside rcl/rcr helper 2013-02-18 15:03:56 -08:00
smm_helper.c cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to generic 2012-10-05 15:04:43 +01:00
svm.h Use new macro QEMU_PACKED for packed structures 2011-09-03 10:45:59 +00:00
svm_helper.c exec: move include files to include/exec/ 2012-12-19 08:31:31 +01:00
topology.h target-i386: Inline bitops_flsl 2013-02-16 11:12:29 +00:00
translate.c target-i386: optimize flags checking after sub using CC_SRCT 2013-02-18 15:03:58 -08:00