From nobody Tue May 13 23:02:06 2025 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1677317384; cv=none; d=zohomail.com; s=zohoarc; b=aaGDzSgD5VvjTXAf30s9mIg1LazxnS3FQOoAaekqP8KUKfJ0U/mozVzQs8VPw8PaNB9h9dFjKVMh9XTsjB472wDbHFtiy7FHB3dPwnj+fDesSrrpl8OAAEXSC3xM7um+1YXTRR0ycXfzN/K3AvynMC0ua+fpFNdCaf7iMyLZsSA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677317384; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dNtcbq+YaAISCksJEqrwoDBG8G3LKrhNUHooAhzADaw=; b=oASjOuLzc7W+LXk5i6RUQyxYqk1KParz8+lbmfrb2zB2ImGBv0YZGPlZo/bebT3P3yM3SCZ38sqqCCnjApjf2purtC+lvlVbcICCdgnTKcD8m2IS7+e+ZK6SpzgDOQ8vtNukwRlVvK6WGVW0BnLUdUWBp7hB8VIyIuefsaZUmJQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1677317384382425.6517622376748; Sat, 25 Feb 2023 01:29:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVqjn-0000On-Eh; Sat, 25 Feb 2023 04:21:03 -0500 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 1pVqj2-000693-VZ for qemu-devel@nongnu.org; Sat, 25 Feb 2023 04:20:17 -0500 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVqit-00038W-Ss for qemu-devel@nongnu.org; Sat, 25 Feb 2023 04:20:14 -0500 Received: by mail-pg1-x535.google.com with SMTP id h31so921670pgl.6 for ; Sat, 25 Feb 2023 01:20:05 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id 26-20020aa7921a000000b00592417157f2sm843114pfo.148.2023.02.25.01.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 01:20:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dNtcbq+YaAISCksJEqrwoDBG8G3LKrhNUHooAhzADaw=; b=eY2XaLh2GX3YW48S3i/9Ur9hsablQ2zf3ZnZfvNzN8LvI3KoCmFHrwx+AiRrVzA304 0/woe9AIBQsH9Xf7Z6QhyKpfszFB9Btg3ZkE2tDc9H7FBisgOmssd7BerzsCG0zaXM2F ANRuZpEdQsFH/9VYrvGFevDhM2jR/ZxO9PeZ4Or/FnWX5GeoAt6U8Q1Sf+tgS6bTqqoL jWjeL/WPFMpKyE87+7IbQjOOJzqe/IclkyRAsNrvSifcg7qzJEA3oqGBqUkVA8X0WtsG X9wyKHy7c9856T6ATpeXdsf/DLYRSo2uA4XSO+uYge/BBJZMm9hP7PB0FBHTCphrHjyE Mbnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dNtcbq+YaAISCksJEqrwoDBG8G3LKrhNUHooAhzADaw=; b=dvIQ+Mbd1UY0gg/qNwFZhGH+dbxB0qmKJobQvh0Y5chTaazg8DwsHV7+dv99VfUYFM GW2hITNSFpZmactWD8zoImuL1pe7SxsdBD/ykF2ejq5Lq29HenAW2lWk/IRPwtd7Y8ob CORaQGmXFlXwF7M/T1MS5IRrueP9kNFdL/GaiQsW1tfVgXzOn9NMJXyKODriIP4UavMr KibwB1CcYYa9aVVZC7UV3RncmzyeRk8EqooGj0D3JYxB+vEX8J3ZCLQPlBvx1uEibtLd MCFWtuRHw2viZeoXVup+cHBOoaeQhn2LH38LdKd7sCOWootzgx4JdyMPJDnUoTa0e6mY X3RQ== X-Gm-Message-State: AO0yUKX9bHRTgF05RyO6rJZwJxTVAAE7ZuV0DIRC0MHR9THGoJb+pdms Y/H+dlx/Hcz2PnSmuBulaNrlXaEURzmDqE8ALxU= X-Google-Smtp-Source: AK7set9xJnaFQoiNB3bgEXQ+avmVD+1qNxT72LHaEziv5JUJe9ER47BP7HK2CnXUULdnthRhMW49eA== X-Received: by 2002:aa7:8bd3:0:b0:5c0:bced:aff with SMTP id s19-20020aa78bd3000000b005c0bced0affmr14865355pfd.5.1677316804459; Sat, 25 Feb 2023 01:20:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com, kbastian@mail.uni-paderborn.de, ysato@users.sourceforge.jp, gaosong@loongson.cn, jiaxun.yang@flygoat.com, tsimpson@quicinc.com, ale@rev.ng, mrolnik@gmail.com, edgar.iglesias@gmail.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PATCH 58/76] target/s390x: Use tcg_constant_* in translate_vx.c.inc Date: Fri, 24 Feb 2023 23:14:09 -1000 Message-Id: <20230225091427.1817156-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230225091427.1817156-1-richard.henderson@linaro.org> References: <20230225091427.1817156-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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=unavailable 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1677317386536100007 In most cases, this is a simple local allocate and free replaced by tcg_constant_*. In three cases, a variable temp was initialized with a constant value -- reorg to localize the constant. In gen_acc, this fixes a leak. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- target/s390x/tcg/translate_vx.c.inc | 45 +++++++++++++---------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/transla= te_vx.c.inc index d39ee81cd6..3fadc82e5c 100644 --- a/target/s390x/tcg/translate_vx.c.inc +++ b/target/s390x/tcg/translate_vx.c.inc @@ -319,12 +319,10 @@ static void gen_gvec128_4_i64(gen_gvec128_4_i64_fn fn= , uint8_t d, uint8_t a, static void gen_addi2_i64(TCGv_i64 dl, TCGv_i64 dh, TCGv_i64 al, TCGv_i64 = ah, uint64_t b) { - TCGv_i64 bl =3D tcg_const_i64(b); - TCGv_i64 bh =3D tcg_const_i64(0); + TCGv_i64 bl =3D tcg_constant_i64(b); + TCGv_i64 bh =3D tcg_constant_i64(0); =20 tcg_gen_add2_i64(dl, dh, al, ah, bl, bh); - tcg_temp_free_i64(bl); - tcg_temp_free_i64(bh); } =20 static DisasJumpType op_vbperm(DisasContext *s, DisasOps *o) @@ -609,9 +607,8 @@ static DisasJumpType op_vlei(DisasContext *s, DisasOps = *o) return DISAS_NORETURN; } =20 - tmp =3D tcg_const_i64((int16_t)get_field(s, i2)); + tmp =3D tcg_constant_i64((int16_t)get_field(s, i2)); write_vec_element_i64(tmp, get_field(s, v1), enr, es); - tcg_temp_free_i64(tmp); return DISAS_NEXT; } =20 @@ -1107,11 +1104,13 @@ static DisasJumpType op_vseg(DisasContext *s, Disas= Ops *o) =20 static DisasJumpType op_vst(DisasContext *s, DisasOps *o) { - TCGv_i64 tmp =3D tcg_const_i64(16); + TCGv_i64 tmp; =20 /* Probe write access before actually modifying memory */ - gen_helper_probe_write_access(cpu_env, o->addr1, tmp); + gen_helper_probe_write_access(cpu_env, o->addr1, + tcg_constant_i64(16)); =20 + tmp =3D tcg_temp_new_i64(); read_vec_element_i64(tmp, get_field(s, v1), 0, ES_64); tcg_gen_qemu_st_i64(tmp, o->addr1, get_mem_index(s), MO_TEUQ); gen_addi_and_wrap_i64(s, o->addr1, o->addr1, 8); @@ -1270,9 +1269,10 @@ static DisasJumpType op_vstm(DisasContext *s, DisasO= ps *o) } =20 /* Probe write access before actually modifying memory */ - tmp =3D tcg_const_i64((v3 - v1 + 1) * 16); - gen_helper_probe_write_access(cpu_env, o->addr1, tmp); + gen_helper_probe_write_access(cpu_env, o->addr1, + tcg_constant_i64((v3 - v1 + 1) * 16)); =20 + tmp =3D tcg_temp_new_i64(); for (;; v1++) { read_vec_element_i64(tmp, v1, 0, ES_64); tcg_gen_qemu_st_i64(tmp, o->addr1, get_mem_index(s), MO_TEUQ); @@ -1359,7 +1359,7 @@ static DisasJumpType op_va(DisasContext *s, DisasOps = *o) static void gen_acc(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b, uint8_t es) { const uint8_t msb_bit_nr =3D NUM_VEC_ELEMENT_BITS(es) - 1; - TCGv_i64 msb_mask =3D tcg_const_i64(dup_const(es, 1ull << msb_bit_nr)); + TCGv_i64 msb_mask =3D tcg_constant_i64(dup_const(es, 1ull << msb_bit_n= r)); TCGv_i64 t1 =3D tcg_temp_new_i64(); TCGv_i64 t2 =3D tcg_temp_new_i64(); TCGv_i64 t3 =3D tcg_temp_new_i64(); @@ -1416,7 +1416,7 @@ static void gen_acc2_i64(TCGv_i64 dl, TCGv_i64 dh, TC= Gv_i64 al, { TCGv_i64 th =3D tcg_temp_new_i64(); TCGv_i64 tl =3D tcg_temp_new_i64(); - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); =20 tcg_gen_add2_i64(tl, th, al, zero, bl, zero); tcg_gen_add2_i64(tl, th, th, zero, ah, zero); @@ -1425,7 +1425,6 @@ static void gen_acc2_i64(TCGv_i64 dl, TCGv_i64 dh, TC= Gv_i64 al, =20 tcg_temp_free_i64(th); tcg_temp_free_i64(tl); - tcg_temp_free_i64(zero); } =20 static DisasJumpType op_vacc(DisasContext *s, DisasOps *o) @@ -1455,15 +1454,14 @@ static void gen_ac2_i64(TCGv_i64 dl, TCGv_i64 dh, T= CGv_i64 al, TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh, TCGv_i64 cl, TCGv_i64 ch) { TCGv_i64 tl =3D tcg_temp_new_i64(); - TCGv_i64 th =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); =20 /* extract the carry only */ tcg_gen_extract_i64(tl, cl, 0, 1); tcg_gen_add2_i64(dl, dh, al, ah, bl, bh); - tcg_gen_add2_i64(dl, dh, dl, dh, tl, th); + tcg_gen_add2_i64(dl, dh, dl, dh, tl, zero); =20 tcg_temp_free_i64(tl); - tcg_temp_free_i64(th); } =20 static DisasJumpType op_vac(DisasContext *s, DisasOps *o) @@ -1484,7 +1482,7 @@ static void gen_accc2_i64(TCGv_i64 dl, TCGv_i64 dh, T= CGv_i64 al, TCGv_i64 ah, { TCGv_i64 tl =3D tcg_temp_new_i64(); TCGv_i64 th =3D tcg_temp_new_i64(); - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); =20 tcg_gen_andi_i64(tl, cl, 1); tcg_gen_add2_i64(tl, th, tl, zero, al, zero); @@ -1495,7 +1493,6 @@ static void gen_accc2_i64(TCGv_i64 dl, TCGv_i64 dh, T= CGv_i64 al, TCGv_i64 ah, =20 tcg_temp_free_i64(tl); tcg_temp_free_i64(th); - tcg_temp_free_i64(zero); } =20 static DisasJumpType op_vaccc(DisasContext *s, DisasOps *o) @@ -1597,14 +1594,13 @@ static void gen_avgl_i32(TCGv_i32 d, TCGv_i32 a, TC= Gv_i32 b) static void gen_avgl_i64(TCGv_i64 dl, TCGv_i64 al, TCGv_i64 bl) { TCGv_i64 dh =3D tcg_temp_new_i64(); - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); =20 tcg_gen_add2_i64(dl, dh, al, zero, bl, zero); gen_addi2_i64(dl, dh, dl, dh, 1); tcg_gen_extract2_i64(dl, dl, dh, 1); =20 tcg_temp_free_i64(dh); - tcg_temp_free_i64(zero); } =20 static DisasJumpType op_vavgl(DisasContext *s, DisasOps *o) @@ -2440,7 +2436,7 @@ static void gen_scbi2_i64(TCGv_i64 dl, TCGv_i64 dh, T= CGv_i64 al, { TCGv_i64 th =3D tcg_temp_new_i64(); TCGv_i64 tl =3D tcg_temp_new_i64(); - TCGv_i64 zero =3D tcg_const_i64(0); + TCGv_i64 zero =3D tcg_constant_i64(0); =20 tcg_gen_sub2_i64(tl, th, al, zero, bl, zero); tcg_gen_andi_i64(th, th, 1); @@ -2452,7 +2448,6 @@ static void gen_scbi2_i64(TCGv_i64 dl, TCGv_i64 dh, T= CGv_i64 al, =20 tcg_temp_free_i64(th); tcg_temp_free_i64(tl); - tcg_temp_free_i64(zero); } =20 static DisasJumpType op_vscbi(DisasContext *s, DisasOps *o) @@ -2572,11 +2567,12 @@ static DisasJumpType op_vsumq(DisasContext *s, Disa= sOps *o) return DISAS_NORETURN; } =20 - sumh =3D tcg_const_i64(0); + sumh =3D tcg_temp_new_i64(); suml =3D tcg_temp_new_i64(); - zero =3D tcg_const_i64(0); + zero =3D tcg_constant_i64(0); tmpl =3D tcg_temp_new_i64(); =20 + tcg_gen_mov_i64(sumh, zero); read_vec_element_i64(suml, get_field(s, v3), max_idx, es); for (idx =3D 0; idx <=3D max_idx; idx++) { read_vec_element_i64(tmpl, get_field(s, v2), idx, es); @@ -2587,7 +2583,6 @@ static DisasJumpType op_vsumq(DisasContext *s, DisasO= ps *o) =20 tcg_temp_free_i64(sumh); tcg_temp_free_i64(suml); - tcg_temp_free_i64(zero); tcg_temp_free_i64(tmpl); return DISAS_NEXT; } --=20 2.34.1