From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmhjn-0005qF-6F for qemu-devel@nongnu.org; Wed, 21 Sep 2016 09:39:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmhjk-0007Og-2O for qemu-devel@nongnu.org; Wed, 21 Sep 2016 09:38:59 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:35503) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmhjj-0007OW-SI for qemu-devel@nongnu.org; Wed, 21 Sep 2016 09:38:55 -0400 Received: by mail-wm0-f47.google.com with SMTP id l132so269170760wmf.0 for ; Wed, 21 Sep 2016 06:38:55 -0700 (PDT) Sender: Paolo Bonzini References: <1473945360-13663-1-git-send-email-pbonzini@redhat.com> <98a4be9e-8e90-b2b9-9b66-ab673c94e2c6@twiddle.net> From: Paolo Bonzini Message-ID: Date: Wed, 21 Sep 2016 15:37:50 +0200 MIME-Version: 1.0 In-Reply-To: <98a4be9e-8e90-b2b9-9b66-ab673c94e2c6@twiddle.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] tcg: try sti when moving a constant into a dead memory temp List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , qemu-devel@nongnu.org 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