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: 111989 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp765986ybm; Thu, 7 Sep 2017 15:54:12 -0700 (PDT) X-Received: by 10.55.201.5 with SMTP id q5mr1239686qki.31.1504824852746; Thu, 07 Sep 2017 15:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504824852; cv=none; d=google.com; s=arc-20160816; b=GD222M0L/RopIqvR/FEK9MgTilz9mwAMz7qsPA+b+imrlex8+Orhytj1hWpWJvL5oj tBqfiWubNBsYG5/zEpwrCFnaSdxV0aK6SFGYpwB68U4PGUlFTQA5XvAIUXGbcmHlnu5N iGgkY73CAM10TBUWg6OaztYNqzNOh0H9LuQlAz4HVqTo9w5MEOmA37i7kc+NdrP4vuRh 5b/oBSERwWM9UZMkh64ms+DKly1BlMO9NguzchRPyKAtbEzTX/gp70PivfmjKncEg4yp KX5z8OCwKUrQRi6MIinate8Jg5wP/pj/QENLkmngYvAKqWzeG1N0ed+vvj4gscX9lki1 sqvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=H+LLtzCzH8QndIjCRi1FVfoNlieFGUHJ+Q0JqTEk1F0=; b=d0/5PHIktdyndFozSZNnrobhQYIlpvvAu8UoKdhlv02idNFbqnIGkaTED4XiIJ86Aj w3fFoJr01XjnEhyp8s/I30jlwOa4wgOek/1L8mJYwyLxWIkzPjHhLqdxL78fsgUoKBVo PKCH+ej/gEqDW9ofhSK29z7KanvWxaSPuBkll0zWHBCSKvubmXQLZ6wajQC8GZm2+9Ta 4IvwAs/Y5XkxK188AIJxGHkj4Ah4FRWaNZd1Vw7TYRM10xhHSrUtt+n0aHPTrd9mzVBr vnUHsadea1fQ/DpmKRpECXxzoPEeJ0yn0aMwdpvsO+Yr5SE1Ve9+/XscDNh8XxthrgPM 6yTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KMfepWU1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x90si529619qtd.515.2017.09.07.15.54.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Sep 2017 15:54:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KMfepWU1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq5gY-0005X3-Nj for patch@linaro.org; Thu, 07 Sep 2017 18:54:10 -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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.13.5 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