From patchwork Thu Sep 7 22:40:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9942915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BF773604D5 for ; Thu, 7 Sep 2017 22:54:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A37D526D08 for ; Thu, 7 Sep 2017 22:54:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 951C7274A3; Thu, 7 Sep 2017 22:54:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0F9A426D08 for ; Thu, 7 Sep 2017 22:54:57 +0000 (UTC) Received: from localhost ([::1]:42567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq5hI-0005X3-Be for patchwork-qemu-devel@patchwork.kernel.org; Thu, 07 Sep 2017 18:54:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq5UK-0003JO-NQ for qemu-devel@nongnu.org; Thu, 07 Sep 2017 18:41:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq5UG-0008TD-3w for qemu-devel@nongnu.org; Thu, 07 Sep 2017 18:41:32 -0400 Received: from mail-pf0-x22e.google.com ([2607:f8b0:400e:c00::22e]:35371) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dq5UF-0008RY-Ug for qemu-devel@nongnu.org; Thu, 07 Sep 2017 18:41:28 -0400 Received: by mail-pf0-x22e.google.com with SMTP id g13so1630320pfm.2 for ; Thu, 07 Sep 2017 15:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H+LLtzCzH8QndIjCRi1FVfoNlieFGUHJ+Q0JqTEk1F0=; b=KMfepWU1BTFsCzpiWSnTJDsNNF9XY8dKxpBTharm/iIT8MtltxGTkj65GxVIjyp2Mi UulfwoC3NDp8NeO+BwTl7oahTZ0ZrB8jDuglZ/28r+hOnu1jxZ77Lx+2DdAegF0AJhOy UlbyISnU8+SsH2VFZDfdlkpofR3XGk60wm5wM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H+LLtzCzH8QndIjCRi1FVfoNlieFGUHJ+Q0JqTEk1F0=; b=Wv39fhSxtgf4ti3wo0E/ZOvpXiVc8IHRs489cvOMsHHyMxqWGiwem1zRY4QZxTDJRx oXfDNYR1D+tIhLzGXjVvPS/nY5NhXt5Em/PjYJWQ2eNkH95+bu0bUglks/Gnh2QUOSnt CYprO4OEAzGpUyQe+V6gCVwsEslQJ2S2fTyBBzW3zPhR9m0pukOgULyl3LA88cSQEtHe q3LUQokD0UxOsaAZnsLYudJjqheaZ+ZsvlbyPANJOKwFYylwdxdqnjviLB/7WE2ogif/ QiXlJJ18DktlFpdHL4I9OwuY21O2RbnINzw/nq90yI/XuU1oFjkjqcekBUVSCy0D53Am A6qQ== X-Gm-Message-State: AHPjjUiVV6P/JMXcLytgcDB8fdjlUbO0f4TelamjsG2MfNMFieY9p96e c1RFpyn7NeB37+VOzq8zUA== X-Google-Smtp-Source: ADKCNb580RProykv/FtOjQxwThKgfLAMc9hggbh/lJjN2aIJe2BcNjzz7mlm8RCzdsxi2b79CxpXMA== X-Received: by 10.99.130.198 with SMTP id w189mr919111pgd.175.1504824086701; Thu, 07 Sep 2017 15:41:26 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id h19sm770678pfh.142.2017.09.07.15.41.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 15:41:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 15:40:51 -0700 Message-Id: <20170907224051.21518-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170907224051.21518-1-richard.henderson@linaro.org> References: <20170907224051.21518-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::22e Subject: [Qemu-devel] [PULL 23/23] tcg/ppc: Use constant pool for movi 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: peter.maydell@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Richard Henderson Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.h | 1 + tcg/ppc/tcg-target.inc.c | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index 3772cc6648..be52ad1d2e 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -132,5 +132,6 @@ void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t); #ifdef CONFIG_SOFTMMU #define TCG_TARGET_NEED_LDST_LABELS #endif +#define TCG_TARGET_NEED_POOL_LABELS #endif diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index df709c4a96..21d764c102 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -22,6 +22,9 @@ * THE SOFTWARE. */ +#include "elf.h" +#include "tcg-pool.inc.c" + #if defined _CALL_DARWIN || defined __APPLE__ #define TCG_TARGET_CALL_DARWIN #endif @@ -58,8 +61,6 @@ static tcg_insn_unit *tb_ret_addr; -#include "elf.h" - bool have_isa_2_06; bool have_isa_3_00; @@ -224,9 +225,12 @@ static inline void tcg_out_bc_noaddr(TCGContext *s, int insn) static void patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { - tcg_insn_unit *target = (tcg_insn_unit *)value; + tcg_insn_unit *target; + tcg_insn_unit old; + + value += addend; + target = (tcg_insn_unit *)value; - tcg_debug_assert(addend == 0); switch (type) { case R_PPC_REL14: reloc_pc14(code_ptr, target); @@ -234,6 +238,12 @@ static void patch_reloc(tcg_insn_unit *code_ptr, int type, case R_PPC_REL24: reloc_pc24(code_ptr, target); break; + case R_PPC_ADDR16: + assert(value == (int16_t)value); + old = *code_ptr; + old = deposit32(old, 0, 16, value); + *code_ptr = old; + break; default: tcg_abort(); } @@ -676,6 +686,14 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, return; } + /* Use the constant pool, if possible. */ + if (!in_prologue && USE_REG_TB) { + new_pool_label(s, arg, R_PPC_ADDR16, s->code_ptr, + -(intptr_t)s->code_gen_ptr); + tcg_out32(s, LD | TAI(ret, TCG_REG_TB, 0)); + return; + } + tmp = arg >> 31 >> 1; tcg_out_movi(s, TCG_TYPE_I32, ret, tmp); if (tmp) { @@ -1858,6 +1876,14 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64) #endif } +static void tcg_out_nop_fill(tcg_insn_unit *p, int count) +{ + int i; + for (i = 0; i < count; ++i) { + p[i] = NOP; + } +} + /* Parameters for function call generation, used in tcg.c. */ #define TCG_TARGET_STACK_ALIGN 16 #define TCG_TARGET_EXTEND_ARGS 1