From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N8FJk-0006W1-BY for qemu-devel@nongnu.org; Wed, 11 Nov 2009 10:41:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N8FJj-0006UE-GY for qemu-devel@nongnu.org; Wed, 11 Nov 2009 10:41:07 -0500 Received: from [199.232.76.173] (port=37159 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8FJj-0006Te-8s for qemu-devel@nongnu.org; Wed, 11 Nov 2009 10:41:07 -0500 Received: from fg-out-1718.google.com ([72.14.220.154]:48811) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N8FJi-0007ZC-TJ for qemu-devel@nongnu.org; Wed, 11 Nov 2009 10:41:07 -0500 Received: by fg-out-1718.google.com with SMTP id 19so1830141fgg.10 for ; Wed, 11 Nov 2009 07:41:04 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 11 Nov 2009 16:41:04 +0100 Message-ID: <761ea48b0911110741u20343771of659340b837c5a05@mail.gmail.com> Subject: Re: [Qemu-devel] load-store experiment... From: Laurent Desnogues Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chad Cc: qemu-devel@nongnu.org On Wed, Nov 11, 2009 at 8:51 AM, Chad wrote: > (this is mostly to get some ideas going rather than trying to get anythin= g > upstream... yet!) > > This version of tcg_out_mov for i386's tcg-target.c filters out the > > mov %ebx, %edx > mov %ebx, [some index] > mov %edx, %ebx The question is: what TCG sequence produces this kind of code? Laurent > I don't have benchmarks, but it does remove a few mov's and qemu can stil= l > load and run a linux kernel ;) > > It'd be easier to do more optimizations if qemu recorded output at the > assembly instruction level. > > --- > > static uint8_t *lmovloc =3D 0; > static int lmovret =3D -1, lmovarg =3D -1; > static inline void tcg_out_mov(TCGContext *s, int ret, int arg) > { > =A0=A0=A0 int ldiff, nowrite =3D 0; > > =A0=A0=A0 if (arg !=3D ret) { > =A0=A0=A0=A0=A0=A0=A0 /* Check for a mov, mov->x, mov pattern */ > =A0=A0=A0=A0=A0=A0=A0 ldiff =3D s->code_ptr - lmovloc; > =A0=A0=A0=A0=A0=A0=A0 if (((ldiff =3D=3D 8) || (ldiff =3D=3D 5)) && > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (*(lmovloc + 2) = =3D=3D 0x89) && > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ((lmovret =3D=3D r= et) && (lmovarg =3D=3D arg))) nowrite =3D 1; > =A0=A0=A0=A0=A0=A0=A0 /* Write */ > =A0=A0=A0=A0=A0=A0=A0 lmovloc =3D s->code_ptr; > =A0=A0=A0=A0=A0=A0=A0 if (!nowrite) { > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 tcg_out_modrm(s, 0x8b, ret,= arg); > =A0=A0=A0=A0=A0=A0=A0 } else { > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 qemu_log("removed\n"); > =A0=A0=A0=A0=A0=A0=A0 } > =A0=A0=A0=A0=A0=A0=A0 lmovret =3D arg; lmovarg =3D ret; > =A0=A0=A0 } > } >