From patchwork Thu Aug 31 02:57:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 718942 Delivered-To: patch@linaro.org Received: by 2002:adf:e5c2:0:b0:31d:da82:a3b4 with SMTP id a2csp241318wrn; Wed, 30 Aug 2023 19:58:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFhwvN5uzSS+t8J8diVu+hhYl03iZg3o1BADXG/WIexITeLYuIeF5AdqB088qO+rqz6e7n9 X-Received: by 2002:a05:622a:199f:b0:410:a895:21fd with SMTP id u31-20020a05622a199f00b00410a89521fdmr1910785qtc.23.1693450717604; Wed, 30 Aug 2023 19:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693450717; cv=none; d=google.com; s=arc-20160816; b=jqFLFfV4MF8UyYvBNq12Ptf5pXiKyCc/FZmNSYW4V388Hq579Qsc8aJ3tVfDPxUJpy DJOKDIIyss0sx3aB0Nlze7gaxs7gAEXk7BZVa+7AJoFtDYsI7JdAZyLBAYNb3uwR2Phw dlt+sJOEcDDn5aSeHYoZMxQyokji9wRQMHI7LbRDmblXqxMnD18fzgkTMzg1n9144+Yq B3RIxw0yGStdCp2wX5wadLjn/jfYqiqZ9REGfEB//uCnEm4HOrpFiJxDZyv3nJwz3kGk OhgRGrFPfzHZgl9qnAUl1QQNOGNfh8woMazxIa8jfmCNLsZsBsYQfvVSDIEn09GAdCTv pssg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=xmYRGdMxU32xHJwVCt1KMNjds4d5uoJumow+DOzr+1w=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=jokR2KapYbtjBj6vlkHuG5wk0I7mA3vxBTCJm8BdpnAmcsRQtDG4Q6EU5K8tx0Lpic vO1szN2Zmo+ou8BUQvI4YXBCzLOTxDMAo2jRAEg/D3T2eWgGURcBiHJ2MUCfR3kWAJ/E R4MRhY0H7YxkqBFJRg4wAHPNi3xfVvk+YYJ3fe/J63SD7W2EiZeVKYGMwi7N/5aWcmF8 WaJznrt5RBP99J+w5ngU6jTP5BDjcX8d0h2gwb/bjkvafxdJvdvuiR3z+azZHIAFRTvp 0Cg6j8lDpbAuPpOPlE4xSSWlLyk68LszThYMWLVRDrbn+SgxRGfsJUtzoX1BHsQxgEBt s+zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EFWL/QcN"; 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 p6-20020a05622a048600b00403fbb9a8a5si272923qtx.269.2023.08.30.19.58.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Aug 2023 19:58:37 -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="EFWL/QcN"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbXsG-0004sP-SW; Wed, 30 Aug 2023 22:57:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbXsG-0004s1-28 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 22:57:36 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbXsD-0007oI-LH for qemu-devel@nongnu.org; Wed, 30 Aug 2023 22:57:35 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1bf11b1c7d0so10588475ad.0 for ; Wed, 30 Aug 2023 19:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693450652; x=1694055452; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xmYRGdMxU32xHJwVCt1KMNjds4d5uoJumow+DOzr+1w=; b=EFWL/QcNs37Y7Fp1V5RavE1qTMXs37gNRePL4bxW6g2d9/ewsGeom+uv8Wlgz6RXBA j0gbHC6sng67RWB1pE43aXC9FYYU6v+opYKWrTxJBRtcOz0TOGRoupeRvED6tpPwcx+7 nhEh53FWWCME+X520HCUoxTVyWVDlJqvz9PuAt7PNUjTykSjoCkKA6hRCAHGKTjjPIeJ uk5k1vPSPEccGsWb4hbLtgGvPyBmfeklBND2OuMgWYPU7LWbwybgWTFtKGVKgiHniK+p /8Yq7ZIMu1ejUBjQ/LtOwaSfpy89KmXeXHiVShCF8XbI/9CkApwKeX1IWXGPMsTyuLgo +CrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693450652; x=1694055452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xmYRGdMxU32xHJwVCt1KMNjds4d5uoJumow+DOzr+1w=; b=M2Q0XUgwGfpEogni4WNhoXvHnDungMC3B/Sz9DUzukKgiAiZfNpHv62WKoV1+nlurP mP8vz0h52ULE7Ri7YMD5FnVnQfu/Kbirt7uqEvR6/QPazI/nlObgiA/hVRh8MeO32VcX YHM86y2EkvJUGDQd336N6v9ycCtVPpC8j47fd0vZrwHRTxU5hUI8aBymrbLqwyQj8Sd5 OmuT3Pgr2iP2J7W5zgx1X8ojtuVGTXQ2fDskfEcYe8yKeO3z/JTeV/cX0OVtuUqDpRRh YLlERyOeR6UltRc6xdNo5JcgvAci4eABhDNdkpEt54i86ipejXZRryOp40zOYyBkdBzg FZ4A== X-Gm-Message-State: AOJu0YzOyAKZfbpRDx9l2xL44KYpnpOhK1cr3wllpJbZVGcwhDrF7vhK JjXN6kVh51+P2hqug+XxOTIcNxchu5CtNEoD88s= X-Received: by 2002:a17:90b:91:b0:26d:5c07:ae3e with SMTP id bb17-20020a17090b009100b0026d5c07ae3emr2079071pjb.4.1693450652232; Wed, 30 Aug 2023 19:57:32 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id dw24-20020a17090b095800b00265c742a262sm288142pjb.4.2023.08.30.19.57.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 19:57:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/4] tcg: Don't free vector results Date: Wed, 30 Aug 2023 19:57:26 -0700 Message-Id: <20230831025729.1194388-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230831025729.1194388-1-richard.henderson@linaro.org> References: <20230831025729.1194388-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Avoid reusing vector temporaries so that we may re-use them when propagating stores to loads. Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 39 ++++++--------------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index e260a07c61..f5cfd9bf99 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -561,7 +561,6 @@ static void do_dup(unsigned vece, uint32_t dofs, uint32_t oprsz, tcg_gen_dupi_vec(vece, t_vec, in_c); } do_dup_store(type, dofs, oprsz, maxsz, t_vec); - tcg_temp_free_vec(t_vec); return; } @@ -1036,8 +1035,6 @@ static void expand_2_vec(unsigned vece, uint32_t dofs, uint32_t aofs, fni(vece, t1, t0); tcg_gen_st_vec(t1, cpu_env, dofs + i); } - tcg_temp_free_vec(t0); - tcg_temp_free_vec(t1); } /* Expand OPSZ bytes worth of two-vector operands and an immediate operand @@ -1059,8 +1056,6 @@ static void expand_2i_vec(unsigned vece, uint32_t dofs, uint32_t aofs, fni(vece, t1, t0, c); tcg_gen_st_vec(t1, cpu_env, dofs + i); } - tcg_temp_free_vec(t0); - tcg_temp_free_vec(t1); } static void expand_2s_vec(unsigned vece, uint32_t dofs, uint32_t aofs, @@ -1081,8 +1076,6 @@ static void expand_2s_vec(unsigned vece, uint32_t dofs, uint32_t aofs, } tcg_gen_st_vec(t1, cpu_env, dofs + i); } - tcg_temp_free_vec(t0); - tcg_temp_free_vec(t1); } /* Expand OPSZ bytes worth of three-operand operations using host vectors. */ @@ -1105,9 +1098,6 @@ static void expand_3_vec(unsigned vece, uint32_t dofs, uint32_t aofs, fni(vece, t2, t0, t1); tcg_gen_st_vec(t2, cpu_env, dofs + i); } - tcg_temp_free_vec(t2); - tcg_temp_free_vec(t1); - tcg_temp_free_vec(t0); } /* @@ -1134,9 +1124,6 @@ static void expand_3i_vec(unsigned vece, uint32_t dofs, uint32_t aofs, fni(vece, t2, t0, t1, c); tcg_gen_st_vec(t2, cpu_env, dofs + i); } - tcg_temp_free_vec(t0); - tcg_temp_free_vec(t1); - tcg_temp_free_vec(t2); } /* Expand OPSZ bytes worth of four-operand operations using host vectors. */ @@ -1162,10 +1149,6 @@ static void expand_4_vec(unsigned vece, uint32_t dofs, uint32_t aofs, tcg_gen_st_vec(t1, cpu_env, aofs + i); } } - tcg_temp_free_vec(t3); - tcg_temp_free_vec(t2); - tcg_temp_free_vec(t1); - tcg_temp_free_vec(t0); } /* @@ -1191,10 +1174,6 @@ static void expand_4i_vec(unsigned vece, uint32_t dofs, uint32_t aofs, fni(vece, t0, t1, t2, t3, c); tcg_gen_st_vec(t0, cpu_env, dofs + i); } - tcg_temp_free_vec(t3); - tcg_temp_free_vec(t2); - tcg_temp_free_vec(t1); - tcg_temp_free_vec(t0); } /* Expand a vector two-operand operation. */ @@ -1732,7 +1711,6 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, TCGv_vec t_vec = tcg_temp_new_vec(type); tcg_gen_dup_mem_vec(vece, t_vec, cpu_env, aofs); do_dup_store(type, dofs, oprsz, maxsz, t_vec); - tcg_temp_free_vec(t_vec); } else if (vece <= MO_32) { TCGv_i32 in = tcg_temp_ebb_new_i32(); switch (vece) { @@ -1766,7 +1744,6 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, for (i = (aofs == dofs) * 16; i < oprsz; i += 16) { tcg_gen_st_vec(in, cpu_env, dofs + i); } - tcg_temp_free_vec(in); } else { TCGv_i64 in0 = tcg_temp_ebb_new_i64(); TCGv_i64 in1 = tcg_temp_ebb_new_i64(); @@ -1796,7 +1773,6 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, for (i = (aofs == dofs) * 32; i < oprsz; i += 32) { tcg_gen_st_vec(in, cpu_env, dofs + i); } - tcg_temp_free_vec(in); } else if (TCG_TARGET_HAS_v128) { TCGv_vec in0 = tcg_temp_new_vec(TCG_TYPE_V128); TCGv_vec in1 = tcg_temp_new_vec(TCG_TYPE_V128); @@ -1807,8 +1783,6 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, tcg_gen_st_vec(in0, cpu_env, dofs + i); tcg_gen_st_vec(in1, cpu_env, dofs + i + 16); } - tcg_temp_free_vec(in0); - tcg_temp_free_vec(in1); } else { TCGv_i64 in[4]; int j; @@ -3137,14 +3111,14 @@ static void expand_2sh_vec(unsigned vece, uint32_t dofs, uint32_t aofs, void (*fni)(unsigned, TCGv_vec, TCGv_vec, TCGv_i32)) { TCGv_vec t0 = tcg_temp_new_vec(type); + TCGv_vec t1 = tcg_temp_new_vec(type); uint32_t i; for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t0, cpu_env, aofs + i); - fni(vece, t0, t0, shift); - tcg_gen_st_vec(t0, cpu_env, dofs + i); + fni(vece, t1, t0, shift); + tcg_gen_st_vec(t1, cpu_env, dofs + i); } - tcg_temp_free_vec(t0); } static void @@ -3722,16 +3696,15 @@ static void expand_cmp_vec(unsigned vece, uint32_t dofs, uint32_t aofs, { TCGv_vec t0 = tcg_temp_new_vec(type); TCGv_vec t1 = tcg_temp_new_vec(type); + TCGv_vec t2 = tcg_temp_new_vec(type); uint32_t i; for (i = 0; i < oprsz; i += tysz) { tcg_gen_ld_vec(t0, cpu_env, aofs + i); tcg_gen_ld_vec(t1, cpu_env, bofs + i); - tcg_gen_cmp_vec(cond, vece, t0, t0, t1); - tcg_gen_st_vec(t0, cpu_env, dofs + i); + tcg_gen_cmp_vec(cond, vece, t2, t0, t1); + tcg_gen_st_vec(t2, cpu_env, dofs + i); } - tcg_temp_free_vec(t1); - tcg_temp_free_vec(t0); } void tcg_gen_gvec_cmp(TCGCond cond, unsigned vece, uint32_t dofs,