From patchwork Wed Apr 14 15:06:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 50187 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 80882B7D45 for ; Thu, 15 Apr 2010 07:15:53 +1000 (EST) Received: from localhost ([127.0.0.1]:47528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O29w6-0004pz-BB for incoming@patchwork.ozlabs.org; Wed, 14 Apr 2010 17:15:50 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O29XV-0004qK-Lt for qemu-devel@nongnu.org; Wed, 14 Apr 2010 16:50:27 -0400 Received: from [140.186.70.92] (port=35455 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O29XK-0004db-Ap for qemu-devel@nongnu.org; Wed, 14 Apr 2010 16:50:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O29XF-0001Q1-Ag for qemu-devel@nongnu.org; Wed, 14 Apr 2010 16:50:13 -0400 Received: from are.twiddle.net ([75.149.56.221]:41949) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O29XF-0001Pk-58 for qemu-devel@nongnu.org; Wed, 14 Apr 2010 16:50:09 -0400 Received: by are.twiddle.net (Postfix, from userid 5000) id 986EAC15; Wed, 14 Apr 2010 13:50:08 -0700 (PDT) Message-Id: In-Reply-To: References: From: Richard Henderson Date: Wed, 14 Apr 2010 08:06:00 -0700 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 08/21] tcg-i386: Eliminate extra move from qemu_ld64. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If the address register overlaps one of the output registers simply issue the clobbering load last, rather than emitting an extra move of the address register. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c index 4f7df70..5829c5b 100644 --- a/tcg/i386/tcg-target.c +++ b/tcg/i386/tcg-target.c @@ -787,22 +787,20 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, } break; case 3: - /* XXX: could be nicer */ - if (r0 == data_reg) { - r1 = TCG_REG_EDX; - if (r1 == data_reg) - r1 = TCG_REG_EAX; - tcg_out_mov(s, r1, r0); - r0 = r1; + if (bswap) { + int t = data_reg; + data_reg = data_reg2; + data_reg2 = t; } - if (!bswap) { + if (r0 != data_reg) { tcg_out_ld(s, TCG_TYPE_I32, data_reg, r0, GUEST_BASE); tcg_out_ld(s, TCG_TYPE_I32, data_reg2, r0, GUEST_BASE + 4); } else { - tcg_out_ld(s, TCG_TYPE_I32, data_reg, r0, GUEST_BASE + 4); + tcg_out_ld(s, TCG_TYPE_I32, data_reg2, r0, GUEST_BASE + 4); + tcg_out_ld(s, TCG_TYPE_I32, data_reg, r0, GUEST_BASE); + } + if (bswap) { tcg_out_bswap32(s, data_reg); - - tcg_out_ld(s, TCG_TYPE_I32, data_reg2, r0, GUEST_BASE); tcg_out_bswap32(s, data_reg2); } break;