From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MLAWd-0003Dd-S1 for qemu-devel@nongnu.org; Mon, 29 Jun 2009 02:39:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MLAWb-0003Ah-JQ for qemu-devel@nongnu.org; Mon, 29 Jun 2009 02:39:34 -0400 Received: from [199.232.76.173] (port=41081 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLAWb-0003AW-EO for qemu-devel@nongnu.org; Mon, 29 Jun 2009 02:39:33 -0400 Received: from fg-out-1718.google.com ([72.14.220.159]:46174) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MLAWa-0005Tp-6L for qemu-devel@nongnu.org; Mon, 29 Jun 2009 02:39:32 -0400 Received: by fg-out-1718.google.com with SMTP id l27so384467fgb.8 for ; Sun, 28 Jun 2009 23:39:31 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <5b31733c0906281635t523fa82bseaaf753cac46d206@mail.gmail.com> References: <5b31733c0906281119r7ea485b6k81f8e59fd3aa4926@mail.gmail.com> <761ea48b0906281424p5966022erbcb20143c06fd6b3@mail.gmail.com> <5b31733c0906281619k6a4bbf54s46de7d07b0395b2e@mail.gmail.com> <5b31733c0906281635t523fa82bseaaf753cac46d206@mail.gmail.com> Date: Mon, 29 Jun 2009 08:39:31 +0200 Message-ID: <761ea48b0906282339p7276c86du80fb8d6422aaa79e@mail.gmail.com> Subject: Re: OT: TCG SSA, speed, misc (was Re: [Qemu-devel] Re: [PATCH 08/11] QMP: Port balloon command) 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: Filip Navara Cc: qemu-devel@nongnu.org On Mon, Jun 29, 2009 at 1:35 AM, Filip Navara wrote= : > On Mon, Jun 29, 2009 at 1:19 AM, Filip Navara wro= te: >> On x86 host the register allocation still looks very pathetic, I will po= st a follow-up >> soon. > > Let's look at the very first two instructions generated by the guest: > > ---------------- > IN: > 0x00200070: =A0ldr =A0 =A0 =A0 =A0r0, [pc, #108] =A0; 0x2000e4 > 0x00200074: =A0ldr =A0 =A0 =A0 =A0pc, [pc, #108] =A0; 0x2000e8 > > OP: > =A0movi_i32 tmp8,$0x200078 > =A0movi_i32 tmp9,$0x6c > =A0add_i32 tmp8,tmp8,tmp9 > =A0qemu_ld32u tmp9,tmp8,$0x0 > =A0mov_i32 r0,tmp9 > =A0movi_i32 tmp9,$0x20007c > =A0movi_i32 tmp10,$0x6c > =A0add_i32 tmp9,tmp9,tmp10 > =A0qemu_ld32u tmp8,tmp9,$0x0 > =A0movi_i32 tmp10,$0xfffffffe > =A0and_i32 tmp8,tmp8,tmp10 > =A0mov_i32 pc,tmp8 > =A0exit_tb $0x0 > > OUT: [size=3D128] > 0x03230020: =A0mov =A0 =A0$0x200078,%eax > 0x03230025: =A0add =A0 =A0$0x6c,%eax > 0x03230028: =A0mov =A0 =A0%eax,%ecx > 0x0323002a: =A0mov =A0 =A0%ecx,%edx > 0x0323002c: =A0mov =A0 =A0%ecx,%eax > > -- this instruction sets %eax to value that it already has > > 0x0323002e: =A0shr =A0 =A0$0x6,%edx > 0x03230031: =A0and =A0 =A0$0xfffffc03,%eax > 0x03230037: =A0and =A0 =A0$0xff0,%edx > 0x0323003d: =A0lea =A0 =A00x540(%edx,%ebp,1),%edx > 0x03230044: =A0cmp =A0 =A0(%edx),%eax > 0x03230046: =A0mov =A0 =A0%ecx,%eax > 0x03230048: =A0je =A0 =A0 0x3230053 > 0x0323004a: =A0xor =A0 =A0%edx,%edx > 0x0323004c: =A0call =A0 0x55cbc0 > 0x03230051: =A0jmp =A0 =A00x3230058 > 0x03230053: =A0add =A0 =A00xc(%edx),%eax > 0x03230056: =A0mov =A0 =A0(%eax),%eax > 0x03230058: =A0mov =A0 =A0$0x20007c,%edx > 0x0323005d: =A0add =A0 =A0$0x6c,%edx > 0x03230060: =A0mov =A0 =A0%edx,%ecx > 0x03230062: =A0mov =A0 =A0%eax,0x0(%ebp) > 0x03230065: =A0mov =A0 =A0%ecx,%edx > > -- same here > > 0x03230067: =A0mov =A0 =A0%ecx,%eax > 0x03230069: =A0shr =A0 =A0$0x6,%edx > 0x0323006c: =A0and =A0 =A0$0xfffffc03,%eax > 0x03230072: =A0and =A0 =A0$0xff0,%edx > 0x03230078: =A0lea =A0 =A00x540(%edx,%ebp,1),%edx > 0x0323007f: =A0cmp =A0 =A0(%edx),%eax > 0x03230081: =A0mov =A0 =A0%ecx,%eax > 0x03230083: =A0je =A0 =A0 0x323008e > 0x03230085: =A0xor =A0 =A0%edx,%edx > 0x03230087: =A0call =A0 0x55cbc0 > 0x0323008c: =A0jmp =A0 =A00x3230093 > 0x0323008e: =A0add =A0 =A00xc(%edx),%eax > 0x03230091: =A0mov =A0 =A0(%eax),%eax > 0x03230093: =A0and =A0 =A0$0xfffffffe,%eax > 0x03230096: =A0mov =A0 =A0%eax,0x3c(%ebp) > 0x03230099: =A0xor =A0 =A0%eax,%eax > 0x0323009b: =A0jmp =A0 =A00x7ec928 > > If someone can explain me why the redundant mov instructions are > generated I'd be very happy. Thanks. What you see here is due to hard-coded assembly instructions used to make a load. cf tcg_out_qemu_ld in tcg-target.c Laurent