qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Richard Henderson <rth@twiddle.net>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] tcg: try sti when moving a constant into a dead memory temp
Date: Wed, 21 Sep 2016 15:37:50 +0200	[thread overview]
Message-ID: <e709ea2e-6404-836e-53d1-4b2fed1914cf@redhat.com> (raw)
In-Reply-To: <98a4be9e-8e90-b2b9-9b66-ab673c94e2c6@twiddle.net>



On 20/09/2016 22:41, Richard Henderson wrote:
> On 09/15/2016 06:16 AM, Paolo Bonzini wrote:
>> This comes from free from unifying tcg_reg_alloc_mov and
>> tcg_reg_alloc_movi's handling of TEMP_VAL_CONST.  It triggers
>> often on moves to cc_dst, such as the following translation
>> of "sub $0x3c,%esp":
>>
>>   before:                          after:
>>   subl   $0x3c,%ebp                subl   $0x3c,%ebp
>>   movl   %ebp,0x10(%r14)           movl   %ebp,0x10(%r14)
>>   movl   $0x3c,%ebx                movl   $0x3c,0x2c(%r14)
>>   movl   %ebx,0x2c(%r14)
> 
> What's the input here?  From just this snippet it looks as if we should have
> converted both of them to an immediate store.

I don't have the exact binary but this is what I get from qemu

 movi_i32 tmp1,$0x20
 sub_i32 tmp0,esp,tmp1                            dead: 1
 mov_i32 esp,tmp0                                 sync: 0  dead: 1
 mov_i32 cc_src,tmp1                              sync: 0  dead: 0 1
 mov_i32 cc_dst,esp                               sync: 0  dead: 0
 discard cc_src2
 discard cc_op

which is compiled to

0x7f98ed3ff761:  mov    %ebx,(%rsi)            ; load esp
0x7f98ed3ff763:  sub    $0x20,%ebp             ; sub_i32 tmp0,esp,tmp1
0x7f98ed3ff766:  mov    %ebp,0x10(%r14)
0x7f98ed3ff76a:  mov    $0x20,%ebx             ; mov_i32 cc_src,tmp1
0x7f98ed3ff76f:  mov    %ebx,0x2c(%r14)
0x7f98ed3ff773:  mov    %ebp,0x28(%r14)        ; mov_i32 cc_dst,esp

TCG doesn't convert the "mov_i32 cc_src,tmp1" to movi, instead it tracks
the register as a TEMP_VAL_CONST.

Paolo

  reply	other threads:[~2016-09-21 13:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15 13:16 [Qemu-devel] [PATCH] tcg: try sti when moving a constant into a dead memory temp Paolo Bonzini
2016-09-20 20:41 ` Richard Henderson
2016-09-21 13:37   ` Paolo Bonzini [this message]
2016-09-22 21:09 ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e709ea2e-6404-836e-53d1-4b2fed1914cf@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).