From patchwork Sat May 24 15:53:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352120 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1FF18140083 for ; Sun, 25 May 2014 01:56:54 +1000 (EST) Received: from localhost ([::1]:48389 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WoEJX-0007qe-KG for incoming@patchwork.ozlabs.org; Sat, 24 May 2014 11:56:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WoEH7-0002fk-GU for qemu-devel@nongnu.org; Sat, 24 May 2014 11:54:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WoEH1-0001Dh-CO for qemu-devel@nongnu.org; Sat, 24 May 2014 11:54:21 -0400 Received: from mail-pb0-x22f.google.com ([2607:f8b0:400e:c01::22f]:62527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WoEH1-0001DU-4C for qemu-devel@nongnu.org; Sat, 24 May 2014 11:54:15 -0400 Received: by mail-pb0-f47.google.com with SMTP id rp16so5574066pbb.20 for ; Sat, 24 May 2014 08:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=RJ8Dbw8TLyhs0eJ5OX8XKkRGDGOJ0attuGwFiMfRRQA=; b=QUwTy2f1Z53bQWnrM1gX5Q5ooOARMbdhPCNOVGBXS4/JtEL83nzseqeUxE/HX6i0HR A0JilnvVfG9T43XqOfuIGDGMu6lRZGkeTjyU/oYZTuiS0aIWdSAZUN9bS6Zhyat+qQEJ DptubCW6J0ouzddf7yXYLQs9h/4EUL+mv5iFR9BXvQSFWlUvO091X/2BWVHoeraOPGm5 1mQD27jRMl+SM0DJh3TgVZQDgFGdK4sear2lF3EhQ5GlGBcWWHN+zOLP8lXl6+A7rIfF 9RDTJjI4TIrTL2kI4ocOzPCeZGYjkP1qJxBEvyUmCCL3waUUzU+JQMa6A+VnQN+qXIwi Cjsw== X-Received: by 10.66.172.167 with SMTP id bd7mr15158495pac.72.1400946853753; Sat, 24 May 2014 08:54:13 -0700 (PDT) Received: from pike.twiddle.home (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id ie9sm30663048pad.29.2014.05.24.08.54.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 May 2014 08:54:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 24 May 2014 08:53:42 -0700 Message-Id: <1400946841-21079-6-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1400946841-21079-1-git-send-email-rth@twiddle.net> References: <1400946841-21079-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c01::22f Cc: peter.maydell@linaro.org Subject: [Qemu-devel] [PULL 05/24] tcg-mips: Split large ldst offsets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Use this to reduce goto_tb by one insn. Reviewed-by: Paolo Bonzini Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c index 2d2073f..5ccfb1d 100644 --- a/tcg/mips/tcg-target.c +++ b/tcg/mips/tcg-target.c @@ -480,16 +480,18 @@ static inline void tcg_out_ext16s(TCGContext *s, TCGReg ret, TCGReg arg) } } -static inline void tcg_out_ldst(TCGContext *s, int opc, TCGArg arg, - TCGReg arg1, TCGArg arg2) +static void tcg_out_ldst(TCGContext *s, int opc, TCGReg data, + TCGReg addr, intptr_t ofs) { - if (arg2 == (int16_t) arg2) { - tcg_out_opc_imm(s, opc, arg, arg1, arg2); - } else { - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_AT, arg2); - tcg_out_opc_reg(s, OPC_ADDU, TCG_REG_AT, TCG_REG_AT, arg1); - tcg_out_opc_imm(s, opc, arg, TCG_REG_AT, 0); + int16_t lo = ofs; + if (ofs != lo) { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_AT, ofs - lo); + if (addr != TCG_REG_ZERO) { + tcg_out_opc_reg(s, OPC_ADDU, TCG_REG_AT, TCG_REG_AT, addr); + } + addr = TCG_REG_AT; } + tcg_out_opc_imm(s, opc, data, addr, lo); } static inline void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg, @@ -1315,9 +1317,8 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_abort(); } else { /* indirect jump method */ - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_AT, - (uintptr_t)(s->tb_next + args[0])); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_AT, TCG_REG_AT, 0); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_AT, TCG_REG_ZERO, + (uintptr_t)(s->tb_next + args[0])); tcg_out_opc_reg(s, OPC_JR, 0, TCG_REG_AT, 0); } tcg_out_nop(s);