From nobody Fri Dec 19 20:13:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493753711438297.96947992573814; Tue, 2 May 2017 12:35:11 -0700 (PDT) Received: from localhost ([::1]:33343 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5dZm-0003kO-36 for importer@patchew.org; Tue, 02 May 2017 15:35:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5dOO-0001qc-S9 for qemu-devel@nongnu.org; Tue, 02 May 2017 15:23:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5dON-0001fy-A2 for qemu-devel@nongnu.org; Tue, 02 May 2017 15:23:24 -0400 Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]:33835) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d5dON-0001fk-5Z for qemu-devel@nongnu.org; Tue, 02 May 2017 15:23:23 -0400 Received: by mail-qk0-x241.google.com with SMTP id u75so22887739qka.1 for ; Tue, 02 May 2017 12:23:23 -0700 (PDT) Received: from bigtime.twiddle.net.com ([2602:47:d954:1500:5e51:4fff:fe40:9c64]) by smtp.gmail.com with ESMTPSA id d65sm10664657qkc.53.2017.05.02.12.23.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 12:23:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=4WhADEQn6T5MJNdNS1R/RLB1tcVezGSCUjZeOeqMB0A=; b=BUq8io9e/vYDtYR4oOq2SEH6KKyoYdtLdhfhzjXzalvX6my6NPSyFpCtcpHaa9zOcQ EL5cADXhzmdET3a83Xo+EmsQM/FwW9NseaGN5GY0iWP6boPCYER12DgNwbjHFjQevaOY tZmQq0ZKBxZCZFJu7uFlhcGCg8SvhBgzNsfwA6afq5B8T//0OE2OjuTq6MtKSFECNszt HpG8hbbzmCCZphu+g9tvVO5oJWqS7EwqWDaK+kI12kt8KlzNGF4Iz8oU/0m9TWVBaxhY 7Urya07DFINxavaRi7pj10A4HH/BmFXNFy5A8l6PL/XOJZsA220FQBfPPVMdQEfeglHj ZbkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=4WhADEQn6T5MJNdNS1R/RLB1tcVezGSCUjZeOeqMB0A=; b=ojmLKGxgOCaqLH/YGn0EMpEIxnTAo0aWbwhSiAua5g9A9cC3Wxc4wsZW96q5qLRhTr m4ciIk55lSJjhbQhY6R8HY0o7rEIND5v9pjk2HYlbWM91vCHFQRgvMGs3n1EnZGeo4tS PA9kAAu8R2oEDY8yNP6v3ZEXE88Y+bNug4QyPW9kHLDOyDXXIsv7ZaLw1+UWOnW9hvWF duYHRsn4VF/3j/DjM2FzoZNRIP8kzB+XfRErnfo+OpqMwSsDvf5WqptIUgJ6k+SSDCHQ fP0hWD2AQ/XqVClcvb8MxkifScBYeaVBy+mtPZdZoh7B3fLeA73I0jxY/SXc7CKZhbd4 gQqg== X-Gm-Message-State: AN3rC/4G5jCEqLKYUJ1be/s4V2+deEnROfMBX2tLmxq/M02YXTexzyUG pctPyzkMt59WBJmWE8w= X-Received: by 10.55.45.134 with SMTP id t128mr25712763qkh.247.1493753002481; Tue, 02 May 2017 12:23:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 2 May 2017 12:22:48 -0700 Message-Id: <20170502192300.2124-14-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170502192300.2124-1-rth@twiddle.net> References: <20170502192300.2124-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::241 Subject: [Qemu-devel] [PATCH v6 13/25] tcg/aarch64: Implement goto_ptr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Measurements: SPECint06 (test set), x86_64-linux-user. Host: APM 64= -bit ARMv8 (Atlas/A57) @ 2.4 GHz 1.45x +-+-----------------------------------------------------------------= --------------------------------------------+-+ | ***** = | | +++ * * = +goto-ptr | 1.4x +-+...*****............................*...*........................= ............................................+-+ | *+++* * * = +++ | 1.35x +-+...*...*............................*...*........................= ...*****....................................+-+ | * * * * = *+++* | | * * * * = * * | 1.3x +-+...*...*............................*...*........................= ...*...*....................................+-+ | * * * * = * * | | * * * * = * * ***** | 1.25x +-+...*...*...........*****............*...*........................= ...*...*............*****...*...*...........+-+ | * * * * * * = * * *+++* * * | 1.2x +-+...*...*...........*...*............*...*........................= ...*...*............*...*...*...*...........+-+ | * * * * * * = * * * * * * | | * * * * * * = * * * * * * ***** | 1.15x +-+...*...*...........*...*............*...*........................= ...*...*............*...*...*...*...*...*...+-+ | * * * * * * = * * +++ * * * * * * | | * * * * * * = * * ***** * * * * * * | 1.1x +-+...*...*...........*...*....*****...*...*...*****................= ...*...*...*...*....*...*...*...*...*...*...+-+ | * * * * * * * * * * = * * * * * * * * * * | 1.05x +-+...*...*...........*...*....*...*...*...*...*...*................= ...*...*...*...*....*...*...*...*...*...*...+-+ | * * ***** * * * * * * * * = * * * * * * * * * * | | * * * * * * * * * * * * ***** *****= * * * * * * * * * * | 1x +-+---*****---*****---*****----*****---*****---*****---*****---*****= ---*****---*****----*****---*****---*****---+-+ astar bzip2 gcc gobmk h264ref hmmlibquantum mcf om= netpperlbench sjenxalancbmk hmean png: http://imgur.com/en9HE8L Tested-by: Emilio G. Cota Signed-off-by: Richard Henderson Reviewed-by: Aurelien Jarno --- tcg/aarch64/tcg-target.h | 2 +- tcg/aarch64/tcg-target.inc.c | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index b82eac4..55a46ac 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -77,7 +77,7 @@ typedef enum { #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 -#define TCG_TARGET_HAS_goto_ptr 0 +#define TCG_TARGET_HAS_goto_ptr 1 =20 #define TCG_TARGET_HAS_div_i64 1 #define TCG_TARGET_HAS_rem_i64 1 diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 290de6d..5f18545 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -1357,8 +1357,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 switch (opc) { case INDEX_op_exit_tb: - tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0); - tcg_out_goto(s, tb_ret_addr); + /* Reuse the zeroing that exists for goto_ptr. */ + if (a0 =3D=3D 0) { + tcg_out_goto(s, s->code_gen_epilogue); + } else { + tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0); + tcg_out_goto(s, tb_ret_addr); + } break; =20 case INDEX_op_goto_tb: @@ -1374,6 +1379,10 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, s->tb_jmp_reset_offset[a0] =3D tcg_current_code_size(s); break; =20 + case INDEX_op_goto_ptr: + tcg_out_insn(s, 3207, BR, a0); + break; + case INDEX_op_br: tcg_out_goto_label(s, arg_label(a0)); break; @@ -1735,6 +1744,7 @@ static const TCGTargetOpDef aarch64_op_defs[] =3D { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_br, { } }, + { INDEX_op_goto_ptr, { "r" } }, =20 { INDEX_op_ld8u_i32, { "r", "r" } }, { INDEX_op_ld8s_i32, { "r", "r" } }, @@ -1942,6 +1952,14 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); tcg_out_insn(s, 3207, BR, tcg_target_call_iarg_regs[1]); =20 + /* + * Return path for goto_ptr. Set return value to 0, a-la exit_tb, + * and fall through to the rest of the epilogue. + */ + s->code_gen_epilogue =3D s->code_ptr; + tcg_out_movi(s, TCG_TYPE_REG, TCG_REG_X0, 0); + + /* TB epilogue */ tb_ret_addr =3D s->code_ptr; =20 /* Remove TCG locals stack space. */ --=20 2.9.3