From patchwork Fri May 8 18:26:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186434 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp233981ill; Fri, 8 May 2020 11:38:13 -0700 (PDT) X-Google-Smtp-Source: APiQypJ8e2eOv5v6qwAYJlS65yJr+cpMKZHyjly5CRsY4jc/uT5ooHB3wlpOPLyWJKsO/0yLFKHE X-Received: by 2002:aed:2766:: with SMTP id n93mr4471258qtd.130.1588963092990; Fri, 08 May 2020 11:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588963092; cv=none; d=google.com; s=arc-20160816; b=LpQRP0Q5+WUTl0lPW5UuONbcVIrnCsQYzBfOF1ugljsNTvjW+8ms+JIzwK4ScTwPuH uHnCNFoH5k5pA3VURw9rdHoun4WKPUZcxkhwVzpMITo8LT2fPeIC3r1ztR022cP85T/T H2Ac3cp8OPP4IwCIjVDlXQs+zNXmrA1XuvVGwaoj8Hh84sPZas+VTsiTrCrI0hp0aG5T AYv2zjTpix7hqCBZJOcGii94Ae2d2MIM0xyPJzOfTQhBmyhASUXckNY1W1MQoYu5u2KD Xu8CIxzRihhJb8fqeU/aHWeVfiFmOYP4lZFjo2VMHyh9U5CeF5TRNzN1KWbAaIFViRmK QJpQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=S9HEQQM80hO+EVGsjJ9OBeqQuwE6gwF9XnDO8sH6oUM=; b=HrlJQnhn9esvh2eKAktx7rUDLlOzj/SVlWKr6iVXdGWavFWdrK0qCj/CMSsOxP6Ys8 xzztYW5iuCAvyw8qXYd61doIqxdwJoNpXqBDmxwbnrle+infOVXA6etKI/rapCvwX0VJ usvuCEsctk0K5gnVh/C3BHoLKi1AlA8q63ZGCEY0mnVAeDu8R7eDIhtxGe+T0RU+i1/Q u6x7U11aoijmxYSKwBNQiB2WyXQm0VE2fB72rEhUroxv47+VOM8XeUkLtr8HmXOF06oP sKDGwnhOzyYpbaufhXEYF2OXfWLIAE4sj6EtPIWqB+FeNn2aRWrptNftMMDJfvcpOW2/ UrBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yT9P6ni7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k10si1616972qvq.24.2020.05.08.11.38.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:38:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yT9P6ni7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7sy-0007OP-Hc for patch@linaro.org; Fri, 08 May 2020 14:38:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7hr-00075T-9p for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:43 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:45820) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hq-0007Ns-22 for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:42 -0400 Received: by mail-pf1-x444.google.com with SMTP id w65so1358296pfc.12 for ; Fri, 08 May 2020 11:26:41 -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 :mime-version:content-transfer-encoding; bh=S9HEQQM80hO+EVGsjJ9OBeqQuwE6gwF9XnDO8sH6oUM=; b=yT9P6ni74P3IIwieb67fGOaBD0u0dLBSpPr/XJiQsXDki3FqrlDxV5uPoK+DXw9OfZ x0e8SQwUPIInV0cjOsWi001MNH2Im7UfZGnBXdmm+NcarvlSPsea5ddWyCJzZOZoAsIy Cj8p2JtkErm4fMacfNS1Gd1SRLJRDxqr5005rppexrciD2CfVoDtiUG8liq9AGqQbysv t8VTbLM3N/1ILAum1OGlgsBtp6XvMJwaRgcwy/yYfZC9K2wY2vrAQPF2xqYe/WUHlLBE KwOUU+iuOVKwb0iuxuAJfVTLZtL2y2jeAg+CdyK0/GHmHxDaxc0EWCRqMX8jJt+/reUp 02+w== 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:mime-version:content-transfer-encoding; bh=S9HEQQM80hO+EVGsjJ9OBeqQuwE6gwF9XnDO8sH6oUM=; b=JUe3pK5bQLFgBU2AgppXPvsKjLC67fDJLX/UYvAtfyQzkTj1KWaR9Pf9I/CUMyQysR VRP6ezkPmt2wk3rdv6Gy2OXHjX0TdeCKXX/cEW7ytov/wnTDUR2tPtiJxDR+8ws2r1xx JgGhC7Q4s8VRY/D4fD1Wqb16zVRNWk0vp7Z9rHLj26IL5be875jXpHt/mdpKk1YrlxwH UirtNeYn3sPJ0lzUGJ9hQoDZeOq4BFEgJtc5Ga5x2MnCQD/LNQhJ3I25AVeGXs5nxQNv Fw9TFMm6O9mmSuFK3pwCpEt0w2ZtQsenugOURGfoj+1+s0c9bSaMiyKKfgUoTSAeFZdH 74Xg== X-Gm-Message-State: AGi0Puak9EnstlRL9tQtIyk1iEJ0Rcg/h70XUX0qkyif+g79E51ONBNJ uG7kC5xrg8AjrhdHyI3dI03EjOL5r2Q= X-Received: by 2002:a62:1415:: with SMTP id 21mr4116155pfu.203.1588962400203; Fri, 08 May 2020 11:26:40 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 16/19] tcg: Increase tcg_out_dupi_vec immediate to int64_t Date: Fri, 8 May 2020 11:26:13 -0700 Message-Id: <20200508182616.18318-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::444; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" While we don't store more than tcg_target_long in TCGTemp, we shouldn't be limited to that for code generation. We will be able to use this for INDEX_op_dup2_vec with 2 constants. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.inc.c | 2 +- tcg/i386/tcg-target.inc.c | 20 ++++++++++++-------- tcg/ppc/tcg-target.inc.c | 15 ++++++++------- tcg/tcg.c | 4 ++-- 4 files changed, 23 insertions(+), 18 deletions(-) -- 2.20.1 diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index a7b1d36494..82b409ca7d 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -857,7 +857,7 @@ static void tcg_out_logicali(TCGContext *s, AArch64Insn insn, TCGType ext, } static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg rd, tcg_target_long v64) + TCGReg rd, int64_t v64) { bool q = type == TCG_TYPE_V128; int cmode, imm8, i; diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 4118071dd9..5e73e5d02b 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -945,7 +945,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, } static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg ret, tcg_target_long arg) + TCGReg ret, int64_t arg) { int vex_l = (type == TCG_TYPE_V256 ? P_VEXL : 0); @@ -958,7 +958,14 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, return; } - if (TCG_TARGET_REG_BITS == 64) { + if (TCG_TARGET_REG_BITS == 32 && arg == dup_const(MO_32, arg)) { + if (have_avx2) { + tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTW + vex_l, ret); + } else { + tcg_out_vex_modrm_pool(s, OPC_VBROADCASTSS, ret); + } + new_pool_label(s, arg, R_386_32, s->code_ptr - 4, 0); + } else { if (type == TCG_TYPE_V64) { tcg_out_vex_modrm_pool(s, OPC_MOVQ_VqWq, ret); } else if (have_avx2) { @@ -966,14 +973,11 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, } else { tcg_out_vex_modrm_pool(s, OPC_MOVDDUP, ret); } - new_pool_label(s, arg, R_386_PC32, s->code_ptr - 4, -4); - } else { - if (have_avx2) { - tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTW + vex_l, ret); + if (TCG_TARGET_REG_BITS == 64) { + new_pool_label(s, arg, R_386_PC32, s->code_ptr - 4, -4); } else { - tcg_out_vex_modrm_pool(s, OPC_VBROADCASTSS, ret); + new_pool_l2(s, R_386_32, s->code_ptr - 4, 0, arg, arg >> 32); } - new_pool_label(s, arg, R_386_32, s->code_ptr - 4, 0); } } diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 7111da34dd..3f9690418f 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -913,7 +913,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, } static void tcg_out_dupi_vec(TCGContext *s, TCGType type, TCGReg ret, - tcg_target_long val) + int64_t val) { uint32_t load_insn; int rel, low; @@ -921,20 +921,20 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, TCGReg ret, low = (int8_t)val; if (low >= -16 && low < 16) { - if (val == (tcg_target_long)dup_const(MO_8, low)) { + if (val == dup_const(MO_8, low)) { tcg_out32(s, VSPLTISB | VRT(ret) | ((val & 31) << 16)); return; } - if (val == (tcg_target_long)dup_const(MO_16, low)) { + if (val == dup_const(MO_16, low)) { tcg_out32(s, VSPLTISH | VRT(ret) | ((val & 31) << 16)); return; } - if (val == (tcg_target_long)dup_const(MO_32, low)) { + if (val == dup_const(MO_32, low)) { tcg_out32(s, VSPLTISW | VRT(ret) | ((val & 31) << 16)); return; } } - if (have_isa_3_00 && val == (tcg_target_long)dup_const(MO_8, val)) { + if (have_isa_3_00 && val == dup_const(MO_8, val)) { tcg_out32(s, XXSPLTIB | VRT(ret) | ((val & 0xff) << 11)); return; } @@ -956,14 +956,15 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, TCGReg ret, if (TCG_TARGET_REG_BITS == 64) { new_pool_label(s, val, rel, s->code_ptr, add); } else { - new_pool_l2(s, rel, s->code_ptr, add, val, val); + new_pool_l2(s, rel, s->code_ptr, add, val >> 32, val); } } else { load_insn = LVX | VRT(ret) | RB(TCG_REG_TMP1); if (TCG_TARGET_REG_BITS == 64) { new_pool_l2(s, rel, s->code_ptr, add, val, val); } else { - new_pool_l4(s, rel, s->code_ptr, add, val, val, val, val); + new_pool_l4(s, rel, s->code_ptr, add, + val >> 32, val, val >> 32, val); } } diff --git a/tcg/tcg.c b/tcg/tcg.c index a84a9d3d63..18ebcc98f6 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -117,7 +117,7 @@ static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, TCGReg dst, TCGReg base, intptr_t offset); static void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg dst, tcg_target_long arg); + TCGReg dst, int64_t arg); static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, unsigned vecl, unsigned vece, const TCGArg *args, const int *const_args); @@ -133,7 +133,7 @@ static inline bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, g_assert_not_reached(); } static inline void tcg_out_dupi_vec(TCGContext *s, TCGType type, - TCGReg dst, tcg_target_long arg) + TCGReg dst, int64_t arg) { g_assert_not_reached(); }