From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HSDk3-0006l7-Ge for qemu-devel@nongnu.org; Fri, 16 Mar 2007 10:49:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HSDk1-0006ku-JN for qemu-devel@nongnu.org; Fri, 16 Mar 2007 10:49:14 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HSDk1-0006kr-DJ for qemu-devel@nongnu.org; Fri, 16 Mar 2007 09:49:13 -0500 Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HSDit-0001mE-1R for qemu-devel@nongnu.org; Fri, 16 Mar 2007 10:48:03 -0400 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20070316144801.GEOI2951.mtaout01-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Fri, 16 Mar 2007 14:48:01 +0000 Received: from phoenix2.frop.org ([82.21.100.63]) by aamtaout04-winn.ispmail.ntl.com with ESMTP id <20070316144801.TQTL29112.aamtaout04-winn.ispmail.ntl.com@phoenix2.frop.org> for ; Fri, 16 Mar 2007 14:48:01 +0000 From: Julian Seward Subject: Re: [Qemu-devel] Redundant repz prefixes in generated amd64 code Date: Fri, 16 Mar 2007 14:45:24 +0000 References: <200703161415.21283.jseward@acm.org> <200703161428.36897.paul@codesourcery.com> In-Reply-To: <200703161428.36897.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200703161445.25051.jseward@acm.org> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Friday 16 March 2007 14:28, Paul Brook wrote: > On Friday 16 March 2007 14:15, Julian Seward wrote: > > I'm seeing redundant repz (0xF3) prefixes in generated code, typically > > just before jumps: > > > > : repz mov $0xe07f,%eax > > : mov %eax,0x20(%rbp) > > : lea -25168302(%rip),%ebx # 0xaf0420 > > : retq > > : mov -25168245(%rip),%eax # 0xaf0460 > > : jmpq *%rax > > : repz mov $0xe092,%eax > > : mov %eax,0x20(%rbp) > > : lea -25168325(%rip),%ebx # 0xaf0421 > > : retq > > > > I assume these are something to do with translation chaining/unchaining > > but have been unable to figure out where they come from. > > 0000000000008b50 : > 8b50: 8b 05 00 00 00 00 mov 0(%rip),%eax > 8b52: R_X86_64_PC32 __op_param1+0x3c > 8b56: ff e0 jmpq *%rax > 8b58: f3 c3 repz retq > > qemu only strips the final ret off. > The prefixed ret is to avoid prefetch stalls on amd cpus. So the implication of this is that the generated code just happens to work only because the dangling F3 never ends up in front of some other instruction which it would change the meaning of? J