From nobody Sat Apr 5 17:58:19 2025 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=1738114824; cv=none; d=zohomail.com; s=zohoarc; b=XXpHFbs6Sg0QH8ZiaOvin2zwxk/wAFgnllu35m1XzZK3uv/2L3mDdZI82YxyuE8oI+3n23fWBNLt5ngvPD6nTyB0F8O38DHJxTdtR1InPh2aRwQdoaAl6l+RLuFoxbW01YUFb27ypPve2ZlIe4C4BESu6jVxQhEebaC211ssTUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738114824; h=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=jiXguVQC6dDvcAbzQwFiYdwMzQqKONGTAhmuc/kbWio=; b=PZlufIiHf9RLS1dspFxExMbmkrMN5uI0eRBeikmVWXeAOwmBYSfW0zSNgtttIo7zJ7xCEBJ3sMffEHWmS9s9s50ch5gh0naGiH412+HfhhzUddJvtCUmxT7EW06xojKHivDF+kj1o+9CkWDvipx1JH9YuR3KjderaLfVBgMqT5s= 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 173811482430973.09791003163059; Tue, 28 Jan 2025 17:40:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tcx31-0000vC-P6; Tue, 28 Jan 2025 20:39:19 -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 1tcx2y-0000sg-A4 for qemu-devel@nongnu.org; Tue, 28 Jan 2025 20:39:16 -0500 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 1tcx2w-0003Ya-KD for qemu-devel@nongnu.org; Tue, 28 Jan 2025 20:39:16 -0500 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-21634338cfdso44093605ad.2 for ; Tue, 28 Jan 2025 17:39:14 -0800 (PST) Received: from stoup.. (71-212-32-190.tukw.qwest.net. [71.212.32.190]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21da3ea4200sm89341745ad.88.2025.01.28.17.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2025 17:39:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738114753; x=1738719553; 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=jiXguVQC6dDvcAbzQwFiYdwMzQqKONGTAhmuc/kbWio=; b=t4W4sPQjn91WE6oZuDWcBsitNtDTxpRVRFRT49lZrED7HDd1kaz8+Kb3xENFkJ2xsj FaVDcPthgJ6kGFYxC4gtCoRI4rTtLHgTMZTno4oyk53VxI3Wyas5YDDuZ8yQdHlQErMp ijzGBVOuAPSVpgUSvwWjDJJJuf963wVIOLr7fpJpqpyd9h7CFRG71z+2/KbH7lmK/cqF CC8tC1bSbVPuKKi9jY2GyQVwInVhloEbOQftVvhR0g3tb2hV4Eht+L197DwLWtJtEcH7 YnxIsU29j0fUYjkpWiuXi7GmA9WOFiK6g0Fk2iWOHAohGBEZjIQDVp/axD32y8AerIuF NaMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738114753; x=1738719553; 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=jiXguVQC6dDvcAbzQwFiYdwMzQqKONGTAhmuc/kbWio=; b=Mc0yhecV/uQ2LpmHtRQIipuVO2FbgiThkIV8WRhJVkNAv3m8u8yPEUImhQQRe+WEXM DClYdepx3qDHYenvhy+T7HSq1Gha29Q2j1rXVZbs97yXOsSw3+TH6bhgrkVAwWR3K361 AfSggxHWm456S04181Lxf9EhWh8UVgpqOstNcGVGvECwE/eCYrQ54NMmx2OPVv5CPeeS ojrZI/byHJHqYFSpXI89ng7frRDVBLe6BldDx6bCX5L/iQu31qgdC0alXHqVUoVszgq7 olhBYcGlkwfuGpCRdNtgaBV6/f7vS3UmamiS9ck6kF/RAib9TudHLXqCE2EB1aJvOnMc EeDA== X-Gm-Message-State: AOJu0YyTsVGWoAvIJD53FJO1ygR7kMqgeLexisA4dImiopLLlAK5zsE6 VciLGqS0xinAHxAAADad24CxCW9bQ0Yg29GUxuvoo3NFP/vgDkbWeG71IlFEnx77EWoQJ2wUHbE X X-Gm-Gg: ASbGncvGAnBrl2lFlge/UCwEWqcndirAaSEW7Vf6WAe9Ugse0s96cyQNpLLA2xkgZ/k 9BLnaQt7TI6koO+faXqH8UIF3d/XZG/PxWianrSwCD2kVRFt0mkQ4kA5yzVr8nVOAPK3F+qCCe1 ElfcVpEa9PhxJYLjG/fIk3lRewHUI19VewLqcGNpLPorRqmKanlIUR52JxpMcoz4OON2vlNWW3Y 6rTLdiqsXst3gNeUhxBFGvvBemcFE0Wx8cmbkz90EXvmmd1gwurl1LDUduC089ke5yoyFdPD/U1 Ec7tDMqUOKUP2R8eBVoipxRwR5C8xQWUePjvTNpC48bYAnczxw== X-Google-Smtp-Source: AGHT+IGrMUNjR0mriOdUsayqQ+CMjaE4W8kLh4f4GBQtBT0pNOn5z9TY/WuPuY3e5maxgkp+6qObQw== X-Received: by 2002:a17:902:eccb:b0:216:48dd:d15c with SMTP id d9443c01a7336-21dd7d78dcfmr18805595ad.27.1738114753354; Tue, 28 Jan 2025 17:39:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH v2 21/34] target/arm: Use float*_maybe_ah_chs in sve_fcadd_* Date: Tue, 28 Jan 2025 17:38:44 -0800 Message-ID: <20250129013857.135256-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250129013857.135256-1-richard.henderson@linaro.org> References: <20250129013857.135256-1-richard.henderson@linaro.org> MIME-Version: 1.0 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::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, T_SCC_BODY_TEXT_LINE=-0.01 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: 1738114825786019000 Content-Type: text/plain; charset="utf-8" The construction of neg_imag and neg_real were done to make it easy to apply both in parallel with two simple logical operations. This changed with FPCR.AH, which is more complex than that. Signed-off-by: Richard Henderson --- target/arm/tcg/vec_helper.c | 51 +++++++++++-------------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 9ed04b1b0a..55bac9536f 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -879,27 +879,20 @@ void HELPER(gvec_fcaddh)(void *vd, void *vn, void *vm, float16 *d =3D vd; float16 *n =3D vn; float16 *m =3D vm; - uint32_t neg_real =3D extract32(desc, SIMD_DATA_SHIFT, 1); - uint32_t neg_imag =3D neg_real ^ 1; + bool rot =3D extract32(desc, SIMD_DATA_SHIFT, 1); bool fpcr_ah =3D extract64(desc, SIMD_DATA_SHIFT + 1, 1); uintptr_t i; =20 - /* Shift boolean to the sign bit so we can xor to negate. */ - neg_real <<=3D 15; - neg_imag <<=3D 15; - for (i =3D 0; i < opr_sz / 2; i +=3D 2) { float16 e0 =3D n[H2(i)]; float16 e1 =3D m[H2(i + 1)]; float16 e2 =3D n[H2(i + 1)]; float16 e3 =3D m[H2(i)]; =20 - /* FPNeg() mustn't flip sign of a NaN if FPCR.AH =3D=3D 1 */ - if (!(fpcr_ah && float16_is_any_nan(e1))) { - e1 ^=3D neg_imag; - } - if (!(fpcr_ah && float16_is_any_nan(e3))) { - e3 ^=3D neg_real; + if (rot) { + e3 =3D float16_maybe_ah_chs(e3, fpcr_ah); + } else { + e1 =3D float16_maybe_ah_chs(e1, fpcr_ah); } =20 d[H2(i)] =3D float16_add(e0, e1, fpst); @@ -915,27 +908,20 @@ void HELPER(gvec_fcadds)(void *vd, void *vn, void *vm, float32 *d =3D vd; float32 *n =3D vn; float32 *m =3D vm; - uint32_t neg_real =3D extract32(desc, SIMD_DATA_SHIFT, 1); - uint32_t neg_imag =3D neg_real ^ 1; + bool rot =3D extract32(desc, SIMD_DATA_SHIFT, 1); bool fpcr_ah =3D extract64(desc, SIMD_DATA_SHIFT + 1, 1); uintptr_t i; =20 - /* Shift boolean to the sign bit so we can xor to negate. */ - neg_real <<=3D 31; - neg_imag <<=3D 31; - for (i =3D 0; i < opr_sz / 4; i +=3D 2) { float32 e0 =3D n[H4(i)]; float32 e1 =3D m[H4(i + 1)]; float32 e2 =3D n[H4(i + 1)]; float32 e3 =3D m[H4(i)]; =20 - /* FPNeg() mustn't flip sign of a NaN if FPCR.AH =3D=3D 1 */ - if (!(fpcr_ah && float32_is_any_nan(e1))) { - e1 ^=3D neg_imag; - } - if (!(fpcr_ah && float32_is_any_nan(e3))) { - e3 ^=3D neg_real; + if (rot) { + e3 =3D float32_maybe_ah_chs(e3, fpcr_ah); + } else { + e1 =3D float32_maybe_ah_chs(e1, fpcr_ah); } =20 d[H4(i)] =3D float32_add(e0, e1, fpst); @@ -951,27 +937,20 @@ void HELPER(gvec_fcaddd)(void *vd, void *vn, void *vm, float64 *d =3D vd; float64 *n =3D vn; float64 *m =3D vm; - uint64_t neg_real =3D extract64(desc, SIMD_DATA_SHIFT, 1); - uint64_t neg_imag =3D neg_real ^ 1; + bool rot =3D extract32(desc, SIMD_DATA_SHIFT, 1); bool fpcr_ah =3D extract64(desc, SIMD_DATA_SHIFT + 1, 1); uintptr_t i; =20 - /* Shift boolean to the sign bit so we can xor to negate. */ - neg_real <<=3D 63; - neg_imag <<=3D 63; - for (i =3D 0; i < opr_sz / 8; i +=3D 2) { float64 e0 =3D n[i]; float64 e1 =3D m[i + 1]; float64 e2 =3D n[i + 1]; float64 e3 =3D m[i]; =20 - /* FPNeg() mustn't flip sign of a NaN if FPCR.AH =3D=3D 1 */ - if (!(fpcr_ah && float64_is_any_nan(e1))) { - e1 ^=3D neg_imag; - } - if (!(fpcr_ah && float64_is_any_nan(e3))) { - e3 ^=3D neg_real; + if (rot) { + e3 =3D float64_maybe_ah_chs(e3, fpcr_ah); + } else { + e1 =3D float64_maybe_ah_chs(e1, fpcr_ah); } =20 d[i] =3D float64_add(e0, e1, fpst); --=20 2.43.0