From nobody Thu Sep 19 21:54:18 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1726108993; cv=none; d=zohomail.com; s=zohoarc; b=Ody6g2qtjck4/pKSTMOTyHHGwDp6fSe3SA5830+7gGFIDd8JUU7eNPI8qRhhCoyudNS25wXcv2AhqW5nP05xH/0xWhxdIY4lTAI1OxsRNpDxte/VdpdO2Fn/AL8QjoUVgfpNhvHjvWRQJHLgCpqjvmEqGZ7Rh1D4Peg9llEG4oQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726108993; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Si86JKCuT9dzTb6LuA2zkdzwmeHcws3bbEbFgiDwDVI=; b=FvazpIlffhms3WgIAe03zfKIfdbQMzOaCAc/Ad+RsScSf17Brd2yYS369TAI+jJMvTKe+NC4WmzhXkC04HlQsiq8HLu75ao5DjIx8jfyxhk35X+b3HSLLKGaD86IVZjfg3E1oUhbpP+sciwz9Wesa1Pfhol8N65EZSnmz/Wkw44= 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+importer=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 1726108993853167.35773916464075; Wed, 11 Sep 2024 19:43:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soZmq-0007F7-Oj; Wed, 11 Sep 2024 22:42:24 -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 1soZm5-0003OF-Ci for qemu-devel@nongnu.org; Wed, 11 Sep 2024 22:41:37 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1soZm3-0004Dw-LQ for qemu-devel@nongnu.org; Wed, 11 Sep 2024 22:41:37 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-20570b42f24so5562685ad.1 for ; Wed, 11 Sep 2024 19:41:35 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2076afe9c61sm5635915ad.231.2024.09.11.19.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 19:41:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726108894; x=1726713694; darn=nongnu.org; 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=Si86JKCuT9dzTb6LuA2zkdzwmeHcws3bbEbFgiDwDVI=; b=SsnD3XWfxPEayb/GB5zK+dBZuvJIzld1xWILRtrkKHBQOezIbBj6nVrJgeS6YXqEFE CPPYluqZG2/mKyEIQqQqNEPwam6hco1NlY31f7VLkqEqS0830YWoaIu3fOxYfcHzWls2 HrRhOnNslTFS5fBCseojNgZHBUBunKNTVGLwsbfK0kiJ+7rxTfRy7i8T3hc5FGV4hs0p 1pdJ58YOjhTh7O7sKeHomde0GMl40b0aWyjE5abolNV84G11RqYicqtdl3D45XEAJ/V2 E7eNztenuEaq0ZY8TPZZ+vlix07fowtetgU4EQQYBkQI9wOgg1TBBts+q4lfJurssINq 4rfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726108894; x=1726713694; 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=Si86JKCuT9dzTb6LuA2zkdzwmeHcws3bbEbFgiDwDVI=; b=VutMAuMxL2LFc0v7b/H/kAsfGko9+H5DRhzl+x33VNT7Iost6WPTZiITAYujRPsnLC UYPl8sYu+RxzdrsRs1aIH/YzqVIHesbAxPfupr5SNZKqxQXuPDMOJqH/NvyWTAEarn0b dYRRGcDZAZr+WEaBlu0cr/LmX5bE7fmiWI38WbLDz6KVsf9mx0KhqT0QWdsiIzf7ZfRE VMCG0a6IXpL9CG19FOZfsW5ZsoC/KREA7XKRx4Veo8ac/F37isRvKwhRqvGhbKsq8Rj/ USF4ypz0pN92e/ZErZfj+hFKNYTqyCWWqR/Sp4ZwVhzv5mZkQUmT3eXx0FCLoqP1vhrA 6Bmw== X-Gm-Message-State: AOJu0YwVhXUiGIT+4uOeD1dTLzIOvKMpjJZ+aP173xPS0FH6g0TMbAgK VoM59DkJPijVLlAFYUASTDiKuM0U/ICyhNNmGD8yK7SYOrCBMjA+n8YpjOV8uzqNl1vOd/ABZOz 6 X-Google-Smtp-Source: AGHT+IF31ZuNxpMn7jNtA0K+vGb4y6JSvHCaX/gtiyXmo1x1vSK1liCeM12DdQQz8ad/9DJ5MGzPlg== X-Received: by 2002:a17:903:41c3:b0:207:1de9:1014 with SMTP id d9443c01a7336-2076e38f304mr23558695ad.34.1726108894313; Wed, 11 Sep 2024 19:41:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH v3 20/29] target/arm: Push tcg_rnd into handle_shri_with_rndacc Date: Wed, 11 Sep 2024 19:41:05 -0700 Message-ID: <20240912024114.1097832-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240912024114.1097832-1-richard.henderson@linaro.org> References: <20240912024114.1097832-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1726108994966116600 We always pass the same value for round; compute it within common code. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index e00d7fbf48..e59236330a 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9205,11 +9205,10 @@ static void disas_data_proc_fp(DisasContext *s, uin= t32_t insn) * the vector and scalar code. */ static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src, - TCGv_i64 tcg_rnd, bool accumulate, + bool round, bool accumulate, bool is_u, int size, int shift) { bool extended_result =3D false; - bool round =3D tcg_rnd !=3D NULL; int ext_lshift =3D 0; TCGv_i64 tcg_src_hi; =20 @@ -9227,6 +9226,7 @@ static void handle_shri_with_rndacc(TCGv_i64 tcg_res,= TCGv_i64 tcg_src, =20 /* Deal with the rounding step */ if (round) { + TCGv_i64 tcg_rnd =3D tcg_constant_i64(1ull << (shift - 1)); if (extended_result) { TCGv_i64 tcg_zero =3D tcg_constant_i64(0); if (!is_u) { @@ -9294,7 +9294,6 @@ static void handle_scalar_simd_shri(DisasContext *s, bool insert =3D false; TCGv_i64 tcg_rn; TCGv_i64 tcg_rd; - TCGv_i64 tcg_round; =20 if (!extract32(immh, 3, 1)) { unallocated_encoding(s); @@ -9320,12 +9319,6 @@ static void handle_scalar_simd_shri(DisasContext *s, break; } =20 - if (round) { - tcg_round =3D tcg_constant_i64(1ULL << (shift - 1)); - } else { - tcg_round =3D NULL; - } - tcg_rn =3D read_fp_dreg(s, rn); tcg_rd =3D (accumulate || insert) ? read_fp_dreg(s, rd) : tcg_temp_new= _i64(); =20 @@ -9339,7 +9332,7 @@ static void handle_scalar_simd_shri(DisasContext *s, tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_rn, 0, esize - shift); } } else { - handle_shri_with_rndacc(tcg_rd, tcg_rn, tcg_round, + handle_shri_with_rndacc(tcg_rd, tcg_rn, round, accumulate, is_u, size, shift); } =20 @@ -9392,7 +9385,7 @@ static void handle_vec_simd_sqshrn(DisasContext *s, b= ool is_scalar, bool is_q, int elements =3D is_scalar ? 1 : (64 / esize); bool round =3D extract32(opcode, 0, 1); MemOp ldop =3D (size + 1) | (is_u_shift ? 0 : MO_SIGN); - TCGv_i64 tcg_rn, tcg_rd, tcg_round; + TCGv_i64 tcg_rn, tcg_rd; TCGv_i32 tcg_rd_narrowed; TCGv_i64 tcg_final; =20 @@ -9437,15 +9430,9 @@ static void handle_vec_simd_sqshrn(DisasContext *s, = bool is_scalar, bool is_q, tcg_rd_narrowed =3D tcg_temp_new_i32(); tcg_final =3D tcg_temp_new_i64(); =20 - if (round) { - tcg_round =3D tcg_constant_i64(1ULL << (shift - 1)); - } else { - tcg_round =3D NULL; - } - for (i =3D 0; i < elements; i++) { read_vec_element(s, tcg_rn, rn, i, ldop); - handle_shri_with_rndacc(tcg_rd, tcg_rn, tcg_round, + handle_shri_with_rndacc(tcg_rd, tcg_rn, round, false, is_u_shift, size+1, shift); narrowfn(tcg_rd_narrowed, tcg_env, tcg_rd); tcg_gen_extu_i32_i64(tcg_rd, tcg_rd_narrowed); @@ -10495,7 +10482,6 @@ static void handle_vec_simd_shrn(DisasContext *s, b= ool is_q, int shift =3D (2 * esize) - immhb; bool round =3D extract32(opcode, 0, 1); TCGv_i64 tcg_rn, tcg_rd, tcg_final; - TCGv_i64 tcg_round; int i; =20 if (extract32(immh, 3, 1)) { @@ -10512,15 +10498,9 @@ static void handle_vec_simd_shrn(DisasContext *s, = bool is_q, tcg_final =3D tcg_temp_new_i64(); read_vec_element(s, tcg_final, rd, is_q ? 1 : 0, MO_64); =20 - if (round) { - tcg_round =3D tcg_constant_i64(1ULL << (shift - 1)); - } else { - tcg_round =3D NULL; - } - for (i =3D 0; i < elements; i++) { read_vec_element(s, tcg_rn, rn, i, size+1); - handle_shri_with_rndacc(tcg_rd, tcg_rn, tcg_round, + handle_shri_with_rndacc(tcg_rd, tcg_rn, round, false, true, size+1, shift); =20 tcg_gen_deposit_i64(tcg_final, tcg_final, tcg_rd, esize * i, esize= ); --=20 2.43.0