From patchwork Wed Apr 22 01:17:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185616 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp161077ilf; Tue, 21 Apr 2020 18:19:05 -0700 (PDT) X-Google-Smtp-Source: APiQypLj/OXBxRqiiT0IdGFyDo3pTJnjZrsTRQiGdf+7aIE6cwOypKkbAPp5v5NJOrZKnEwBrWFQ X-Received: by 2002:ac8:3466:: with SMTP id v35mr24174711qtb.308.1587518345512; Tue, 21 Apr 2020 18:19:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518345; cv=none; d=google.com; s=arc-20160816; b=CORJtAThZE+k6C8pI3FoQfUOVIV8+1F9MS/SnpQooejIpuzxYQVV2HhMTXUX/Vvuyx bVIIPH9teg4F2G5L8b+IilXNfPjjxtDhyRcuAO1M8SwctQAaRsHoHOmFAdO3lHP06ywE unhBR8yEKUWU7RgjLk+caPucMpVBhmz3hwT3h2jr0fr7OiKAHedvAliD1BbIC+WlXhC2 mrDKhrs35c1LWFFdV+frkKV4JprrJeAGxOMWdxKYOQldAdCTHMr2k2sanR/uPXxlD860 ih7PbcbVzA3X/KyKFkvYFbo0Iw11MdmcvpGaOgYIwP5ZTNqiBk0tIcXbxn9LEbTa8BQp eE1Q== 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=zkNLdD4lJapTD7P5RW5mO/2wUgiJHORElGCA3liJ3rI=; b=za1RmOMAgKwyg3/qj/Dbmbum/hD5Xd5FcBUsvWSQcJrXkpr3M5HXYZAuk8xDQ9ugco J1TegwznYKmDw1YnU1EfGutrV+tOItsCppBsnUh+394PvIZ6J26B2f5m1b84bvrWDPGT bVT9eR7vOSdZaaVZWSJJrmy9ZAbEltI+X4qVxjmtrYKvdtjOhA+z/Z9+BqDlYJ9hB+qo RgjL/yvKx9UqIEh96Ng4HkByqd/exCTeZs4cKY3kzX97wHcjH+sQcAsccIPCt0/9WEv8 cJuCfy0yyZO3ujlWIlxEMVXRWPXDhUr65BSv4dXyNq/IEZbBEZk4REX/vgDk3kGD7+P7 m0gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aHcIYtbC; 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 j32si2318713qtb.347.2020.04.21.18.19.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:19:05 -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=aHcIYtbC; 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]:38518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR42a-0001us-VD for patch@linaro.org; Tue, 21 Apr 2020 21:19:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35536) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41S-0001pz-Ut for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41S-0002Gq-2v for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:54 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:46719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41R-0002BW-IR for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:53 -0400 Received: by mail-pg1-x543.google.com with SMTP id j7so237383pgj.13 for ; Tue, 21 Apr 2020 18:17:53 -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=zkNLdD4lJapTD7P5RW5mO/2wUgiJHORElGCA3liJ3rI=; b=aHcIYtbCvJoAiWpeMUYEnhwEUU14jrmGgRBo5HDXpieN7t622WBHAEkEaePZNPAzM9 BwqQ1BuzXS1qOwFEMB42A8+Lml2L6IOZwQibO4oNJnEx3osHEDI0hlL5FBpdlIvrxv+4 es9nMzNXJfqhEFI9XsrjI2j3OP8HDAzJ3dZkgdB6+F2CN4U2e+y/dJCqGeX2t9GrXQLh qfzw/K+2XHIXwbZJulkJef+Yn0IFKFLhI2fH7RcZEO2VK5w3zD6isooRUapJBoVVjtG1 CH5+Nn+bI4oQh6KhF2DpRB5PLnKqKn5HgxNEgo+H057ymSVcatfhY76iyj1LmjmVm1/z M7YQ== 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=zkNLdD4lJapTD7P5RW5mO/2wUgiJHORElGCA3liJ3rI=; b=EWDNBFsMNXa6dAX/mCrQcWTSqzmI7iRZs9O0ZUwylSDzawaEBaroXFofVyEpHEpW2E Mjtmorxq1KqCELdYasUZGyGtM6XkiLHBiqru/y2RkL4FufCucu9nLOAuy2rrnH9+buP9 ljHcN8nmwtidsjCBvmoP/qPtyGvQQdxBMbuodC1j8jKZTlsFoYuTENtGHw0lexvAwZkk xK8q0GtW5t/PeQ4frzZVokcUGB4q/AM/mpfkntuYbZGqJbbeEe0bgpKngUYeKrEXIbYw GmIhwQG8IJmjg4WOIZD2CWTLi2S3Ga3VN9NkpEYWpxId6W4kX2klYlFZw1v7Fb+G/ERm i4eg== X-Gm-Message-State: AGi0PuZm+vOTiRNxY2uul1PO5hTI+CWCiM2gU6Gk8mV0zB0pQuM2oKT7 UIA1ZnXqAduzujYF8k/sT6VxcAQ9bLA= X-Received: by 2002:aa7:85c2:: with SMTP id z2mr23606747pfn.25.1587518271811; Tue, 21 Apr 2020 18:17:51 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 22/36] tcg: Increase tcg_out_dupi_vec immediate to int64_t Date: Tue, 21 Apr 2020 18:17:08 -0700 Message-Id: <20200422011722.13287-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200422011722.13287-1-richard.henderson@linaro.org> References: <20200422011722.13287-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::543; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x543.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2607:f8b0:4864:20::543 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. 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 Reviewed-by: Alex Bennée diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index e5c9ab70a9..3b5a5d78c7 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -856,7 +856,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 07424f7ef9..9cb627d6eb 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 7ab1e32064..3333b55766 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 4f1ed1d2fe..fc1c97d586 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(); }