From patchwork Wed Oct 21 10:18:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Juha.Riihimaki@nokia.com X-Patchwork-Id: 36527 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 CA0B2B7B9C for ; Wed, 21 Oct 2009 22:02:47 +1100 (EST) Received: from localhost ([127.0.0.1]:48103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N0Yxp-0001pf-4g for incoming@patchwork.ozlabs.org; Wed, 21 Oct 2009 07:02:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N0YH0-0006d6-Jq for qemu-devel@nongnu.org; Wed, 21 Oct 2009 06:18:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N0YGv-0006ZG-Tb for qemu-devel@nongnu.org; Wed, 21 Oct 2009 06:18:30 -0400 Received: from [199.232.76.173] (port=43290 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N0YGv-0006Z1-LF for qemu-devel@nongnu.org; Wed, 21 Oct 2009 06:18:25 -0400 Received: from smtp.nokia.com ([192.100.122.230]:50043 helo=mgw-mx03.nokia.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N0YGv-0000Zz-0P for qemu-devel@nongnu.org; Wed, 21 Oct 2009 06:18:25 -0400 Received: from vaebh106.NOE.Nokia.com (vaebh106.europe.nokia.com [10.160.244.32]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n9LAIKVD024705 for ; Wed, 21 Oct 2009 13:18:22 +0300 Received: from vaebh102.NOE.Nokia.com ([10.160.244.23]) by vaebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 21 Oct 2009 13:17:55 +0300 Received: from vaebh101.NOE.Nokia.com ([10.160.244.22]) by vaebh102.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 21 Oct 2009 13:17:50 +0300 Received: from smtp.mgd.nokia.com ([65.54.30.6]) by vaebh101.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 21 Oct 2009 13:17:46 +0300 Received: from NOK-EUMSG-05.mgdnok.nokia.com ([65.54.30.90]) by nok-am1mhub-02.mgdnok.nokia.com ([65.54.30.6]) with mapi; Wed, 21 Oct 2009 12:17:45 +0200 From: To: Date: Wed, 21 Oct 2009 12:18:00 +0200 Thread-Topic: [PATCH 08/12] target-arm: optimize thumb2 load/store multiple ops Thread-Index: AcpSN7urgP/8ro2CQvG9Dw2TslWfMQ== Message-ID: Accept-Language: en, en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: en, en-US MIME-Version: 1.0 X-OriginalArrivalTime: 21 Oct 2009 10:17:46.0878 (UTC) FILETIME=[BC44B9E0:01CA5237] X-Nokia-AV: Clean X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) Subject: [Qemu-devel] [PATCH 08/12] target-arm: optimize thumb2 load/store multiple ops 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 Thumb2 load/store multiple instructions can be slightly optimized by loading the register offset constant into a variable outside the register loop and using the preloaded variable inside the loop instead of reloading the offset value to a temporary variable on each loop iteration. This causes less TCG ops to be generated for a Thumb2 load/ store multiple instruction. Signed-off-by: Juha Riihimäki --- continue; @@ -7386,8 +7387,9 @@ static int disas_thumb2_insn(CPUState *env, DisasContext *s, uint16_t insn_hw1) tmp = load_reg(s, i); gen_st32(tmp, addr, IS_USER(s)); } - tcg_gen_addi_i32(addr, addr, 4); + tcg_gen_add_i32(addr, addr, tmp2); } + tcg_temp_free_i32(tmp2); if (insn & (1 << 21)) { /* Base register writeback. */ if (insn & (1 << 24)) { diff --git a/target-arm/translate.c b/target-arm/translate.c index c92ecc6..abb3105 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -7370,6 +7370,7 @@ static int disas_thumb2_insn(CPUState *env, DisasContext *s, uint16_t insn_hw1) tcg_gen_addi_i32(addr, addr, -offset); } + tmp2 = tcg_const_i32(4); for (i = 0; i < 16; i++) { if ((insn & (1 << i)) == 0)