From patchwork Sun Dec 8 22:48:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848284 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840105wrt; Sun, 8 Dec 2024 14:50:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWjsgX3diiU8mGIAMmnKRWnM93Ve6zi2du/hcheO8hGw63FEe/02zS/ArkfBEhxcTeqzbAn4A==@linaro.org X-Google-Smtp-Source: AGHT+IHsWVQSbdk0G8PAhuIcQ+5seKe/Ydm1t9gYt23Vs3B7DGVvEBP3WTNZ9TNY64lmWuv9bHgA X-Received: by 2002:a05:6214:ca2:b0:6d8:9be9:7d57 with SMTP id 6a1803df08f44-6d8e71947e5mr187246066d6.37.1733698233845; Sun, 08 Dec 2024 14:50:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698233; cv=none; d=google.com; s=arc-20240605; b=U7LJGL7pecJAx5DNLJ7i96udfbOblgz8jT11n6oGPw8CaTKYcKOFCDw2mOlpEln+F4 BE3cVbGR9e+4iCgb6OSDt8WWzLhKQUHzAknp8r5SuEJtRERfdxLf9P0aIezGXuYlwYbk hJh5lN/wUAOq61hb13pdkgXcuuMv6m/WHY5cdeoLMLkgKZIeAqN5RGiJx3yp+w3Ouy/q ttdygsG/iSsFzDkTapjsYYwn87Mqh9wrRAXYEwuIHzz9guuUfjL1V4jwsYysXId+YKeT kNvvaNiNoS0DOW95yFL6NkLVboMyK3KoVNmAnMZlxE5e6RcMrLHKHPIEbFGJpfAf3/4W F/SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=mZyOB/BhM/jwpXgK9B1tPd1eLKXNKw05NeJnxUm/GVk=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=WqzAg6opllxnP4uA2y6syvTln6v51B//meiAXwmkaJ166lKAMozKY3Lx6SCi+gJjjK zBhrAI5aokGwDFnLmHbYgiOBrbOz/RK/ME03MRiYmf9X6sQSyBWSEmczFepKgPgZrf1d m5vs8QWkGXOS8LIgWGuk6AJ8tmLrTzpI3jUdzxOgaTCyYFRqphStbrBwcq53iN8tJmH7 9lkRNtsAqDkNpIbc7wjOqyVAWOLP+o7XtQrAEE6YaySofEnkXjJdrzWavJi3R65ziCIl oL++MDviAIVhRFq2+jqchnguf/LVhqUzqfr0m5DCovJx18KPO9cVg8Ri4QwVR8iqoEvJ 9xTw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W62KoYNY; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8ea2a9bc4si71341086d6.89.2024.12.08.14.50.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:50:33 -0800 (PST) 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=W62KoYNY; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ58-00077v-Nh; Sun, 08 Dec 2024 17:48:54 -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 1tKQ55-00076s-A3 for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:51 -0500 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ53-0006CC-Bl for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:51 -0500 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-5f2ace8a94aso207572eaf.0 for ; Sun, 08 Dec 2024 14:48:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698128; x=1734302928; 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=mZyOB/BhM/jwpXgK9B1tPd1eLKXNKw05NeJnxUm/GVk=; b=W62KoYNYEUVRKGMTebTpPiRKnQKERklP7dXYoqXRlEu/MuvVDeZoWivHvzqDiXhYzd 8Q6QQGamxi5iBI63u75u690bwvNOp3UDEqo+3j/2gaHOXgpUFXzoPdwCZmbF46S02Hph tiTh45Hej034DkccxyF/hwt7wF+5Xl5iZEw+LJxzDs7/Du+o2dOxgMMDXrEhDRqkXiVw j1VaAk7Fwp9CzfsOl7fIJYkoh11kqVjbqywlYULkoUCP1X8hOyiIL20gcn2apnlfNEKE /7KBZtI5PeW82jc8NXScq3SR9vXeKtdC3SAglcGUZGm357+1OZPnGpxYcRW48b3DtUSA Fm0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698128; x=1734302928; 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=mZyOB/BhM/jwpXgK9B1tPd1eLKXNKw05NeJnxUm/GVk=; b=p0hLLMjpnIyFjiMAfxgg9etFKhm4hR3eQvXvZfODWnZ++SfcApuWe8B5ZxuwK8h0Gb rP7FFkicSN5U4TUXoM4rwypSGiRgYA6Bufr+MwmEQmevSAnBqyHiES5NVl6T7WNbEuxY xSdhogVhFS2+WTo05c6gSeps5FAZjpLfvpHGOT6ufha+TsUNf88Xs2FomTyEQYS3MiSw vzTmxmtAZZVWhlEkvCHImKSzRViXEbnzLjWDpR6Xm27L+UFs6uCTqA21hjuqFQvXz9dv 01pgFd6r0ahMAFTSNEmgvY+sEdA0NAQ9NpMG9QAQs9Na2g5qt1MuoJgVWF0K4deR2o5i +V6g== X-Gm-Message-State: AOJu0YylDKAXuFJsX8k+NEZDOGV+p71W7VM0MOaezAakjQgArG8ks5Qp eS5xUCvH0bzmexLJkNWKuUUyM1G4GnoABYGNfxvOwiM24uG7qzRpDD5G4EXhpkVbInB7NNHxTJ0 WyUaZWw== X-Gm-Gg: ASbGncuYU/Srr/Wof5iQ25qPEbIRBUJHcXbcvfYsjRjTbSJ+X1l2foFQS8O0+1nhNsW bFbatXUYxoHgT1kz8/rQXp9xa8PFNvG2+CFB4x3+1iwdEZt0GxZ+wVRUPQtUN0O28HqhzZdEMm+ 8c+r0dBAtClGnfUS9DB9Eq0/HQBjmtqm6AuqQNoH6vXJr+a+llALUUjdP6116ROM25O4b+8QyBz BNm3RvEtweF2MEg5cGwdKZFsn7tDn76V090mrS9/wVOjcC2sty5gTp/vp6j3Zp9Fxegv2EMRhzf XIxw2zIz04DWZ4w/zb+cPlK4ztr8EXtSU2b5 X-Received: by 2002:a05:6820:8187:b0:5ee:ebcb:e701 with SMTP id 006d021491bc7-5f2870e7dc9mr6936480eaf.6.1733698127984; Sun, 08 Dec 2024 14:48:47 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:48:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 01/17] softfloat: Add float{16,32,64}_muladd_scalbn Date: Sun, 8 Dec 2024 16:48:28 -0600 Message-ID: <20241208224844.570491-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c29; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc29.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 We currently have a flag, float_muladd_halve_result, to scale the result by 2**-1. Extend this to handle arbitrary scaling. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/fpu/softfloat.h | 6 ++++ fpu/softfloat.c | 58 ++++++++++++++++++++++----------------- fpu/softfloat-parts.c.inc | 7 +++-- 3 files changed, 44 insertions(+), 27 deletions(-) diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index eb64075b9c..c34ce0477d 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -238,6 +238,8 @@ float16 float16_add(float16, float16, float_status *status); float16 float16_sub(float16, float16, float_status *status); float16 float16_mul(float16, float16, float_status *status); float16 float16_muladd(float16, float16, float16, int, float_status *status); +float16 float16_muladd_scalbn(float16, float16, float16, + int, int, float_status *status); float16 float16_div(float16, float16, float_status *status); float16 float16_scalbn(float16, int, float_status *status); float16 float16_min(float16, float16, float_status *status); @@ -597,6 +599,8 @@ float32 float32_mul(float32, float32, float_status *status); float32 float32_div(float32, float32, float_status *status); float32 float32_rem(float32, float32, float_status *status); float32 float32_muladd(float32, float32, float32, int, float_status *status); +float32 float32_muladd_scalbn(float32, float32, float32, + int, int, float_status *status); float32 float32_sqrt(float32, float_status *status); float32 float32_exp2(float32, float_status *status); float32 float32_log2(float32, float_status *status); @@ -792,6 +796,8 @@ float64 float64_mul(float64, float64, float_status *status); float64 float64_div(float64, float64, float_status *status); float64 float64_rem(float64, float64, float_status *status); float64 float64_muladd(float64, float64, float64, int, float_status *status); +float64 float64_muladd_scalbn(float64, float64, float64, + int, int, float_status *status); float64 float64_sqrt(float64, float_status *status); float64 float64_log2(float64, float_status *status); FloatRelation float64_compare(float64, float64, float_status *status); diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 027a8e576d..a4174de692 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -789,15 +789,15 @@ static FloatParts128 *parts128_mul(FloatParts128 *a, FloatParts128 *b, #define parts_mul(A, B, S) \ PARTS_GENERIC_64_128(mul, A)(A, B, S) -static FloatParts64 *parts64_muladd(FloatParts64 *a, FloatParts64 *b, - FloatParts64 *c, int flags, - float_status *s); -static FloatParts128 *parts128_muladd(FloatParts128 *a, FloatParts128 *b, - FloatParts128 *c, int flags, - float_status *s); +static FloatParts64 *parts64_muladd_scalbn(FloatParts64 *a, FloatParts64 *b, + FloatParts64 *c, int scale, + int flags, float_status *s); +static FloatParts128 *parts128_muladd_scalbn(FloatParts128 *a, FloatParts128 *b, + FloatParts128 *c, int scale, + int flags, float_status *s); -#define parts_muladd(A, B, C, Z, S) \ - PARTS_GENERIC_64_128(muladd, A)(A, B, C, Z, S) +#define parts_muladd_scalbn(A, B, C, Z, Y, S) \ + PARTS_GENERIC_64_128(muladd_scalbn, A)(A, B, C, Z, Y, S) static FloatParts64 *parts64_div(FloatParts64 *a, FloatParts64 *b, float_status *s); @@ -2212,43 +2212,50 @@ floatx80_mul(floatx80 a, floatx80 b, float_status *status) * Fused multiply-add */ -float16 QEMU_FLATTEN float16_muladd(float16 a, float16 b, float16 c, - int flags, float_status *status) +float16 QEMU_FLATTEN +float16_muladd_scalbn(float16 a, float16 b, float16 c, + int scale, int flags, float_status *status) { FloatParts64 pa, pb, pc, *pr; float16_unpack_canonical(&pa, a, status); float16_unpack_canonical(&pb, b, status); float16_unpack_canonical(&pc, c, status); - pr = parts_muladd(&pa, &pb, &pc, flags, status); + pr = parts_muladd_scalbn(&pa, &pb, &pc, scale, flags, status); return float16_round_pack_canonical(pr, status); } -static float32 QEMU_SOFTFLOAT_ATTR -soft_f32_muladd(float32 a, float32 b, float32 c, int flags, - float_status *status) +float16 float16_muladd(float16 a, float16 b, float16 c, + int flags, float_status *status) +{ + return float16_muladd_scalbn(a, b, c, 0, flags, status); +} + +float32 QEMU_SOFTFLOAT_ATTR +float32_muladd_scalbn(float32 a, float32 b, float32 c, + int scale, int flags, float_status *status) { FloatParts64 pa, pb, pc, *pr; float32_unpack_canonical(&pa, a, status); float32_unpack_canonical(&pb, b, status); float32_unpack_canonical(&pc, c, status); - pr = parts_muladd(&pa, &pb, &pc, flags, status); + pr = parts_muladd_scalbn(&pa, &pb, &pc, scale, flags, status); return float32_round_pack_canonical(pr, status); } -static float64 QEMU_SOFTFLOAT_ATTR -soft_f64_muladd(float64 a, float64 b, float64 c, int flags, - float_status *status) +float64 QEMU_SOFTFLOAT_ATTR +float64_muladd_scalbn(float64 a, float64 b, float64 c, + int scale, int flags, float_status *status) { FloatParts64 pa, pb, pc, *pr; float64_unpack_canonical(&pa, a, status); float64_unpack_canonical(&pb, b, status); float64_unpack_canonical(&pc, c, status); - pr = parts_muladd(&pa, &pb, &pc, flags, status); + pr = parts_muladd_scalbn(&pa, &pb, &pc, scale, flags, status); return float64_round_pack_canonical(pr, status); } @@ -2323,7 +2330,7 @@ float32_muladd(float32 xa, float32 xb, float32 xc, int flags, float_status *s) return ur.s; soft: - return soft_f32_muladd(ua.s, ub.s, uc.s, flags, s); + return float32_muladd_scalbn(ua.s, ub.s, uc.s, 0, flags, s); } float64 QEMU_FLATTEN @@ -2394,7 +2401,7 @@ float64_muladd(float64 xa, float64 xb, float64 xc, int flags, float_status *s) return ur.s; soft: - return soft_f64_muladd(ua.s, ub.s, uc.s, flags, s); + return float64_muladd_scalbn(ua.s, ub.s, uc.s, 0, flags, s); } float64 float64r32_muladd(float64 a, float64 b, float64 c, @@ -2405,7 +2412,7 @@ float64 float64r32_muladd(float64 a, float64 b, float64 c, float64_unpack_canonical(&pa, a, status); float64_unpack_canonical(&pb, b, status); float64_unpack_canonical(&pc, c, status); - pr = parts_muladd(&pa, &pb, &pc, flags, status); + pr = parts_muladd_scalbn(&pa, &pb, &pc, 0, flags, status); return float64r32_round_pack_canonical(pr, status); } @@ -2418,7 +2425,7 @@ bfloat16 QEMU_FLATTEN bfloat16_muladd(bfloat16 a, bfloat16 b, bfloat16 c, bfloat16_unpack_canonical(&pa, a, status); bfloat16_unpack_canonical(&pb, b, status); bfloat16_unpack_canonical(&pc, c, status); - pr = parts_muladd(&pa, &pb, &pc, flags, status); + pr = parts_muladd_scalbn(&pa, &pb, &pc, 0, flags, status); return bfloat16_round_pack_canonical(pr, status); } @@ -2431,7 +2438,7 @@ float128 QEMU_FLATTEN float128_muladd(float128 a, float128 b, float128 c, float128_unpack_canonical(&pa, a, status); float128_unpack_canonical(&pb, b, status); float128_unpack_canonical(&pc, c, status); - pr = parts_muladd(&pa, &pb, &pc, flags, status); + pr = parts_muladd_scalbn(&pa, &pb, &pc, 0, flags, status); return float128_round_pack_canonical(pr, status); } @@ -5230,8 +5237,9 @@ float32 float32_exp2(float32 a, float_status *status) float64_unpack_canonical(&rp, float64_one, status); for (i = 0 ; i < 15 ; i++) { + float64_unpack_canonical(&tp, float32_exp2_coefficients[i], status); - rp = *parts_muladd(&tp, &xnp, &rp, 0, status); + rp = *parts_muladd_scalbn(&tp, &xnp, &rp, 0, 0, status); xnp = *parts_mul(&xnp, &xp, status); } diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index cc6e06b976..5133358878 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -476,8 +476,9 @@ static FloatPartsN *partsN(mul)(FloatPartsN *a, FloatPartsN *b, * Requires A and C extracted into a double-sized structure to provide the * extra space for the widening multiply. */ -static FloatPartsN *partsN(muladd)(FloatPartsN *a, FloatPartsN *b, - FloatPartsN *c, int flags, float_status *s) +static FloatPartsN *partsN(muladd_scalbn)(FloatPartsN *a, FloatPartsN *b, + FloatPartsN *c, int scale, + int flags, float_status *s) { int ab_mask, abc_mask; FloatPartsW p_widen, c_widen; @@ -566,9 +567,11 @@ static FloatPartsN *partsN(muladd)(FloatPartsN *a, FloatPartsN *b, a->exp = p_widen.exp; return_normal: + /* TODO: Replace all use of float_muladd_halve_result with scale. */ if (flags & float_muladd_halve_result) { a->exp -= 1; } + a->exp += scale; finish_sign: if (flags & float_muladd_negate_result) { a->sign ^= 1; From patchwork Sun Dec 8 22:48:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848278 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1839997wrt; Sun, 8 Dec 2024 14:50:09 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWtOtiJCc14Vf/ILvvNoT1m6nDkdycqpzSB6yHJzyor3X9quT1u73WmHCeBo/MuqqpeDAnCnQ==@linaro.org X-Google-Smtp-Source: AGHT+IEE86vJS3YPa/CDi6ltXRC2CjLe978ZXoutl69Bs6djdYceBXscCEfnwxlh/uf55DG3Teaa X-Received: by 2002:a05:622a:4806:b0:467:5cd2:4001 with SMTP id d75a77b69052e-4675cd248c1mr49209861cf.3.1733698209740; Sun, 08 Dec 2024 14:50:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698209; cv=none; d=google.com; s=arc-20240605; b=Ul61NYOYTQVJjMJuJYTzlsUn3phVnm08AUVPoDt1GHoB2mCbu90up/tS4DcPxwyoMM M9qQLEXnxtTYHi8gFBHtEChC/Uch0gxxSKyemPTVGT4pUuLZl4G+7O9Wp2bxGO+ehc5n F3owr4BHe1BOouHHQ66q8xSy+2v1K1oVC4/8vzPX/ce4i3xImjouLdl3YXpgxLuftyYN arahuoQ2aOJoQmQbBQSOwc5J2TTB7O6wi1+Sx/PAVCuxN+M6sSQ8eJhKLkFjSJysXS47 3w8laZ9hUVHyTZJdhPTmJr796DOC1mUDdOHCbKq2Sr5uMLrrTQ81v2E1vWzdGBVpaa0r n2ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=Y9b2+DSqhBa/dazX8A7Z/P3d2MSjAQkUApSkOVB3SGA=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=j/Op/5r0ohOcEVGOANYdpiM5btlzjWA9UKveEADzkxitqzypr68FGopsOeoZ3CIHkz LQhE4yL5+WMY2OmSdXPflIV7L9zJxtlFIsF60cxgJZ+phAb0hO5dNSnFCKJkRuO4i55k fAllExg4XTpFdhkMRWX/QRwIqsAYMo594iiMOkS/UzzUaWBIubLnPcS+RsRl+tXlyj3c rhDT5qWkL8DF0vqnjItvQKWRlDHCz7F18fPIO5FWcHJ0OzP7oUY9Gd4Yjo5dqFXKGi6n n09ZBbRX7Tc5Y4HCHvadpuiRHpztSgTthA7mV/XYEM6M1ZRIOkRvK+vUX7bG0YYFmwhQ uu8A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XEJhXX7A; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467297f8fbfsi100275791cf.395.2024.12.08.14.50.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:50:09 -0800 (PST) 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=XEJhXX7A; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ57-00077U-Ii; Sun, 08 Dec 2024 17:48:53 -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 1tKQ56-000772-44 for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:52 -0500 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ54-0006CN-Lt for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:51 -0500 Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-71ddcdc445dso648030a34.0 for ; Sun, 08 Dec 2024 14:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698129; x=1734302929; 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=Y9b2+DSqhBa/dazX8A7Z/P3d2MSjAQkUApSkOVB3SGA=; b=XEJhXX7Agf1n1w+PifTvnhp/DEeEZAqijqiBcbiOxHlWvfi0sgvzSdfErhBShZqVmE bS1yw9N92SymblRCGdfdK9gvvXfsmwUxe8Tq/ne9JNZqUhjGNjO3teB4a3CxQv4deAr+ 1lCCY35ttw4TJxSaZgSpokA+aglUZfCHZiTAoXvR3jnFoHZqOWgoj7eJ9A9MPtBfEpZl +6w7MongBRykeNgAE/cbo70TrFD7cruni/aQeXYnSsJ9g1fnTiRb47U5z0bwNFdBXHVa OZPRZtHznZRPQHFbLLzhJ5RHMaU9cIzOBxQhYu4toYZIlEpZh4OY5l6UYOsOoC68BiHw 4A+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698129; x=1734302929; 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=Y9b2+DSqhBa/dazX8A7Z/P3d2MSjAQkUApSkOVB3SGA=; b=ip+PBMUOAkuHBEQjatFcIPwJJy6pe3R9L5JoY3w6/US2xd6CnzhnnUzHG2OJHEommz eo1yLgei0NSKSkTr+0vjL3utnIPiTFrcJRV0ytlkxl7QZGaPcaJXE3KOLCa7fY2nhEjz QX4YlndBJHby99gneza+ppNDIZTacaO9yxQOowA/yUMc0/OIXE5PoEB9+qQHMCb/TUQO gnbrcPT/lkcjpXnHjOT5crdiSW1AFEjDBCRa1GRBnunqhteex3JEBWAQa9rGzljAyQJj Z+z7lUqr4mRtpwXR213yD5mtq8WxJ+eG7iZMYYx8gst5e1Tfde9ON1tnh8vbIIevH79R W8eA== X-Gm-Message-State: AOJu0YxBQb24Ku/8IwNs1pJIG0DzsOCfcfPAb3Emen/krsclYUfkVjxn 4UR5O4xMr9TS8SzAuJzw69h4B1RgUESwC7h+gh/gk3MNWbAzIUWYCNDD93rkwleA2QWdoJ/9wBW E2sWBAA== X-Gm-Gg: ASbGncuxJXvvP9JC/8JFcjCU6sWFeff0ycoiANLUma4qdzFMfwF21cFl7ySn3Utc4/d pf0xV71OPqf5xZNp+PmPVJWc5rsqjudi5zlyPd6ygs9jJTGIEORjebIOixs9HG7WGXS4u81Rv96 QIgmprpSSUn1BZPNuAeD7//8VbhL3egbM2kYWaa1apudA6w3SP/oPYGQ1O7bRm+Ov40QoH0RXt0 Dd8Nc68ZAlSVQrOO6K87re0GUe7/Ci2w90288eewd2Wq27BZ4J9MPAdMdwODNu5vmI3iK0PAJkP amqLLuCCb0fqfc317Y9LUGSgNCYEvwdwdzjm X-Received: by 2002:a05:6830:d8b:b0:71d:dc6b:8792 with SMTP id 46e09a7af769-71ddc6b88a5mr3762436a34.2.1733698129019; Sun, 08 Dec 2024 14:48:49 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:48:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 02/17] target/arm: Use float*_muladd_scalbn Date: Sun, 8 Dec 2024 16:48:29 -0600 Message-ID: <20241208224844.570491-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x330.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 Use the scalbn interface instead of float_muladd_halve_result. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/arm/tcg/helper-a64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 8f42a28d07..265a065f6f 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -273,7 +273,7 @@ uint32_t HELPER(rsqrtsf_f16)(uint32_t a, uint32_t b, void *fpstp) (float16_is_infinity(b) && float16_is_zero(a))) { return float16_one_point_five; } - return float16_muladd(a, b, float16_three, float_muladd_halve_result, fpst); + return float16_muladd_scalbn(a, b, float16_three, -1, 0, fpst); } float32 HELPER(rsqrtsf_f32)(float32 a, float32 b, void *fpstp) @@ -288,7 +288,7 @@ float32 HELPER(rsqrtsf_f32)(float32 a, float32 b, void *fpstp) (float32_is_infinity(b) && float32_is_zero(a))) { return float32_one_point_five; } - return float32_muladd(a, b, float32_three, float_muladd_halve_result, fpst); + return float32_muladd_scalbn(a, b, float32_three, -1, 0, fpst); } float64 HELPER(rsqrtsf_f64)(float64 a, float64 b, void *fpstp) @@ -303,7 +303,7 @@ float64 HELPER(rsqrtsf_f64)(float64 a, float64 b, void *fpstp) (float64_is_infinity(b) && float64_is_zero(a))) { return float64_one_point_five; } - return float64_muladd(a, b, float64_three, float_muladd_halve_result, fpst); + return float64_muladd_scalbn(a, b, float64_three, -1, 0, fpst); } /* Pairwise long add: add pairs of adjacent elements into From patchwork Sun Dec 8 22:48:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848279 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840000wrt; Sun, 8 Dec 2024 14:50:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWVwzi2Ditodq7oK4HTl9NS5inrVO2wgs8d1/It7XMos4xvks6XNAuOuATnhsbP+dVZJCKPRw==@linaro.org X-Google-Smtp-Source: AGHT+IEX6q8rSIj43+6654+lr6e/WAg1nvmmMmdl8XUZew6GUfcWWZ4bUg3gPIXJlV5Jm0N/NSA2 X-Received: by 2002:ac8:5ac5:0:b0:466:a119:f4d3 with SMTP id d75a77b69052e-46734e7127emr183700911cf.45.1733698210097; Sun, 08 Dec 2024 14:50:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698210; cv=none; d=google.com; s=arc-20240605; b=F4rVnF2lLz8nceGIMKloTjWkyP10M0NbNEPTOphpn1Fm+WjpRQ2RfDwF9rEpUHLUsd mN2BKAv6wbzQ4+pLbgGipjVZx7btuxDM28d/jtuec1yJEjvyGaFRJSZxrY0bh6j2ksC3 kZQE8b6Yosd4mPfXbF7vUxgzr/bTggJGlpRfHhBN3P5YiXH1scfgsVKqwBLiU2k9G2Wi OJp0lsEFLLRlFMKgQ8+B5nh/wFJc3lRKGI5m8nzqvh1FOk4QtthKZDOE2d6uRvqPTooE SF209Km8+hy4xt+Kfph5PcO45JLkr7J7iGVwTmvqtiyUaRQb3o/WfeUrbqwe4u+Ggv76 WMKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=VygN+W9RKPAJjasMCWSLuOlElJZ/pQQzo9TD4o2RJQI=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=UFjwAmzCn0DuMA3Nk4w0TnJUmDQYD3jMmsUDcZtRBBBkoLPe7y9+MMXIbjx8u4/8OE O+3Q+qeFvoYBo5kBKSpK7MFqxxcqkm3bJEtKi7nzY0gCDpT5M9dE7t41kOjSSgJRvQN2 RPBggo1R0RK/sFEkPzzobBMMbyYXmw40btiJff6GP7rYU0ZURnzQlf1XGp+FuoQfppGt 6FN0BEqPjptuZCA0b033vkXyZsh6LeyeQs8YdoNirAbKbP0D8RUk5tHhGY14XzsNYEbP ltoOycXQFu1SDUPcljGzm5iujpmGGre9oX/K0AFAIjKt0j3Gs6lrekVgpeD8hCXfLlOZ 0LGg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GDneB3h1; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4674e8ddd34si44252841cf.523.2024.12.08.14.50.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:50:10 -0800 (PST) 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=GDneB3h1; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ59-000783-JP; Sun, 08 Dec 2024 17:48:55 -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 1tKQ57-00077Q-CR for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:53 -0500 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ55-0006CY-HY for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:53 -0500 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-71de02b24cfso556506a34.1 for ; Sun, 08 Dec 2024 14:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698130; x=1734302930; 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=VygN+W9RKPAJjasMCWSLuOlElJZ/pQQzo9TD4o2RJQI=; b=GDneB3h1sgCo78LbGrQkFrdUOgWugjuWkaWlwN0nMZPrbBsMeF8HvtRsjwAU7Gv+T+ GauAyfE/Rdq5qd/W8x6M6KKkz4dywNGoSBZ3Ca5dm82x6ox325GCDXu+5Ph13MGtiNpR Rm6DsCTWl6fEBKlE9TBPIBYtCpT8rVQC0CbpMQ5l7gya0Qlp8KhS4PefCVZ3Sfg+Xn4d Xp/GbfACSpOXOBRdC25/RUeESpA8PGCnvvi4lNwFKT0fgemn/9/zIDvmmdtenHbW4Smw 3XJDzi7PPOWiDJIqDYhQ0YnbbGsXCNvvOXwsFg5BRWvzPuF4CfTLy1WzHjtCiwSYqKAJ UBJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698130; x=1734302930; 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=VygN+W9RKPAJjasMCWSLuOlElJZ/pQQzo9TD4o2RJQI=; b=dEWbeibAjMTqbV3/knAGywIvL0X2xEpds/nlKD7inkh2Qsj/9tnP4gNjA5jge+FiR0 kSoI4SIJASpMJpZNu2lFT5xBFMYQ55hlKhQ0hV/Cj2t0ynEDWv6/snE8jd/bmyRgDD1u vrKaEI4jJtBhIn1mV5fJbKN3yf8u8k6hWQTLoAfEZe/mS+/FMr2QN0dQBi/0L4qmxE4A 02UAjNYNgsPw3qy4+aoqsFv4qJg1h7lDXw7+FkwshFAztInGjJ6LhdZpUZk70T3NbIZZ O+XDv+ciuy098zjJ305+GE9jtDQVcYlEXg9wkskrk8LuvtcFDFyPn79VYFXdxtO745Z0 Hcbw== X-Gm-Message-State: AOJu0YxHG4ktQCN4hWQbfilG1feu7eCW9x1M2ix3OEuYpuA6cD02sQcx T4KWmxKHcVFXEdIvyNhyP/kUyg8gPCouRL/NbhCOnKBJPLCUr56wgdFIKkrCQjROvSEmIyJrqDj dn/esUQ== X-Gm-Gg: ASbGncuyYqQ/g5ftsOleKEKpOu2FDaLFuGpXPVJTwn8wkHS9x4N+AO6qFqp2Xq4oMDu wNrfW3h1KJxFR4NbzPB1FwkrlUCpvpbxpI8MR1wtXc+DwgFiU/rryPngJoGZiVeab+5UX/b3lT6 BISNpNh2oxJFdSbhwICzVCnLkEDHjvMPCHY2f3x8VY++nUyu9sQxcvX1kdJTjDektLhpVX5Hnp6 ++wiWTQHs7hebs0auPtQJ5IHlr+AOoykvAA+l4kX4tCtHHjfJOJt1D2OoQL6cR19LlVSfETcprp kwhyA7XLhDTkdhCX0y8c4nIzkmMywUJ9pIPQ X-Received: by 2002:a05:6830:700e:b0:71d:4385:665e with SMTP id 46e09a7af769-71dcf4cc128mr6426441a34.9.1733698130362; Sun, 08 Dec 2024 14:48:50 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:48:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 03/17] target/sparc: Use float*_muladd_scalbn Date: Sun, 8 Dec 2024 16:48:30 -0600 Message-ID: <20241208224844.570491-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32a.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 Use the scalbn interface instead of float_muladd_halve_result. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/sparc/helper.h | 4 +- target/sparc/fop_helper.c | 8 ++-- target/sparc/translate.c | 80 +++++++++++++++++++++++---------------- 3 files changed, 54 insertions(+), 38 deletions(-) diff --git a/target/sparc/helper.h b/target/sparc/helper.h index 134e519a37..49ace89858 100644 --- a/target/sparc/helper.h +++ b/target/sparc/helper.h @@ -59,7 +59,7 @@ DEF_HELPER_FLAGS_3(faddd, TCG_CALL_NO_WG, f64, env, f64, f64) DEF_HELPER_FLAGS_3(fsubd, TCG_CALL_NO_WG, f64, env, f64, f64) DEF_HELPER_FLAGS_3(fmuld, TCG_CALL_NO_WG, f64, env, f64, f64) DEF_HELPER_FLAGS_3(fdivd, TCG_CALL_NO_WG, f64, env, f64, f64) -DEF_HELPER_FLAGS_5(fmaddd, TCG_CALL_NO_WG, f64, env, f64, f64, f64, i32) +DEF_HELPER_FLAGS_6(fmaddd, TCG_CALL_NO_WG, f64, env, f64, f64, f64, s32, i32) DEF_HELPER_FLAGS_3(fnaddd, TCG_CALL_NO_WG, f64, env, f64, f64) DEF_HELPER_FLAGS_3(fnmuld, TCG_CALL_NO_WG, f64, env, f64, f64) @@ -72,7 +72,7 @@ DEF_HELPER_FLAGS_3(fadds, TCG_CALL_NO_WG, f32, env, f32, f32) DEF_HELPER_FLAGS_3(fsubs, TCG_CALL_NO_WG, f32, env, f32, f32) DEF_HELPER_FLAGS_3(fmuls, TCG_CALL_NO_WG, f32, env, f32, f32) DEF_HELPER_FLAGS_3(fdivs, TCG_CALL_NO_WG, f32, env, f32, f32) -DEF_HELPER_FLAGS_5(fmadds, TCG_CALL_NO_WG, f32, env, f32, f32, f32, i32) +DEF_HELPER_FLAGS_6(fmadds, TCG_CALL_NO_WG, f32, env, f32, f32, f32, s32, i32) DEF_HELPER_FLAGS_3(fnadds, TCG_CALL_NO_WG, f32, env, f32, f32) DEF_HELPER_FLAGS_3(fnmuls, TCG_CALL_NO_WG, f32, env, f32, f32) diff --git a/target/sparc/fop_helper.c b/target/sparc/fop_helper.c index 6f9ccc008a..f4af04f061 100644 --- a/target/sparc/fop_helper.c +++ b/target/sparc/fop_helper.c @@ -344,17 +344,17 @@ Int128 helper_fsqrtq(CPUSPARCState *env, Int128 src) } float32 helper_fmadds(CPUSPARCState *env, float32 s1, - float32 s2, float32 s3, uint32_t op) + float32 s2, float32 s3, int32_t sc, uint32_t op) { - float32 ret = float32_muladd(s1, s2, s3, op, &env->fp_status); + float32 ret = float32_muladd_scalbn(s1, s2, s3, sc, op, &env->fp_status); check_ieee_exceptions(env, GETPC()); return ret; } float64 helper_fmaddd(CPUSPARCState *env, float64 s1, - float64 s2, float64 s3, uint32_t op) + float64 s2, float64 s3, int32_t sc, uint32_t op) { - float64 ret = float64_muladd(s1, s2, s3, op, &env->fp_status); + float64 ret = float64_muladd_scalbn(s1, s2, s3, sc, op, &env->fp_status); check_ieee_exceptions(env, GETPC()); return ret; } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index cdd0a95c03..005efb13f1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1364,93 +1364,109 @@ static void gen_op_fabsq(TCGv_i128 dst, TCGv_i128 src) static void gen_op_fmadds(TCGv_i32 d, TCGv_i32 s1, TCGv_i32 s2, TCGv_i32 s3) { - gen_helper_fmadds(d, tcg_env, s1, s2, s3, tcg_constant_i32(0)); + TCGv_i32 z = tcg_constant_i32(0); + gen_helper_fmadds(d, tcg_env, s1, s2, s3, z, z); } static void gen_op_fmaddd(TCGv_i64 d, TCGv_i64 s1, TCGv_i64 s2, TCGv_i64 s3) { - gen_helper_fmaddd(d, tcg_env, s1, s2, s3, tcg_constant_i32(0)); + TCGv_i32 z = tcg_constant_i32(0); + gen_helper_fmaddd(d, tcg_env, s1, s2, s3, z, z); } static void gen_op_fmsubs(TCGv_i32 d, TCGv_i32 s1, TCGv_i32 s2, TCGv_i32 s3) { - int op = float_muladd_negate_c; - gen_helper_fmadds(d, tcg_env, s1, s2, s3, tcg_constant_i32(op)); + TCGv_i32 z = tcg_constant_i32(0); + TCGv_i32 op = tcg_constant_i32(float_muladd_negate_c); + gen_helper_fmadds(d, tcg_env, s1, s2, s3, z, op); } static void gen_op_fmsubd(TCGv_i64 d, TCGv_i64 s1, TCGv_i64 s2, TCGv_i64 s3) { - int op = float_muladd_negate_c; - gen_helper_fmaddd(d, tcg_env, s1, s2, s3, tcg_constant_i32(op)); + TCGv_i32 z = tcg_constant_i32(0); + TCGv_i32 op = tcg_constant_i32(float_muladd_negate_c); + gen_helper_fmaddd(d, tcg_env, s1, s2, s3, z, op); } static void gen_op_fnmsubs(TCGv_i32 d, TCGv_i32 s1, TCGv_i32 s2, TCGv_i32 s3) { - int op = float_muladd_negate_c | float_muladd_negate_result; - gen_helper_fmadds(d, tcg_env, s1, s2, s3, tcg_constant_i32(op)); + TCGv_i32 z = tcg_constant_i32(0); + TCGv_i32 op = tcg_constant_i32(float_muladd_negate_c | + float_muladd_negate_result); + gen_helper_fmadds(d, tcg_env, s1, s2, s3, z, op); } static void gen_op_fnmsubd(TCGv_i64 d, TCGv_i64 s1, TCGv_i64 s2, TCGv_i64 s3) { - int op = float_muladd_negate_c | float_muladd_negate_result; - gen_helper_fmaddd(d, tcg_env, s1, s2, s3, tcg_constant_i32(op)); + TCGv_i32 z = tcg_constant_i32(0); + TCGv_i32 op = tcg_constant_i32(float_muladd_negate_c | + float_muladd_negate_result); + gen_helper_fmaddd(d, tcg_env, s1, s2, s3, z, op); } static void gen_op_fnmadds(TCGv_i32 d, TCGv_i32 s1, TCGv_i32 s2, TCGv_i32 s3) { - int op = float_muladd_negate_result; - gen_helper_fmadds(d, tcg_env, s1, s2, s3, tcg_constant_i32(op)); + TCGv_i32 z = tcg_constant_i32(0); + TCGv_i32 op = tcg_constant_i32(float_muladd_negate_result); + gen_helper_fmadds(d, tcg_env, s1, s2, s3, z, op); } static void gen_op_fnmaddd(TCGv_i64 d, TCGv_i64 s1, TCGv_i64 s2, TCGv_i64 s3) { - int op = float_muladd_negate_result; - gen_helper_fmaddd(d, tcg_env, s1, s2, s3, tcg_constant_i32(op)); + TCGv_i32 z = tcg_constant_i32(0); + TCGv_i32 op = tcg_constant_i32(float_muladd_negate_result); + gen_helper_fmaddd(d, tcg_env, s1, s2, s3, z, op); } /* Use muladd to compute (1 * src1) + src2 / 2 with one rounding. */ static void gen_op_fhadds(TCGv_i32 d, TCGv_i32 s1, TCGv_i32 s2) { - TCGv_i32 one = tcg_constant_i32(float32_one); - int op = float_muladd_halve_result; - gen_helper_fmadds(d, tcg_env, one, s1, s2, tcg_constant_i32(op)); + TCGv_i32 fone = tcg_constant_i32(float32_one); + TCGv_i32 mone = tcg_constant_i32(-1); + TCGv_i32 op = tcg_constant_i32(0); + gen_helper_fmadds(d, tcg_env, fone, s1, s2, mone, op); } static void gen_op_fhaddd(TCGv_i64 d, TCGv_i64 s1, TCGv_i64 s2) { - TCGv_i64 one = tcg_constant_i64(float64_one); - int op = float_muladd_halve_result; - gen_helper_fmaddd(d, tcg_env, one, s1, s2, tcg_constant_i32(op)); + TCGv_i64 fone = tcg_constant_i64(float64_one); + TCGv_i32 mone = tcg_constant_i32(-1); + TCGv_i32 op = tcg_constant_i32(0); + gen_helper_fmaddd(d, tcg_env, fone, s1, s2, mone, op); } /* Use muladd to compute (1 * src1) - src2 / 2 with one rounding. */ static void gen_op_fhsubs(TCGv_i32 d, TCGv_i32 s1, TCGv_i32 s2) { - TCGv_i32 one = tcg_constant_i32(float32_one); - int op = float_muladd_negate_c | float_muladd_halve_result; - gen_helper_fmadds(d, tcg_env, one, s1, s2, tcg_constant_i32(op)); + TCGv_i32 fone = tcg_constant_i32(float32_one); + TCGv_i32 mone = tcg_constant_i32(-1); + TCGv_i32 op = tcg_constant_i32(float_muladd_negate_c); + gen_helper_fmadds(d, tcg_env, fone, s1, s2, mone, op); } static void gen_op_fhsubd(TCGv_i64 d, TCGv_i64 s1, TCGv_i64 s2) { - TCGv_i64 one = tcg_constant_i64(float64_one); - int op = float_muladd_negate_c | float_muladd_halve_result; - gen_helper_fmaddd(d, tcg_env, one, s1, s2, tcg_constant_i32(op)); + TCGv_i64 fone = tcg_constant_i64(float64_one); + TCGv_i32 mone = tcg_constant_i32(-1); + TCGv_i32 op = tcg_constant_i32(float_muladd_negate_c); + gen_helper_fmaddd(d, tcg_env, fone, s1, s2, mone, op); } /* Use muladd to compute -((1 * src1) + src2 / 2) with one rounding. */ static void gen_op_fnhadds(TCGv_i32 d, TCGv_i32 s1, TCGv_i32 s2) { - TCGv_i32 one = tcg_constant_i32(float32_one); - int op = float_muladd_negate_result | float_muladd_halve_result; - gen_helper_fmadds(d, tcg_env, one, s1, s2, tcg_constant_i32(op)); + TCGv_i32 fone = tcg_constant_i32(float32_one); + TCGv_i32 mone = tcg_constant_i32(-1); + TCGv_i32 op = tcg_constant_i32(float_muladd_negate_result); + gen_helper_fmadds(d, tcg_env, fone, s1, s2, mone, op); } static void gen_op_fnhaddd(TCGv_i64 d, TCGv_i64 s1, TCGv_i64 s2) { - TCGv_i64 one = tcg_constant_i64(float64_one); - int op = float_muladd_negate_result | float_muladd_halve_result; - gen_helper_fmaddd(d, tcg_env, one, s1, s2, tcg_constant_i32(op)); + TCGv_i64 fone = tcg_constant_i64(float64_one); + TCGv_i32 mone = tcg_constant_i32(-1); + TCGv_i32 op = tcg_constant_i32(float_muladd_negate_result); + gen_helper_fmaddd(d, tcg_env, fone, s1, s2, mone, op); } static void gen_op_fpexception_im(DisasContext *dc, int ftt) From patchwork Sun Dec 8 22:48:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848281 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840032wrt; Sun, 8 Dec 2024 14:50:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXdjmrYz6Vm92j5VVp/2aqU0DigiAjPM9I/UaovCHjYb2zIXLCOzMe3q7JxbdH6zDwQppUl9w==@linaro.org X-Google-Smtp-Source: AGHT+IEPYi5UkssHI2QY6DpAxjmVeN0XP4dgUaWyueCH0+9Hx04SBkTqGRJw/WyRdS7SMlX0sIBO X-Received: by 2002:a05:620a:1998:b0:7a1:c40d:7573 with SMTP id af79cd13be357-7b6bcb91fbfmr1248481685a.49.1733698216379; Sun, 08 Dec 2024 14:50:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698216; cv=none; d=google.com; s=arc-20240605; b=aYO4kOpRd+N741OnhTjXJJpG5TJfeM+azCREbMuM8kMlXdGDRCKtnJgZOhLq49VudU KsD4u+wJNda9Qb9BWCiYHolglruIpFkzVr1jaMOHuR/gXcmLtH+5fLevqYq2l5KXgCPJ lLePGbWZodU0fvUI4oAtaP8uehkU2huRk82YQjGs0SmuaWu0Av4YSBbZrNF121nXUmKP lhqbh//yNcAc1Q3B7Rnu1w4SXPQAhCGhQTwisHLi+qJlMzmgeWmLtcLIecNSjH/3OE0y OGyXqLvecLR7xGJO7FlolAlKoodM+ZSuxjYM9dQqd0HEzLj8W7AbjNxblaLaB44VmQ4a 3t6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=ngH9p42c0w/Bs34iA9YcexqT8mFBvJQCf0c5QlB9/w4=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=V2DtpgTEWgOSqT3ppYv/z54yQlcnE0we+VtYbmZZ0oTrmxrX09/WqBq3UnIw8DNRSK 8vHsABegkvYbhfiSl2Gp9/arsNe+LXKjuCU2kl2XM5hucULD2J5EOn/Qh5p1RRZ57rt8 J2qSh0WSeI1OXi7M4A//a75BU+017vWlRtZPxfplJTbM1ewu4hPrFjh1TmKkHIepiD0V x8VwC5NbBrQw2JdBZNn3Dd/N/X2TunhszJodjlIS2Ywvw8WyjCfHSTqBscx29ItKNw7O bOlMnTTw4aT7qHJ+1zavAtaQSclwRMDQCSLQ7V+1tLb1acgpr1qu7tpu0zwh9gJyCtk2 Mjsg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G1y7BZHM; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8daa08612si98847046d6.216.2024.12.08.14.50.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:50:16 -0800 (PST) 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=G1y7BZHM; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5A-00078k-U1; Sun, 08 Dec 2024 17:48:56 -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 1tKQ58-00077t-IC for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:54 -0500 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ57-0006Cz-0I for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:54 -0500 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-5f2abc195f3so313842eaf.0 for ; Sun, 08 Dec 2024 14:48:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698132; x=1734302932; 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=ngH9p42c0w/Bs34iA9YcexqT8mFBvJQCf0c5QlB9/w4=; b=G1y7BZHMrJaIZ2tIxgufoy5EwG/Yiv3KcNAAj7ZZ0Y1fh9XS91liliVDoj6AHkVC5y dVeViPNejValpl76AyqG60JPrRPG48E72qaYEF9vMt4Oen8nb4vKo0kCfylgzMPgfvrv d4eqjbizFhCbxtkIW4ULzk0GPpwSCBwfV77LXlRdSaAsjZflFvRGAPJxHq0B9eLUrSYu BcGL7tbWIbQ18LRk6UlINT2wC2B96+pAfKa/p93TxFD2mOnPbQKmzFLQ5dbVdyOtHltN rtpvTW17k+jHJ4K8Sv/Z1g5FR3rXAyjvB6qFwV41ZsS8z7VOMJN/2LtHIkF7hcxjI8Ni ryIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698132; x=1734302932; 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=ngH9p42c0w/Bs34iA9YcexqT8mFBvJQCf0c5QlB9/w4=; b=fe+RbFsPFvIYipf1IjhvFClVDvdLoj6ofKngHgDHsVeylwCuNapLj1NyLlaOletQR9 WXu2ee8iSnDcjXe9twS7DMdqvtvaxrATT4aW68lR7Xfclqklg3ANNAH0iHWYaZ919tXp LmSqnn2N3NKO0vzxORn8FakczJy82XeAo7Cw8UC+W7VYBTPD0NBFwf1Vdt4AO4pdXDj9 XN95coeJfZAzPIuLVMBQZ3339wTpMZ3Q/+Wbhod++6gyMXoD7z5xLxQn7X81J20qOqw9 WnL/kEk25GxuGelbrF2QWpadSh+Sx6kek+dWnrnMraCNGMhK0X55W1qiHjpxhKzZXJWn fcsA== X-Gm-Message-State: AOJu0YyRSsGnnuUobEm0dx8WjLM9CUas+fmMmM/r/RvOrVKvpbvOzbDe idFwxaE9r/G0Vxp6C/fs9Qm1aEyURBKEI4Dq3DQR0s7Kh9HCOyfKPvKwuR7NlQMQJ3LFSWHpQxh KniH/pw== X-Gm-Gg: ASbGncsXZpmZGaKOSQ2rjBJAmwOW4DpwglEb8w4UTQ5h0+kLoyfTxl4Wb4NYMX1IGMz gT9g4Czo4ci3KaWb/E0EG7JBS6MOit041DANvbb402Ds+NhGXihZuZeT0qh+SueRDdzdlPjLlB5 ewUzikAcOOGvc+W3nx+aFW7cIzaqH2J8UaIKCvLHyCIXGhfBCmjLpEoLEQcrAqFDvBCrY3OxNCZ tol5sK/Alez1tSiX0jVDxRJJG1qFWlwHr6S1fXsHqz9gTl9/ihg+iLAOgFoTjlKnOpBNCedXCx9 U3N0WmwrXYuPhf2sShpvwmExgEz17b0EkD30 X-Received: by 2002:a05:6820:8109:b0:5ee:bb2:bdc3 with SMTP id 006d021491bc7-5f286e7caf6mr8275875eaf.2.1733698131796; Sun, 08 Dec 2024 14:48:51 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.48.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:48:51 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 04/17] softfloat: Remove float_muladd_halve_result Date: Sun, 8 Dec 2024 16:48:31 -0600 Message-ID: <20241208224844.570491-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c31; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc31.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 All uses have been convered to float*_muladd_scalbn. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/fpu/softfloat.h | 3 --- fpu/softfloat.c | 6 ------ fpu/softfloat-parts.c.inc | 4 ---- 3 files changed, 13 deletions(-) diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index c34ce0477d..aa69aecfb0 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -120,14 +120,11 @@ bfloat16 bfloat16_squash_input_denormal(bfloat16 a, float_status *status); | Using these differs from negating an input or output before calling | the muladd function in that this means that a NaN doesn't have its | sign bit inverted before it is propagated. -| We also support halving the result before rounding, as a special -| case to support the ARM fused-sqrt-step instruction FRSQRTS. *----------------------------------------------------------------------------*/ enum { float_muladd_negate_c = 1, float_muladd_negate_product = 2, float_muladd_negate_result = 4, - float_muladd_halve_result = 8, }; /*---------------------------------------------------------------------------- diff --git a/fpu/softfloat.c b/fpu/softfloat.c index a4174de692..81e7a7524b 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -2274,9 +2274,6 @@ float32_muladd(float32 xa, float32 xb, float32 xc, int flags, float_status *s) if (unlikely(!can_use_fpu(s))) { goto soft; } - if (unlikely(flags & float_muladd_halve_result)) { - goto soft; - } float32_input_flush3(&ua.s, &ub.s, &uc.s, s); if (unlikely(!f32_is_zon3(ua, ub, uc))) { @@ -2345,9 +2342,6 @@ float64_muladd(float64 xa, float64 xb, float64 xc, int flags, float_status *s) if (unlikely(!can_use_fpu(s))) { goto soft; } - if (unlikely(flags & float_muladd_halve_result)) { - goto soft; - } float64_input_flush3(&ua.s, &ub.s, &uc.s, s); if (unlikely(!f64_is_zon3(ua, ub, uc))) { diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index 5133358878..5b5969725b 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -567,10 +567,6 @@ static FloatPartsN *partsN(muladd_scalbn)(FloatPartsN *a, FloatPartsN *b, a->exp = p_widen.exp; return_normal: - /* TODO: Replace all use of float_muladd_halve_result with scale. */ - if (flags & float_muladd_halve_result) { - a->exp -= 1; - } a->exp += scale; finish_sign: if (flags & float_muladd_negate_result) { From patchwork Sun Dec 8 22:48:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848288 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840169wrt; Sun, 8 Dec 2024 14:50:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV0OyOd3fu5+6lGg0TO8WBs4auZdSzf7AXE9T9AiN/cUh6n8G82dcBtArNq592PuiaUWj6X+g==@linaro.org X-Google-Smtp-Source: AGHT+IF1DqOByIssV5xQtA7W1QKtYEKZUSrVoLQ2/RIgU2Pu/EkdwLTvBAAjGfi5Hqe1edFoNJhf X-Received: by 2002:a05:620a:4592:b0:7b1:559c:58ef with SMTP id af79cd13be357-7b6bcb82edemr2106211585a.57.1733698248431; Sun, 08 Dec 2024 14:50:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698248; cv=none; d=google.com; s=arc-20240605; b=RAjvZSvlJMT6B8cnKmdqWFiplBXABQmanvdIIyvH0nH7ubGDobpGwYwkaT8oKUk+K7 gNaFquqAi8MNocokc9QA+qbJoJLcaiCCKBsUUocadTyStQtAJLmQwo2iS+zDRVJQvyUy OqLr+txKDo10mZ0LPaFjk92lRufLUJxl8f5FqfRXixt96e9UDXAyOM0mwIzhAGLSouzs tGw59dwkLdZB4JFUbL8suDEUhYEKX4cKV3MV9DfGYVEV/9I2GpsTQOqDQ4blyFzH36O3 9c1lr5dhPDK4adb0O/Xp9zfwF2q0AMlLdRh6I5eUnogti0bSg735R1OIyos4UorNcYp+ EUlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=3V0186xH70riO7Fn9lXQ499lIB9ZSqDTvKf2GBot8Cs=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=J/vYV/OnUtIQZb8DWyFEXvEcINoAPQMHPCHufoDH4rK0k3yNoRmuJKBNtaZOhSYSD+ f3J13MGU83oHUbq/zYVQi++y2OZUebfVg3Nm37lIJOxrKWBjvOKr01ESjcSGMtLFL2Wh i++Tzj5Z8v3u25nnUPAASxAxGiqe1Xk2nPlrdfU7O+5Ohd0AcXkFzaUczsRgsIam+zDu WlsCIKv/oyI5kNMugwwSA/lBaoCV4jaP4auH41NWw/FWZ3AHY0qnktfuzf58cbzLhG/t ZMRdLMrdVfBtUNTWh7KqLx75cr/mUlEhz6QdLgUcd4Edvx4E8G6cG8sJ9BiIUQ/piOEX HkrA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h0SaTVpi; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8da680012si100649326d6.46.2024.12.08.14.50.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:50:48 -0800 (PST) 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=h0SaTVpi; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5D-00079L-By; Sun, 08 Dec 2024 17:48:59 -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 1tKQ59-000788-LN for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:55 -0500 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ58-0006DJ-2E for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:55 -0500 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-5f29e2e756bso246354eaf.3 for ; Sun, 08 Dec 2024 14:48:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698133; x=1734302933; 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=3V0186xH70riO7Fn9lXQ499lIB9ZSqDTvKf2GBot8Cs=; b=h0SaTVpiQTkUcj6T2neyk+dcjkjmH0n9jxjzCZnbBqGI3/NWwVHxg3+JIizeOkAqYw FQiilBBZd0KHtpgCGJSTkfM+fk9blHj9jxolhsMT+o3pKe6yRe4UqMAS11GJyvdJ8nIy 4uhcIxLOyjNtJIHXgAq0kKYPpqFgi7D9xSixEJxRQhnM20gvd/k6CWCasoq15WM+XUr7 VqdS82FF+4HgVKGMFGPePz1E5NYpZmbmS+POfjOUggFGEDs0IMmjfy4GlQ+TFr4rbbnn C+Da3cMyLcIls2ISDLzJUvxYbZsF7RoQnNvx4c/LQw9Ne/5UKkVl5HsDDsQFnM/W+buj Gdxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698133; x=1734302933; 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=3V0186xH70riO7Fn9lXQ499lIB9ZSqDTvKf2GBot8Cs=; b=ojr5/3BF2Dzfcy1u4TgN0jpLef5IdQwsXxJFPncV3b+ZNaDc4qrcJ3zuECVBA39wdC I7ztlJmESoQPOSls1kylxHIqs1fwkb0+BavY1+XsMc4H45L264JGKuw8dWIc17tx9zGm XgbYzJaCFfPAHqV+Q9ysfvfLABZOpV8pYWmoLaLWnJPiN2CWIEozqhMRv7RP6Ckgc8IQ rkdUiAi7879MXjvq/pVVVbMEJx6XDNNvzoSnOuSd9ujX4K3mbZM8SuinB50xR10bSEHS A02+BCMltHgtAiJGEE/pkokozK6LCIn6UD+HxBPoPmifhZY0mEexQhrggJ8m+2bFmAJJ 0ZOg== X-Gm-Message-State: AOJu0YwZXTkGID4vY4SDWI+v1YwwTwYGnvWwAV3ZctLlo7S7kTOCIvmZ +fljAsmJoRsrLNF+qnSL9sxX8bKRB2PFcGhkL+alMxV98bHz5J2AFkf6u4Taef4B6bLdJue9BkJ ixX+wKw== X-Gm-Gg: ASbGncsIX1icSTGc4txMIcxTNUfpyyrAd0DJ95AlSYHQ8awHdA5bPJK6sXi6wUxtvtO K03WAGy6PF2s3UcaCZqJp0h+nwW5UdVY+2n3AB5VmnieAHjOufaipfAna1pS9w6h/VelrcoTZwj UJmLJyxNsK+COqtyb0BK2DtgEdnlEgoxYR0sqhikKf/gPvmi9/V2KGnXBq0TfHHbH757IUjfQp3 gD2seGdHl43j+7jPuOPGVrOo6b6XIWrILyz8nyg3qMx+aN5p0VLWofBK+5uCIfOXEAXFyC1TbW9 zFySA53xuee0IEse6PHrnsqujVvmmI2bqMvc X-Received: by 2002:a05:6820:1614:b0:5ee:d925:d6a4 with SMTP id 006d021491bc7-5f28700e87cmr6880348eaf.3.1733698133017; Sun, 08 Dec 2024 14:48:53 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.48.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:48:52 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 05/17] softfloat: Add float_round_nearest_even_max Date: Sun, 8 Dec 2024 16:48:32 -0600 Message-ID: <20241208224844.570491-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c29; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc29.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 This rounding mode is used by Hexagon. Signed-off-by: Richard Henderson --- include/fpu/softfloat-types.h | 2 ++ fpu/softfloat-parts.c.inc | 3 +++ 2 files changed, 5 insertions(+) diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index 8f39691dfd..c6429665ce 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -138,6 +138,8 @@ typedef enum __attribute__((__packed__)) { float_round_to_odd = 5, /* Not an IEEE rounding mode: round to closest odd, overflow to inf */ float_round_to_odd_inf = 6, + /* Not an IEEE rounding mode: round to nearest even, overflow to max */ + float_round_nearest_even_max = 7, } FloatRoundMode; /* diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index 5b5969725b..2b6adeef4c 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -155,6 +155,9 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s, int exp, flags = 0; switch (s->float_rounding_mode) { + case float_round_nearest_even_max: + overflow_norm = true; + /* fall through */ case float_round_nearest_even: if (N > 64 && frac_lsb == 0) { inc = ((p->frac_hi & 1) || (p->frac_lo & round_mask) != frac_lsbm1 From patchwork Sun Dec 8 22:48:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848287 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840163wrt; Sun, 8 Dec 2024 14:50:47 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUZjhQAneoUYRZdWgo5UaFrS0lzC9fczIcVE48SCVZOKaYLk+jAWiFvTFIyoYiQRPDDeoZJHA==@linaro.org X-Google-Smtp-Source: AGHT+IFK7Glxf7OCacKRQLjFNTrfE96mQXw/MtxON+Ua7V6zEqlCpprcxZfrbisImEKacGKEAfIh X-Received: by 2002:a05:620a:268a:b0:7b1:12f5:7af5 with SMTP id af79cd13be357-7b6bcac5c2dmr1865863385a.3.1733698246911; Sun, 08 Dec 2024 14:50:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698246; cv=none; d=google.com; s=arc-20240605; b=U6hSZsaSkuqXfGqyLbo9YWbOcpUPCDTfvjitFOSwiu7Zy33zy0/0RJuOCByQxcX8hw 8AzM8dglytW7Hy7AA9pALfqGRPktXLuuM2/GOhOFHEobT7dYEM1GgBxk0FMqrcsdvdR2 FLIsTK6OCxIUnzHDk/o+pS5jmPFt6w6OcjI6BAodBqY7kLgMfDpFEMd9x/u5ZmQL2vMz fhSu3EoHHnzy09sLIhwHp1+IcES363W4DpSA63mkbDQ77g/79RGLFLMM6+PViN9nKcdZ XM7xzPznnDVKUz1XocYhZzCdxCa6171VGFgTcsN4Zj/OzVa6YgEXrCJk4NvRxD9qpVlY UoAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=GP9lF16T6qLE7Iw1bLwN66Qqfacm79ugW11up6kxmVc=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=jFSXs8jaVcTDRUsXq4thAlGTV4nNTXFQcsnDXa0XJzdoXbU1m649aS+VZOyvY/BUog lNf8l+1CK0OrZe89ImQYh7Ku93Q9sAYHhP0qUFNIZeUTiXSDWTC8cvD7uGxe8TKAJMwq eqbE+2ehRbUYdiHQSkYn2VY3yTPEGDyYe1oLl8d+3jArhEQs/bRo/hAgTeZCowgISkU1 5xOBcn1lCedrbPeCCcBPkJFOCfJrfqu+IZ/g8VKW36FORDuf5opwV43qmCTZ7/YZ/2cO M1wdL79TZvwWJYJ4CyW1VpH9qu8OVkX1OIMY838bDpzXkQGm/GJNd/wXJVNEzt1nzu24 jUDA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="tVS/FfvG"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d7b31e73si61071185a.625.2024.12.08.14.50.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:50:46 -0800 (PST) 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="tVS/FfvG"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5C-00079D-MF; Sun, 08 Dec 2024 17:48:58 -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 1tKQ5B-00078w-2L for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:57 -0500 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ59-0006Dh-Hh for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:56 -0500 Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-71de7b9d572so473517a34.2 for ; Sun, 08 Dec 2024 14:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698134; x=1734302934; 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=GP9lF16T6qLE7Iw1bLwN66Qqfacm79ugW11up6kxmVc=; b=tVS/FfvGQjUkjBRTYHMkwYUbxPT8DuPBA0FgHN3e1nvrJHrU+3j1aZrphpyud9no2c EGpE4OeNDcQUrq9KUl8kHvMHK0frdBZ9s0JbCdXX9/05GP1h+L7ITYws4wz1OB2FMsgD eKm4fS5N/4r0mmwbxyuXTnOgioaSKuxqJFv2Joy/IWovs+nZaz28kF2ZotpDrwxNG+GT 8nsJlmzWr7enUo5ysxuZHs1Gwz2BcVNF3cnEYLnhkdILjYcgOe731U28R9KM1lcigG+4 voNK6K4OlKwPY0IXm4jCFD0rcQb4xnd7fn2nGFxjVGO/fJ6TcIVffPYdtpkw5k6xb1Wl ujgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698134; x=1734302934; 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=GP9lF16T6qLE7Iw1bLwN66Qqfacm79ugW11up6kxmVc=; b=CODZApR6Rzfsgg0X7J9HYznrOVmWiA2XlXFc5PPFQvVST1J5MPp8YkqElLYzBn0TyF G5hNtxRFbFUb5LUOp/CfAdfT8rMcvR/jWVWU5F3L5f3o3aNUzO/wbeNIEJD+nT82Q1pr uix3HUeHi0KKszSExTB8oXSRoGbvWdkJg1jTWCIkdbxQ22LFANvXaLFEBkd/GWnvAP5n iP0GVAbH6XhDe3VRrpXpJz3qqzsKYncbeyjpEPUpFTVqODD5083tONGwpfX3SNsC1zjl WGvOSo1tZTLnZScV9a402u4OlUKM1Jt5qvjPqrzUyrQ16o9BrXCdoH5oNW/w8Cr+WDMO 9CqQ== X-Gm-Message-State: AOJu0YxV8D/QZkBOGke3oT7zTz+nT9iKHSp1GET2mLDeIwbOtV1eP+07 j/I7dZgFRcFPoYZZr2BocaoDSC4ntthexog1Z/IRzHWYUEF3Gh70CnEldxmO9KG9GBBnqCkkrtR eKyt/Bw== X-Gm-Gg: ASbGncuXsGTzFlbgBd5sKsI2EucH4vosz/6xViRsmYt4h0FW1xCebvUOreA1ROEO+hP wAk/p++EDDsWehGD0zlSk3fLdBpHjBTyOfM0J8gHQbOXx2sj7NiIdl1rTwwswbiHTa5ivvAjTCE 69uM9M1cLWDsBW+4LMIqb/66LTdKTIqqVNHMa8TnFVamPETHNlgdBL3HVLgTlJeS7Cl3Fdo90T8 H+R/uIraEUZhkTDJ9KrOveT7p+CNRIhq31J79ZtMRVrRB1YloKXrvacxKQA6j54i0BCROldnVX7 fCVG4Krx+bOUM4VCyBPIhu4qXBCKqVzxJnBb X-Received: by 2002:a05:6830:6207:b0:71d:4264:cce2 with SMTP id 46e09a7af769-71dcf4d9648mr6401382a34.9.1733698134483; Sun, 08 Dec 2024 14:48:54 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:48:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 06/17] softfloat: Add float_muladd_suppress_add_product_zero Date: Sun, 8 Dec 2024 16:48:33 -0600 Message-ID: <20241208224844.570491-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x336.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 Certain Hexagon instructions suppress changes to the result when the product of fma() is a true zero. Signed-off-by: Richard Henderson --- include/fpu/softfloat.h | 5 +++++ fpu/softfloat-parts.c.inc | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index aa69aecfb0..09a40b4310 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -120,11 +120,16 @@ bfloat16 bfloat16_squash_input_denormal(bfloat16 a, float_status *status); | Using these differs from negating an input or output before calling | the muladd function in that this means that a NaN doesn't have its | sign bit inverted before it is propagated. +| +| With float_muladd_suppress_add_product_zero, if A or B is zero +| such that the product is a true zero, then return C without addition. +| This preserves the sign of C when C is +/- 0. Used for Hexagon. *----------------------------------------------------------------------------*/ enum { float_muladd_negate_c = 1, float_muladd_negate_product = 2, float_muladd_negate_result = 4, + float_muladd_suppress_add_product_zero = 8, }; /*---------------------------------------------------------------------------- diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index 2b6adeef4c..015b272e30 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -529,7 +529,9 @@ static FloatPartsN *partsN(muladd_scalbn)(FloatPartsN *a, FloatPartsN *b, goto return_normal; } if (c->cls == float_class_zero) { - if (a->sign != c->sign) { + if (flags & float_muladd_suppress_add_product_zero) { + a->sign = c->sign; + } else if (a->sign != c->sign) { goto return_sub_zero; } goto return_zero; From patchwork Sun Dec 8 22:48:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848289 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840213wrt; Sun, 8 Dec 2024 14:51:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX9ZAJpNH4xFArnqTv4BFu7jm4KFLQkcY4AnobnyyqUqb/G3LKZNhnAC3rtqyWRu3rCoS5Atg==@linaro.org X-Google-Smtp-Source: AGHT+IE5ChT2aTz/ovHZ2iBo2McjXULzZ3i5TFIzNyKqgaAwOf32VktxkOfCMybAxB7LOW1TIGUR X-Received: by 2002:a05:620a:2442:b0:7b6:6add:4a3e with SMTP id af79cd13be357-7b6bcaf284cmr1674984685a.35.1733698260173; Sun, 08 Dec 2024 14:51:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698260; cv=none; d=google.com; s=arc-20240605; b=OnQd5ZrGkjVDcd9jNc58Tznag4PkIf4nIbZZ6MEbJTmqzN2S+QhK0gxED4RNrgFjyE NT62y12OYc/Ga6ZidC84QOU/ALf8u5BYrCFWH3iw7j6Et3YirWcjeRvYLEGxyTQd92zl BwFdhrr59yR7DVVpUf4aMMju6A1Kmcc+EDhEKT9RspLmHXOiZ+WWgFnhVNKSmx0u0GvY 6Woma+AbUd7iHKhTRM3o0/fXHp+nQV/Znnb8EshqFbo7pl+MXBMe9lPgdqRfSWCC+U5U lWNMN86KA+MpSYXUjPS29be8B3o6WDc+kbJJQ+BNvGXFlsQnjfu0WNX+GLYhdijxB57H 9HAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=QRa0RWX8JWWgFHE4wF27O0iRwodZmuUKdq8/kFDIfG0=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=gC9CvVp+1aToheW9Idt/FfkKhnUjpXV1kbXngcLAVLsjS5+Xz3wTOFGfbxpeFMYngx NiqpBWiAJe5Z1epTN8k/HArj2aUyBGjV9aKfXorjGq47xcYC2JUoRVSWZ08rw9+wCgvG tq+iqoS15tqffMrcyO9s13hC8/8UfigmAQDMlZifbvp7kk29RWHhjWVAAz/rb9dSmIJt GsA84IiSM520kpO85FyJQxi1eF1zY5FIX5njzcE+NvKUSex8xYX/mcm52ngrOB/JH4ap 7ZCIN8F7ehpeN6cxCbguN/WNWWfOtjk4h4CuHVaigcKA5rEE6iyR8Y3YwSNjCq9Brl1D pu1w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QvKD02uA; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d1aae92asi269027085a.353.2024.12.08.14.51.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:51:00 -0800 (PST) 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=QvKD02uA; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5E-0007A9-MB; Sun, 08 Dec 2024 17:49:00 -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 1tKQ5C-000796-Em for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:58 -0500 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5A-0006Dz-SK for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:58 -0500 Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-71df567621dso89513a34.1 for ; Sun, 08 Dec 2024 14:48:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698136; x=1734302936; 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=QRa0RWX8JWWgFHE4wF27O0iRwodZmuUKdq8/kFDIfG0=; b=QvKD02uAJJ3zUM3JEmrOLo3lc8teQvvo+TkR2kHuDWmihecFmt4/BZWmdj91SzSV+J iiNcx6vR0QowzTJuc+tj+GJiFxaRR+nw+3Ekyk26yfKty5HnmAi2JpNrPBvLsJ2VvDK7 /qPWWSyD4TTFiYSfSulnGA8eqnYpmTbgtrmBd/DnVHX/+awXU4jZGuSIdwdQYBPNK/N7 of/pfuTxi7xZaT/QIFX40QvwZ+2IyChwwj9iZBr99cRLHYEslxnTp4C4x8bAz6LWnGC4 bVUgBbiBhcwTjfSto83v56wL7MnCvNFgPy6qs9GB/hmHSTebekcvhSmjQGGuoqPbPcTL Z2jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698136; x=1734302936; 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=QRa0RWX8JWWgFHE4wF27O0iRwodZmuUKdq8/kFDIfG0=; b=OYSVQYIAMZcsPoY3INrv5g1646LP8NJhpOiQ6n0n5GwhUNj3lW+28wbXFYAe437K+Z B7IMJY2tfyMm3M+Ke+e3lwObL/oyKL1Aefng/ukSdTbNBn++K3m+EmDfdvBRNVcL6A9q kEer++uKkL6+VJB+ehDHRsnbTuOeeSzK3Rb1xSG792J3l4y4sRSV13Q9JzUAj10AUWmw CvPr5h/aqnO3qQNAkmh80e/74B9u2mtLfOdlxlCPGM58u4bnDKCEwi0uDVZF5l4q6/pX d1kc64xIcDM0uyQoO2G5ZiKuSgl7jx9dLgl0jKwx7ytmNHZiyGhH/vOfCZ5w+JsTupFt hoZw== X-Gm-Message-State: AOJu0YyL4sPKbBBRozOVbCJrOjyvnoIt2J6xboavn+81B90EjZXmslv3 sqrfbVyKWCVIEZgIG0l66BtehDbEjeIoWAWM5jW9LglK05bQg/7EpOss42yqfFtI2Zd9mNUN9yy rRJaG3g== X-Gm-Gg: ASbGncsFp+nHKfTKP1hGSwKOhKz6HobN1VsSyhh+zFUYIrow9kOUtBNpcMcCYuLyhmC 6vinX8YpuqJXdnzZQuXscWYZRSa2N8sVblEckMfkuD5KZpKT2H+exik/dcD2BkXs6CaLiAhXxDo +uHLe6Yyrbed0Vrq7XkotQwuinXiPbTYvaApFYKTmupBol1IAIQj0QCdcG71gecyjXxTltmXc05 lEjz5ZovLtekzHveTmLu9N8vBMF9AWiCcwy82Vjn1vPG8t1bFrGjTobo/d/spwlV/bYKWc9vY8V 0s5S0dFIVXBNG6pbsJzUohd+YGYyiDFUiw38 X-Received: by 2002:a05:6830:4992:b0:71d:5a8a:1a2f with SMTP id 46e09a7af769-71dcf4e6b84mr5932360a34.14.1733698135791; Sun, 08 Dec 2024 14:48:55 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:48:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 07/17] target/hexagon: Use float32_mul in helper_sfmpy Date: Sun, 8 Dec 2024 16:48:34 -0600 Message-ID: <20241208224844.570491-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32d.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 There are no special cases for this instruction. Remove internal_mpyf as unused. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- target/hexagon/fma_emu.h | 1 - target/hexagon/fma_emu.c | 8 -------- target/hexagon/op_helper.c | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/target/hexagon/fma_emu.h b/target/hexagon/fma_emu.h index 91591d6050..ad5df5d038 100644 --- a/target/hexagon/fma_emu.h +++ b/target/hexagon/fma_emu.h @@ -32,7 +32,6 @@ int32_t float32_getexp(float32 f32); float32 infinite_float32(uint8_t sign); float32 internal_fmafx(float32 a, float32 b, float32 c, int scale, float_status *fp_status); -float32 internal_mpyf(float32 a, float32 b, float_status *fp_status); float64 internal_mpyhh(float64 a, float64 b, unsigned long long int accumulated, float_status *fp_status); diff --git a/target/hexagon/fma_emu.c b/target/hexagon/fma_emu.c index 05a56d8c10..35971b8b99 100644 --- a/target/hexagon/fma_emu.c +++ b/target/hexagon/fma_emu.c @@ -655,14 +655,6 @@ float32 internal_fmafx(float32 a, float32 b, float32 c, int scale, return accum_round_float32(result, fp_status); } -float32 internal_mpyf(float32 a, float32 b, float_status *fp_status) -{ - if (float32_is_zero(a) || float32_is_zero(b)) { - return float32_mul(a, b, fp_status); - } - return internal_fmafx(a, b, float32_zero, 0, fp_status); -} - float64 internal_mpyhh(float64 a, float64 b, unsigned long long int accumulated, float_status *fp_status) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 90e7aaa097..b8b556f4c6 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1157,7 +1157,7 @@ float32 HELPER(sfmpy)(CPUHexagonState *env, float32 RsV, float32 RtV) { float32 RdV; arch_fpop_start(env); - RdV = internal_mpyf(RsV, RtV, &env->fp_status); + RdV = float32_mul(RsV, RtV, &env->fp_status); arch_fpop_end(env); return RdV; } From patchwork Sun Dec 8 22:48:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848292 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840269wrt; Sun, 8 Dec 2024 14:51:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWJ6fWqgvRVcUiXt0y2FAs2aZhgCuS4ZWrp9I/aVxbvPQ0OsEcVGdfw4LKHqUCKHqIHt6GhjQ==@linaro.org X-Google-Smtp-Source: AGHT+IGg3hdUH2TuXoLzh5xS0gqEThWHHYu+C2QMyy77mLSTgmAJkrRoICCldKp+Wa+c/g15FXIR X-Received: by 2002:a05:620a:1d06:b0:7b1:7da1:e733 with SMTP id af79cd13be357-7b6bcaf4799mr1768294785a.30.1733698275127; Sun, 08 Dec 2024 14:51:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698275; cv=none; d=google.com; s=arc-20240605; b=I+7gLVWMSHcD3JhkvJuxAQ62abULV6NXPEPLbbFVWyOAmtMkQozDAxjG69IfMahDMj Rf7eTyRXM8H/D6oS2ZHHVMFGfEkM906qwXUaZGRYiQIi8PjMc/E2GQ+Z68ZvKZaFDULE 24z4m6vVyhdQZfgPwli0HO6h/yNarnCW34i5g29izhFC2ns1OT+eH7w4lYrJSHyw6qUy w4MVdfpM2/22MMBoAiZyH1ZR5gGgkbCMONubKCjJOqrHaxxD7eKAu1erYXV56DVKwIZc q2ajsizyexc9YLAufEOBr+YDMJiwS6Diw7AhMF0CT0UpNMSXJHH4gwB1UcMfeCt5M3J5 ZASA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=8mYJt475jbhCjJ0U4k+fwEo51fziCsqJ4VlkijB6Ad0=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=QQWBXnhHr7S+eZiuHy8/JItizG+BiJbWRPkfBo66dAk7crYATRR+fF/36wC3jH/JFD YBaJKdAh43oLQIqLYxiifUx3kHfMRWbKpA046tDaEGGYDBT2U+CitF4OAnki7ylrrxYu oWVPh7wtFvCbym9akOdKLXhPcFo9GgqqavBi5JFtFa+h5+d+YPVChdy8s/I3RDy8ubSA 0mrbcNTcV1/awfmMxxrLup26j6HJiLMeJfymLlFjLER9j1FfQOa15p6ICJXNRG+Dn7sk c08i4yFDZx4lOt6dC1y7d4Ty/8YQYY1y+G2x2QPIXjR0hDYdtKVGs6onHZ4V6InAzdBH kzyQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l3p8eaBq; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6b5a5c5e6si996955285a.161.2024.12.08.14.51.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:51:15 -0800 (PST) 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=l3p8eaBq; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5G-0007AZ-3n; Sun, 08 Dec 2024 17:49:02 -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 1tKQ5C-00079F-VP for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:59 -0500 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5B-0006EF-KM for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:58 -0500 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-71d5862c1d1so1667203a34.3 for ; Sun, 08 Dec 2024 14:48:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698136; x=1734302936; 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=8mYJt475jbhCjJ0U4k+fwEo51fziCsqJ4VlkijB6Ad0=; b=l3p8eaBqNqCkPWH7gq6OQl62jNqf0SFfz692Dj9Bv3r4qUrMeNKbx3TIJotPRc+4z8 kfxZXtQyfS7/pu3dId2w2ocdfOk2DPDTQvIqbvx72SyAyxVSSQWDEyS3dIR2kfpNLgE0 cX8CWql0YqOA/DWYxH0RWF2jGuL+H3TcbpvbIonIrDqWg3xGV8gppV+EY4krb7FUpVeY jSCIra603/n5yIce0bPux+5gAfH0UicGueByA415rAl9oLEXBE58KpAZ/vn+URyW/8VR 5VgmdyFXGhPY+lZ0fsRkNUCYFzKKwujNsoETGRt3my6EXYHHcy+TyrJSuGpoVPvZo/RW S7cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698136; x=1734302936; 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=8mYJt475jbhCjJ0U4k+fwEo51fziCsqJ4VlkijB6Ad0=; b=ZyNCyXsbL+tYfOSNxdwdT4y7MM7xeMUtT61uSa4JEBUVvoPyArfjKDHHzjr/u3ZRb7 JTXyxrIwGX9IczFHNl/mdfAQOzt+aNCmIwasx5ne7xXXlbfk4ph+DeXZNL1K1GU8pE8L JrwdZcECv05+XXqPXIpJPOkOJ+lElBbwQX2c63G1oLogy8cqxqBxbAa5LoaBVurxou1M Wdtf4IFE0GGJO9AMMjR9CNQXmjEvGwem3jDefJdkmiQjvWMrMKd46ngdnHZEvuEGFlpi t4/bUbi1bIjx9xVYusVgu+qifjHr1nTPVILpagb8sQZEtX2mZv5Uk33w2OdvLfbejC2q 49Jw== X-Gm-Message-State: AOJu0YwPckRK43oOGNfhIk7rzLI5Csc/LZHn/Z/DJkEmNLfHXEVZzfZq LsuLpl/euoSKVA5rzJqSIku9g+1VOrcnH0OaIJnRjbOJe5pKJg6f8/PT7FMgeOgDN+YivIkIbqP NWjPBkw== X-Gm-Gg: ASbGncvtzvEv7dvUUQvYC/vna3T1ba5Chl7QffyrrH9E+mFUmRqqNyX2WdzhzM8w9H7 8PGn7bmWvzXuagVuu8V/aT4xjE7w9koFguBQ+WXwT0AJspuoxJvB7HD3z188GI2Pbdf0yulOq6D g7aXEzdGQdYGDSsUdOpTe7SSppkFWWEgkKCtWCDtzTzOoU+UR66nUIeBtkCZ+leEztnqrAF6iUv bUZ2yeIa94oJR79VQf4WUj64fXiHUaanin8zTv66yKy31BMoMI3EyilN/XoHB0ckDn+wpUcGIPb QDna1bmx8YbmJzlwsgQZV9x4ISwVsXmec5/q X-Received: by 2002:a05:6830:6208:b0:71d:4d3b:bdba with SMTP id 46e09a7af769-71dcf54911dmr5967010a34.20.1733698136592; Sun, 08 Dec 2024 14:48:56 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:48:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 08/17] target/hexagon: Use float32_muladd for helper_sffma Date: Sun, 8 Dec 2024 16:48:35 -0600 Message-ID: <20241208224844.570491-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x329.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 There are no special cases for this instruction. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- target/hexagon/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index b8b556f4c6..7d459cc6f3 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1166,7 +1166,7 @@ float32 HELPER(sffma)(CPUHexagonState *env, float32 RxV, float32 RsV, float32 RtV) { arch_fpop_start(env); - RxV = internal_fmafx(RsV, RtV, RxV, 0, &env->fp_status); + RxV = float32_muladd(RsV, RtV, RxV, 0, &env->fp_status); arch_fpop_end(env); return RxV; } From patchwork Sun Dec 8 22:48:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848282 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840084wrt; Sun, 8 Dec 2024 14:50:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXHHXnlTPwYV9qemxqzJW0k2ajCZO7y8Aikp6Dz4qQ2nlOj0j3G031BD7yZUJcxUAtFcwkayg==@linaro.org X-Google-Smtp-Source: AGHT+IG9M7v37tj9BanFRKA9R4EYTVIh0HkUKynP23dDirsU5ANLah+WmBZoFIZPulG9kClVkvtX X-Received: by 2002:ad4:5745:0:b0:6d8:8874:212a with SMTP id 6a1803df08f44-6d8e7129396mr174266096d6.17.1733698230634; Sun, 08 Dec 2024 14:50:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698230; cv=none; d=google.com; s=arc-20240605; b=RWvzdzTA4KTh6C//XrjgavT2GXRG4B9OV+VuyB8gLfjnx0kPaq03zrf08LVlMXhl40 pPLyYTu2/DvkxBdflR90FQF0wEroLiU1DmCX5UKAVm3npMWpHiad0qAy8WT5GpQPbgTu xUzMwwBQ0TkHT/JBT4uifV6SVYiBueKUpShE8vLEEABbWqkJRUe9V+rhM4d9TYD+d/k8 42O1iJNG+6FtZD5z0R/nWPj9HwTDgHHwjkYIfvDRXtyoQSxgouWva3PYXqNiXTpkB1a0 SS0B8DH8ifw7nMJJ1oCOUlccRTnmwo7He33pOUtNCzF0kgWsPA5JevMfCSSpqVI26lmN D42Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=9z7LwVl4Onw4FA8ZAnPozMScnx/mfNwPcZbWnSZkFg8=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=EWGCWrqRzOB1tsMV6cCp5gVy9ceiQGW6ROu1NzH7xyt3KuveVyJzmqdwzQu67Tb3PL tfi0QEbE1KkaXM9a72DKcdWYy2Z93KkbWA4Ve8pzkNCiuaeLIh4eBkB7xDB+E3oaNJK7 vAv/TN14SuOE1cHJvqc20UErI9/02jc+gyKyC0PQnEKbJYxEURcTPUjNWIX2U87J8M8V FK89zdrglmNP/ae5IyUQ5cy2jGNQnaQwPl6GXTlfvqEkEEsJXVopvFJ7iPX53jcnty3D E/HCVKx/xNgmXOnsetNzvYgWvPZt8qb3OoKSZziGgznoLvbeSr9b1wX9cnEOlwAg4nJc Abcg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SBrPCG5H; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6b5a46479si1026801685a.116.2024.12.08.14.50.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:50:30 -0800 (PST) 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=SBrPCG5H; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5G-0007Ao-GH; Sun, 08 Dec 2024 17:49:02 -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 1tKQ5E-00079k-9H for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:00 -0500 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5C-0006EW-Md for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:48:59 -0500 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3ea49150430so2052430b6e.1 for ; Sun, 08 Dec 2024 14:48:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698137; x=1734302937; 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=9z7LwVl4Onw4FA8ZAnPozMScnx/mfNwPcZbWnSZkFg8=; b=SBrPCG5HeCesc+hNKFz74NLZm2XuvZe067b+EyXcIHs1JJJVsKxrIdJs/tdlzc+t0E tWGx84VcZsbgBpuMewDTB9zwiS1dvZ3fDIZxlnFWrsSbNXxCdtQhx5ePSlT3K6EETjey oGB1DWuHmdIcQR+Ljm/EPA/0VUdmbdgxQo+0HGNGofiGg//6h4rIBwbQ+so+7eFfH7KX RE8nmxglpdU/W31rEuRUvNpjcYTU+2j8j0gt7B1Nqtt19XNTQwL0yJFTqwMzo0oj54/i yd0HMIvLR7b+fwZlLFli3ez8rlFlNTIUiCp2g5Edzm1558s3GlFSGEmnHtMMUZVSnG72 GSHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698137; x=1734302937; 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=9z7LwVl4Onw4FA8ZAnPozMScnx/mfNwPcZbWnSZkFg8=; b=i3u+fOqIyvhRHw+M27b4JAPT//9KMNToGbNDzESMhcD6E81BcS5A7UWo0ehngeD54Z ocMMxgMTk3A2GY33KTIeXuG85g+/zflDOOUE5VXMZ6SCGQmRlBH+aNSY7hZfN6Kv4HCa TfmfsRoOUE2ZuSFayA6lKeADtRK6LnpWF3xx6WvPxBpXqW0GpsHAuNVgV6OTQFPCi3Pa UJT0SoXQv3IEMDAh+Ar8UbqKcOV1VxSBBsZ5VEx+BA5sbmXunsaICkSUCq7LutJT+ljU UHWC5XSiW6k/pVwF7QGq5G1Bvyf6IWSeiDC6HkcPccGvQnnF/vXoemBflzLYw9kqpafb 4gSQ== X-Gm-Message-State: AOJu0YyVhQDIQP4Uqha8Yh3KZPvolrSg0XSwrAjXhUdQ3qCFgrnETpvR o5lyA3RCP5h1Vf3h9F+u4GKSexSs4eE1ZIYKEiup63RfikPXq70RSM42syRmKUFlFdBNfQBaC3S czyOCNA== X-Gm-Gg: ASbGncsAvUu7vcQHr9i2jQqPWVWttRL3O72Cji1Zv1L37aZ+XxT2NdFQS6cvkK8CVCH AqoYTZ2cplz8DaVxyZ5Fc3A6ClKjWfnOzlDEGJTQjcVAMw3ZMi2q5Z6Cfg4wBV56Jn2tKTr1FqQ VhdkHery6hDDIQkk+Fjx3FnAuIG1ZQhuq+KHh8VrH0Em/jv0uw1WBOtwU30F6FymMOHPXHDWOC9 QHJwu4sYQdQMqaYzeZSmgvs54lIWLKTNrI6tvAJ2y9Soe2CCxuBdSnwPk9zcu/WY2U6+CH/Wdze nJ8Kq4DboZr+bfCxvZElP0DvRDViGRA5SpeV X-Received: by 2002:a05:6808:251a:b0:3ea:4aad:a889 with SMTP id 5614622812f47-3eb19dd0645mr9668297b6e.26.1733698137650; Sun, 08 Dec 2024 14:48:57 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.48.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:48:57 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 09/17] target/hexagon: Use float32_muladd for helper_sffms Date: Sun, 8 Dec 2024 16:48:36 -0600 Message-ID: <20241208224844.570491-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::233; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x233.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 There are no special cases for this instruction. Since hexagon always uses default-nan mode, explicitly negating the first input is unnecessary. Use float_muladd_negate_product instead. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- target/hexagon/op_helper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 7d459cc6f3..aa5ab4a31f 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1208,10 +1208,9 @@ float32 HELPER(sffma_sc)(CPUHexagonState *env, float32 RxV, float32 HELPER(sffms)(CPUHexagonState *env, float32 RxV, float32 RsV, float32 RtV) { - float32 neg_RsV; arch_fpop_start(env); - neg_RsV = float32_set_sign(RsV, float32_is_neg(RsV) ? 0 : 1); - RxV = internal_fmafx(neg_RsV, RtV, RxV, 0, &env->fp_status); + RxV = float32_muladd(RsV, RtV, RxV, float_muladd_negate_product, + &env->fp_status); arch_fpop_end(env); return RxV; } From patchwork Sun Dec 8 22:48:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848293 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840317wrt; Sun, 8 Dec 2024 14:51:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVFk1A4Z7EX43jz4sQQb/I+Ra99Hd4lmNCXyYYguehU6NF0EXpZw+84IrxmIYSwxV1FhHXNtQ==@linaro.org X-Google-Smtp-Source: AGHT+IHWlw4jt6neZFKnvLCEZj8XDsr7tAw8EIrDH7l94zvNto2ddSeOCsFjoEnfd+LTmE1cSyhd X-Received: by 2002:a05:620a:4515:b0:7b6:6634:5a42 with SMTP id af79cd13be357-7b6bcad5083mr1505042785a.23.1733698286364; Sun, 08 Dec 2024 14:51:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698286; cv=none; d=google.com; s=arc-20240605; b=GJmYwedV7y97nRMeIRhGpoTukLFIlNl3a7onBknpbbpsxKSK+G8nBmGIzhbYpaC0eZ yrFM5dvHXuiA9eYgeVlSCk/D/UcMJ1K6jG9kFpjHle+nMR/GFZ7XxtG3UT42h9+TMT41 caSvc15Gzbhn20AssjA/eiDJ5YFc1wDfKvc6svrXnpJiFJGVpq1+Uh6ix51DLTKSoWXf jL4tTtr6SgblZcIyKMZf0KqQuAhPhs+7VZcbXB4xUImBAiwWchkBFqs8Kurh5dENu2qv De9o+QxhWnrq7ANmJNen1+yYBHpx9A6wPbt+CUG4BcmZjb5HK2B/cUF/10Gtb6Cxiuj5 tfdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=5xxQ+Dq7R8GnM1J7sgIMgZ9zk0m58GoMVFOUgAxTchA=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=Skx01nisVba8p/tqjBFkV9He5weGJbjLExLT6eA1WG6/aRLp4W+ZrluA3APiRqXjKI TTyXEj46+GJ9paBh54ZI3CkND5kxfA/RJxpR1YgGHZ5fsz0J/cedoevQjxgVHQ9f82KX 0vx1WNl724sd/YZm1cwDb9oIk8J3gnxm3eRHuzRtNTRbdpx6DgTD11TrnMgQt14KsOQ2 7dMksiiNemv0NLO3wBguroCVGJcdmVJ10Nbz4aQ8EX321FhrlUmPQOdH8JT4dV61MjC9 YSer8zQQbwZXKeaGvyXHvevPjjORH/uEhZcilVwhl/SAHqR3AaOFkw651PooB4Tarlzf Nn0w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r28TckVR; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d18517dfsi259205585a.633.2024.12.08.14.51.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:51:26 -0800 (PST) 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=r28TckVR; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5H-0007BM-Fp; Sun, 08 Dec 2024 17:49: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 1tKQ5F-0007AR-Fx for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:01 -0500 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5E-0006Eq-24 for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:01 -0500 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-71deed20e69so251201a34.2 for ; Sun, 08 Dec 2024 14:48:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698139; x=1734302939; 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=5xxQ+Dq7R8GnM1J7sgIMgZ9zk0m58GoMVFOUgAxTchA=; b=r28TckVR3dovnSqAfSZVj4OhWo5my+T/O3dIn38DjlSHMmPEvFnrMEfqoJ5iQguNwH X1Bt4ARqJPP5MQN91j2FcjC+iXUGtFrlaq0jfaWBkHX2u3E9lzh8SsQsITv4tPlKKLqJ 7z7mdu2TX7QoFVa5gVjqige6k3Cr993s+eFlP4p5qwLM4eTQ4xp4DDGBAWO2wGQXi0Q6 Np1bYdVg7/4ud73+o7KcGLiW8+NrrwwP3q6vrZuf/Gb23qP6szFgLhnwT4SZZX5qXW2W iXKvSKmPslpYTL6GAkzc2+aB8IDjdg58LmQ7h9CmDZKcT3oXJDO+ufpOfGsCeyr1uGLW m76g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698139; x=1734302939; 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=5xxQ+Dq7R8GnM1J7sgIMgZ9zk0m58GoMVFOUgAxTchA=; b=CvzOWqBmp4e074xgwi255IWgOzP2k+0P4Qybp3Fbsh5WcxWAkuSIr1I4GR2BwHjVJy 6XC4vMMX5FRbyX3ANUjc2wNxeZPGA3eFUXZ6qtfvqIrzsZN54Bse93txsI5FVMS+zjW4 hQ2/eAcxox9j+xZnQNPvJZ5juXCw9/zloi3+teSihex0lvAV0PTJ6qPZoXRBvk1/BBHa oMJGW0bDqQGpYXaahwnSyVOjgS8TouhDCAhWrqJDGSayNXcsI9t4/W/0nGXPFeo63/lQ ZRlrUcC0wENaBAnRjKpHPeiW1R0InbzkhoTgBrxp+svGPmBbBoNN4eZ6231xsiT7Cj5O WHyQ== X-Gm-Message-State: AOJu0YwpB42H4WxNchPhGLZdWwFdoGqTyNWgkLMvIfiFgFLLNaRXhBcU 6F+H9vrdVu+JfPkHsdoHwxkKVBzdlBnk4l7FF8h1Fl9lNzzf6CP73J2tffBO4wusvKGQI0hpprf 3V3Lvgw== X-Gm-Gg: ASbGncsZSjmegayJvRL5AuO88pN+HWaewgVArHT2LaQRpuUvQjJNbYxvB/oBvFmjeDk i+Jt8ur4wIc2R0uzoXziFfrMjvx0JYJ9D/eGqdRvdSj0LDTkKU5TJ4UfBb0HQoxLQi8/LWBYxU+ YBaF0IR/+jOrQNEsWoPq4I15dVAmdthFVddYlRI507yW2HpLFJvpE5FRlv4/Uk7jRnlkBggKv+n eDgvBzs6cBQgNieUgqh0pqzOvqpw8PiGZedITraYBA4Pc2c2i3BQLpwUimBBDiAoraFi9VJ2nko n5vI9qKYFv72tRRLGEn2bE/psXVqRf+IzxpN X-Received: by 2002:a05:6830:4114:b0:71d:548d:6f76 with SMTP id 46e09a7af769-71dcf54b629mr7206117a34.26.1733698138847; Sun, 08 Dec 2024 14:48:58 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.48.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:48:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 10/17] target/hexagon: Use float32_muladd_scalbn for helper_sffma_sc Date: Sun, 8 Dec 2024 16:48:37 -0600 Message-ID: <20241208224844.570491-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.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 This instruction has a special case that 0 * x + c returns c without the normal sign folding that comes with 0 + -0. Use the new float_muladd_suppress_add_product_zero to describe this. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- target/hexagon/op_helper.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index aa5ab4a31f..eb010422bf 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1192,15 +1192,10 @@ static float32 check_nan(float32 dst, float32 x, float_status *fp_status) float32 HELPER(sffma_sc)(CPUHexagonState *env, float32 RxV, float32 RsV, float32 RtV, float32 PuV) { - size4s_t tmp; arch_fpop_start(env); - RxV = check_nan(RxV, RxV, &env->fp_status); - RxV = check_nan(RxV, RsV, &env->fp_status); - RxV = check_nan(RxV, RtV, &env->fp_status); - tmp = internal_fmafx(RsV, RtV, RxV, fSXTN(8, 64, PuV), &env->fp_status); - if (!(float32_is_zero(RxV) && is_zero_prod(RsV, RtV))) { - RxV = tmp; - } + RxV = float32_muladd_scalbn(RsV, RtV, RxV, fSXTN(8, 64, PuV), + float_muladd_suppress_add_product_zero, + &env->fp_status); arch_fpop_end(env); return RxV; } From patchwork Sun Dec 8 22:48:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848295 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840405wrt; Sun, 8 Dec 2024 14:51:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUhEVqnsUXpYZXCeh54Bk2ha/4DsXgr1jzJ9P+SDQfm/k1v+F4cVfTqWKajhi3S5sSUFxbjIg==@linaro.org X-Google-Smtp-Source: AGHT+IE/RShd2dsvhwcsYSp6RmNNRqIl7rYmQ3ELeEgwAfNfBU/8hhUFXZgXmo5xo/m7U4Bo70Ia X-Received: by 2002:a05:620a:468d:b0:7b6:d8da:90a3 with SMTP id af79cd13be357-7b6d8da91e6mr23286085a.44.1733698307891; Sun, 08 Dec 2024 14:51:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698307; cv=none; d=google.com; s=arc-20240605; b=HwDCKpSCBpvpNoqsD6VRklNd3uiPonvxAsNqK52q6YROK3XKIPeCoR9DoPihO/xRmL TBm/CxUO2PkiQUrNJyvOwK766BGapeJ5QN60ARLIAjCcc8Vvqe3m2niK8PfK+2i6RVQP Z1EA5BB70q09cW42IWNSyqnkAez+QMSnWmlUcwDcreaSfXJNJWTr6pHeebM12k6SI0pb gWLDct9HsE7sz79y36lhaanaYv367JSJKIVr6G+EdQfB2GlVvkiyo9q+eY5MkPqhdLsq U35mj6V2RNCLgJi/sRzVeECySF7uYUDgsiVj3I9uZrMBakrsk5zZez8RAoiKO3tTuUUS OsTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=CGZ76CCO0E3ZRsJCJ0kN8XjjsbJn0MKiDssAdNgeYtw=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=A0A7GzRJ0ctqg6QDqpT5/DrW+0aHBlxzQ5wmZMmJaTtVyMmoPSLsY0rV+aknKRqtnz 5+ESFHkORs+kZCEQoR/QDOTR7ZGvEat5QXZV5iO9qLQMk9moOtwutrh7vo5U0CmsNdtF pCVqfDqQOD12gEjNoLUuM6NBjB4ad7x9ccljkAAELRPf80mbxBn0+vmEBlrbh0x0hrN9 R8NanNXxXBSp2RoIrdNgb7BnGkQnch3/+G4byFcdmeNWB6+yMN+g/cW/gV1Ovgu7XIxj eNt1QiPHuaio7iAztI4gcajmxYoRMdlkDkHYqDzF7hLy5oQn8nM9/JtYCAPgVere6hkI etWA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QUem7bu1; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6cc1efef3si380678885a.111.2024.12.08.14.51.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:51:47 -0800 (PST) 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=QUem7bu1; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5I-0007BZ-0G; Sun, 08 Dec 2024 17:49:04 -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 1tKQ5G-0007Aq-In for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:02 -0500 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5F-0006F8-08 for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:02 -0500 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-5f2b7a0387fso92037eaf.0 for ; Sun, 08 Dec 2024 14:49:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698140; x=1734302940; 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=CGZ76CCO0E3ZRsJCJ0kN8XjjsbJn0MKiDssAdNgeYtw=; b=QUem7bu1jQqlCFBWjU8pKNvLhKcMfqyny0qKtf5pJMmWyyLga3b10iwEoFjFYUgkiS eAoupC8dssd/KR/KikxpFuPobc9gwWi7O2cXstd3BmvgVNtOtiPLi/OM09063tzg1WAo su+BLhqrvxA3qwhM5knxmz9AaNvdUPCj/d6SvQhNsbhzdcuLidzcRtQd3+Eg4T5ocj2L H7byHFey2sC3ONSiW5XRfLHDzdwQf6H8scSl68PdnizG4hMREINGWP5l2uy5deCc+we6 JCrsANLLFvb6aZGCWLdDX7QxUolB/RA1Lkx+HQn3mV9kkf1xGZ8reFQqzNjjtugqwKVI hsOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698140; x=1734302940; 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=CGZ76CCO0E3ZRsJCJ0kN8XjjsbJn0MKiDssAdNgeYtw=; b=Vk6ARzqA1cUbfKUqTqmFqdM9D2pJ3+UCkzZz8xU/LhLuahEaXAUw/o75mGa0opuV+a QttLGuUimyiQ04rBqgOtzPHCaowAlkB2gSNGJTKcazuKi4XqOqscX8P6Y7jjUQ6YLjYb JJ5pXetv8iJwflb/xGo0Sg1s+eTDUazipmMB4ZgpGWJklOc2/SRax+BPzNzSlo6Ksil2 NduEL2zKFozoLvDPkFB8C1f2yOqE0ieMSTMI4O8GjFNk8xgpitPHtevqHJ6gxG7kZKsf aViUCGu7GPoY8RY1qGPsN6qnfMoqg35/L+nrX6gt+j9L6Kq5nRP5eSKH7MHLe270zgRi ctgQ== X-Gm-Message-State: AOJu0Ywf/DCi6+D0KoDxmoHzaPLMsv5zCSLsxd6YN67yZx9G6nLBFIR8 PyABCgzgeaub85cM0E9sNXPHFP3QyBFaxphdBLlO5YLo9J9rYkgKUDlUa9EzHBSnLwZrBw0o7qr Z9lz+oA== X-Gm-Gg: ASbGnct/0reVt1um4U/7AWcG0PX10BMHBrqOkytqpSFF1Djoq0+sivfE20U5sniG2rj kJrSFOY3aIDEdAfStY6jquYLk5as1rZDfpV7JQy+1YzazXqs6iw7KNNMzdGhUsKgqGyTEAPrlo1 oaGQohCoJIN968+z7syD+EFTcqIrvf2JB1xgyba9fC2eZwPa9od3rwZG/vKb7x4JZXMTuXFye6O NGRrpW3sCDHZW3W1Oj/nyxpr8dKtn/bvzaPfizKLbXBGWmqJN90kYhfX3dcxqXJdfdbi/ALYHKn RMqNJmbuY7lUuk1GjlYQfAXFCg/msarrp2om X-Received: by 2002:a05:6820:552:b0:5f2:a054:9e65 with SMTP id 006d021491bc7-5f2a0549e8amr2743782eaf.8.1733698139917; Sun, 08 Dec 2024 14:48:59 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:48:59 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 11/17] target/hexagon: Use float32_muladd for helper_sffm[as]_lib Date: Sun, 8 Dec 2024 16:48:38 -0600 Message-ID: <20241208224844.570491-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c30; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc30.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 There are multiple special cases for this instruction. (1) The saturate to normal maximum instead of overflow to infinity is handled by the new float_round_nearest_even_max rounding mode. (2) The 0 * n + c special case is handled by the new float_muladd_suppress_add_product_zero flag. (3) The Inf - Inf -> 0 special case can be detected after the fact by examining float_flag_invalid_isi. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- target/hexagon/op_helper.c | 105 +++++++++---------------------------- 1 file changed, 26 insertions(+), 79 deletions(-) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index eb010422bf..26e329f7b9 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1171,24 +1171,6 @@ float32 HELPER(sffma)(CPUHexagonState *env, float32 RxV, return RxV; } -static bool is_zero_prod(float32 a, float32 b) -{ - return ((float32_is_zero(a) && is_finite(b)) || - (float32_is_zero(b) && is_finite(a))); -} - -static float32 check_nan(float32 dst, float32 x, float_status *fp_status) -{ - float32 ret = dst; - if (float32_is_any_nan(x)) { - if (extract32(x, 22, 1) == 0) { - float_raise(float_flag_invalid, fp_status); - } - ret = make_float32(0xffffffff); /* nan */ - } - return ret; -} - float32 HELPER(sffma_sc)(CPUHexagonState *env, float32 RxV, float32 RsV, float32 RtV, float32 PuV) { @@ -1210,78 +1192,43 @@ float32 HELPER(sffms)(CPUHexagonState *env, float32 RxV, return RxV; } -static bool is_inf_prod(int32_t a, int32_t b) +static float32 do_sffma_lib(CPUHexagonState *env, float32 RxV, + float32 RsV, float32 RtV, int negate) { - return (float32_is_infinity(a) && float32_is_infinity(b)) || - (float32_is_infinity(a) && is_finite(b) && !float32_is_zero(b)) || - (float32_is_infinity(b) && is_finite(a) && !float32_is_zero(a)); + int flags; + + arch_fpop_start(env); + + set_float_rounding_mode(float_round_nearest_even_max, &env->fp_status); + RxV = float32_muladd(RsV, RtV, RxV, + negate | float_muladd_suppress_add_product_zero, + &env->fp_status); + + flags = get_float_exception_flags(&env->fp_status); + if (flags) { + /* Flags are suppressed by this instruction. */ + set_float_exception_flags(0, &env->fp_status); + + /* Return 0 for Inf - Inf. */ + if (flags & float_flag_invalid_isi) { + RxV = 0; + } + } + + arch_fpop_end(env); + return RxV; } float32 HELPER(sffma_lib)(CPUHexagonState *env, float32 RxV, float32 RsV, float32 RtV) { - bool infinp; - bool infminusinf; - float32 tmp; - - arch_fpop_start(env); - set_float_rounding_mode(float_round_nearest_even, &env->fp_status); - infminusinf = float32_is_infinity(RxV) && - is_inf_prod(RsV, RtV) && - (fGETBIT(31, RsV ^ RxV ^ RtV) != 0); - infinp = float32_is_infinity(RxV) || - float32_is_infinity(RtV) || - float32_is_infinity(RsV); - RxV = check_nan(RxV, RxV, &env->fp_status); - RxV = check_nan(RxV, RsV, &env->fp_status); - RxV = check_nan(RxV, RtV, &env->fp_status); - tmp = internal_fmafx(RsV, RtV, RxV, 0, &env->fp_status); - if (!(float32_is_zero(RxV) && is_zero_prod(RsV, RtV))) { - RxV = tmp; - } - set_float_exception_flags(0, &env->fp_status); - if (float32_is_infinity(RxV) && !infinp) { - RxV = RxV - 1; - } - if (infminusinf) { - RxV = 0; - } - arch_fpop_end(env); - return RxV; + return do_sffma_lib(env, RxV, RsV, RtV, 0); } float32 HELPER(sffms_lib)(CPUHexagonState *env, float32 RxV, float32 RsV, float32 RtV) { - bool infinp; - bool infminusinf; - float32 tmp; - - arch_fpop_start(env); - set_float_rounding_mode(float_round_nearest_even, &env->fp_status); - infminusinf = float32_is_infinity(RxV) && - is_inf_prod(RsV, RtV) && - (fGETBIT(31, RsV ^ RxV ^ RtV) == 0); - infinp = float32_is_infinity(RxV) || - float32_is_infinity(RtV) || - float32_is_infinity(RsV); - RxV = check_nan(RxV, RxV, &env->fp_status); - RxV = check_nan(RxV, RsV, &env->fp_status); - RxV = check_nan(RxV, RtV, &env->fp_status); - float32 minus_RsV = float32_sub(float32_zero, RsV, &env->fp_status); - tmp = internal_fmafx(minus_RsV, RtV, RxV, 0, &env->fp_status); - if (!(float32_is_zero(RxV) && is_zero_prod(RsV, RtV))) { - RxV = tmp; - } - set_float_exception_flags(0, &env->fp_status); - if (float32_is_infinity(RxV) && !infinp) { - RxV = RxV - 1; - } - if (infminusinf) { - RxV = 0; - } - arch_fpop_end(env); - return RxV; + return do_sffma_lib(env, RxV, RsV, RtV, float_muladd_negate_product); } float64 HELPER(dfmpyfix)(CPUHexagonState *env, float64 RssV, float64 RttV) From patchwork Sun Dec 8 22:48:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848290 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840216wrt; Sun, 8 Dec 2024 14:51:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU5sQbVUkwEnxM0l5RXBHOJ07CJ6UWVESfxGOrl52DSUS1z6HUQhRJAExsWS8qhFGHcfq6DRg==@linaro.org X-Google-Smtp-Source: AGHT+IGyQXc4ACJtCo9s0+/VL/XNSiZLV2ntSLxqEyumqVa+lr8pA867JUXSaCGmgdl0t1xt3CHW X-Received: by 2002:a05:6214:5086:b0:6d8:9002:bde2 with SMTP id 6a1803df08f44-6d8e71a8c8fmr185607506d6.28.1733698260516; Sun, 08 Dec 2024 14:51:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698260; cv=none; d=google.com; s=arc-20240605; b=fU1MBxYSxbDKhXd/v9620zMcEFmMDF/PdKoLQ8YWgicjYKYtbCYglOyRbboqWL+hdw LG2WlbzuPr6ZyPsTI3U5nZljIkWLZiJ24naiVu2SY6u5VdG92yU5/Afu2ArBYS9PDhlv rN/ks3UvrLNtN/tE6sS8AR0eGyUaszPZunO6vzgj2rlslleeKdpJlVS/dHEWx61QFlEe LhXTemczbh8zKbbj/GR7aiBniUWpi0ET6bJgoHPlQtlDFTfU4JMV3LP9hYGpz43k0tCZ qvkgV2OvILFeV329AukmdBmfbFpRK7tBi8JegR4/FuaBwnC+SASjVvOhl3tNSdnykOeO mYjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=OGOhDzFLCzjFgB27D8KK9B/lmY6KkRy+JNT0PTFURDw=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=Ic/5gt0b6jfKlDx1Jb2DXXZsSMwjueqV1Z/Vq+0lk8GODCuvCSGXE5pHORWEkcr/Vx UVfxL768Zh0AYo+gMybyjPvpEsfpZ92DWq1V2V5MQ7eUxrH+am3RmLiA5lwZUu/ksXrC a4XmPjpD1nH/k6S3zrUEMb+OtFNNJiLkF4TU+U6nu2KVuJYRmgZ/lzEQgRnTpJK+A99Y qClf5x4Gj4P4338XKhNXSvZjbpeU8K9Tr2gbo0XOY++8bw4o/XHaJNg+7EkAcsjS4QTb xSDWbtAdMBK5eupV9CnYGZILA9D+sYco9PiPxjrpXnfD6eOtAD2KpB9tihECsyCVF73V Bf6A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UkVUnHfV; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d909f36b11si24561606d6.231.2024.12.08.14.51.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:51:00 -0800 (PST) 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=UkVUnHfV; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5K-0007CE-2f; Sun, 08 Dec 2024 17:49:06 -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 1tKQ5I-0007Bf-6c for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:04 -0500 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5G-0006FP-CL for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:03 -0500 Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-71de02b24cfso556544a34.1 for ; Sun, 08 Dec 2024 14:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698141; x=1734302941; 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=OGOhDzFLCzjFgB27D8KK9B/lmY6KkRy+JNT0PTFURDw=; b=UkVUnHfVVWKXJjd1bfo3bnUhj5vW9bfVtalLF+RyqVCq2jQJcK9ZQSeNI3IGUixfQn lhxEw6SJtH08GrKvODrXxS+v1i7B2+RSQKfZgOJZ//0qxneRB8hH0bjFfPVAStokd8uc 0oT6A4GEHpOiIYjUpgUmgBXM+JZu4O7wiauAO4VE1HfgWR1nlYvHv0Z8tUVoGE9UZRWB D8A0hHhdTgCTlowELHDi7fSlzSTmDeEo39B7jE6zpkvttqUeTNrvjBTRIccxKdvdZTzb i5eKsVWMwsdfAQDphIzGjG+itJ87jsbu4LD32D6jlllIcgO2A5Mtv6dNgxQrgcd/CeGs Boww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698141; x=1734302941; 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=OGOhDzFLCzjFgB27D8KK9B/lmY6KkRy+JNT0PTFURDw=; b=uGRtNQtordz4XwJh0+SvqU9phZNrNnnX6g4M3Qz/SNORZaK5mIy+LC6LQ3TNjdaZxP MZ50eq3zd/qAcNzNYHoH8jh7sXH7Rjb1c/z/NPVnZqoVplf4i3AH3ts1QMP1B5zj5kUI buACKI/k3a1LvrdI5pbuWoT8hKw9D2U2vu0ytmRcfVTvQkCK2vg7T9NKpGc9qj4saEBS /rMLerhxKwOB0TJcAjmb4/PmKI7BHIsiMLzg7wkgXkz68A/WLMsB08Y7GfQNtUCaTCqF qczBGmPAyxsCRF9KjO12jS/d30l39BEu+AKibu9OFemoyh/6oJBoshw/6A1pNAoWTrM3 0HOg== X-Gm-Message-State: AOJu0YwUddmEIl+/HLD/DHEj+jEpck8lQ2Pm8rkOG5UCNQqT/LXTorKH xwjZP6p5Xyix1osZ1JLPdngORH53/DbkrDX5EJ+ilj7Appb7yblzSsWwQgbE6tVmIyMPTo813jF mcMJqdg== X-Gm-Gg: ASbGncvdopNxZ9aK4zfT/X8iFrN7/jr0HY3xRGcSyfLYJ3Um4SQjh+adIH8exu76vUH zfJvj48jKnhJQS68toFTyio5TEmnaMqF5fDm9BOCwRmBTAppxRIjK4RH8FVPZvTBqTqwB/amHYq nlFSaTAK+D9H3YJeAwH4RvOFsJBumwfAT8pQBVSVRZ4pzcSAY/QRRswLtsKwnKOmcugXvYb9F9k 4bsPZtkpICKvlfq5D3XfWBW0eIjX4HySdKzfNT58HM4BdsB7FsIhhJua76lYDDQ7yLd2fxBenk6 AixHiwhdSnj1I4AkRkru9+Fi7LQrNZ2ZDAwi X-Received: by 2002:a05:6830:16ce:b0:71d:eaa8:9971 with SMTP id 46e09a7af769-71deaa89f03mr1678504a34.8.1733698141365; Sun, 08 Dec 2024 14:49:01 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.49.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:49:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 12/17] target/hexagon: Remove internal_fmafx Date: Sun, 8 Dec 2024 16:48:39 -0600 Message-ID: <20241208224844.570491-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32d.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 The function is now unused. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- target/hexagon/fma_emu.h | 2 - target/hexagon/fma_emu.c | 171 --------------------------------------- 2 files changed, 173 deletions(-) diff --git a/target/hexagon/fma_emu.h b/target/hexagon/fma_emu.h index ad5df5d038..fed054b609 100644 --- a/target/hexagon/fma_emu.h +++ b/target/hexagon/fma_emu.h @@ -30,8 +30,6 @@ static inline uint32_t float32_getexp_raw(float32 f32) } int32_t float32_getexp(float32 f32); float32 infinite_float32(uint8_t sign); -float32 internal_fmafx(float32 a, float32 b, float32 c, - int scale, float_status *fp_status); float64 internal_mpyhh(float64 a, float64 b, unsigned long long int accumulated, float_status *fp_status); diff --git a/target/hexagon/fma_emu.c b/target/hexagon/fma_emu.c index 35971b8b99..0c7c7f636c 100644 --- a/target/hexagon/fma_emu.c +++ b/target/hexagon/fma_emu.c @@ -90,21 +90,6 @@ int32_t float64_getexp(float64 f64) return -1; } -static uint64_t float32_getmant(float32 f32) -{ - Float a = { .i = f32 }; - if (float32_is_normal(f32)) { - return a.mant | 1ULL << 23; - } - if (float32_is_zero(f32)) { - return 0; - } - if (float32_is_denormal(f32)) { - return a.mant; - } - return ~0ULL; -} - int32_t float32_getexp(float32 f32) { Float a = { .i = f32 }; @@ -369,25 +354,6 @@ float32 infinite_float32(uint8_t sign) } /* Return a maximum finite value with the requested sign */ -static float32 maxfinite_float32(uint8_t sign) -{ - if (sign) { - return make_float32(SF_MINUS_MAXF); - } else { - return make_float32(SF_MAXF); - } -} - -/* Return a zero value with requested sign */ -static float32 zero_float32(uint8_t sign) -{ - if (sign) { - return make_float32(0x80000000); - } else { - return float32_zero; - } -} - #define GEN_XF_ROUND(SUFFIX, MANTBITS, INF_EXP, INTERNAL_TYPE) \ static SUFFIX accum_round_##SUFFIX(Accum a, float_status * fp_status) \ { \ @@ -517,143 +483,6 @@ static SUFFIX accum_round_##SUFFIX(Accum a, float_status * fp_status) \ } GEN_XF_ROUND(float64, DF_MANTBITS, DF_INF_EXP, Double) -GEN_XF_ROUND(float32, SF_MANTBITS, SF_INF_EXP, Float) - -static bool is_inf_prod(float64 a, float64 b) -{ - return ((float64_is_infinity(a) && float64_is_infinity(b)) || - (float64_is_infinity(a) && is_finite(b) && (!float64_is_zero(b))) || - (float64_is_infinity(b) && is_finite(a) && (!float64_is_zero(a)))); -} - -static float64 special_fma(float64 a, float64 b, float64 c, - float_status *fp_status) -{ - float64 ret = make_float64(0); - - /* - * If A multiplied by B is an exact infinity and C is also an infinity - * but with the opposite sign, FMA returns NaN and raises invalid. - */ - uint8_t a_sign = float64_is_neg(a); - uint8_t b_sign = float64_is_neg(b); - uint8_t c_sign = float64_is_neg(c); - if (is_inf_prod(a, b) && float64_is_infinity(c)) { - if ((a_sign ^ b_sign) != c_sign) { - ret = make_float64(DF_NAN); - float_raise(float_flag_invalid, fp_status); - return ret; - } - } - if ((float64_is_infinity(a) && float64_is_zero(b)) || - (float64_is_zero(a) && float64_is_infinity(b))) { - ret = make_float64(DF_NAN); - float_raise(float_flag_invalid, fp_status); - return ret; - } - /* - * If none of the above checks are true and C is a NaN, - * a NaN shall be returned - * If A or B are NaN, a NAN shall be returned. - */ - if (float64_is_any_nan(a) || - float64_is_any_nan(b) || - float64_is_any_nan(c)) { - if (float64_is_any_nan(a) && (fGETBIT(51, a) == 0)) { - float_raise(float_flag_invalid, fp_status); - } - if (float64_is_any_nan(b) && (fGETBIT(51, b) == 0)) { - float_raise(float_flag_invalid, fp_status); - } - if (float64_is_any_nan(c) && (fGETBIT(51, c) == 0)) { - float_raise(float_flag_invalid, fp_status); - } - ret = make_float64(DF_NAN); - return ret; - } - /* - * We have checked for adding opposite-signed infinities. - * Other infinities return infinity with the correct sign - */ - if (float64_is_infinity(c)) { - ret = infinite_float64(c_sign); - return ret; - } - if (float64_is_infinity(a) || float64_is_infinity(b)) { - ret = infinite_float64(a_sign ^ b_sign); - return ret; - } - g_assert_not_reached(); -} - -static float32 special_fmaf(float32 a, float32 b, float32 c, - float_status *fp_status) -{ - float64 aa, bb, cc; - aa = float32_to_float64(a, fp_status); - bb = float32_to_float64(b, fp_status); - cc = float32_to_float64(c, fp_status); - return float64_to_float32(special_fma(aa, bb, cc, fp_status), fp_status); -} - -float32 internal_fmafx(float32 a, float32 b, float32 c, int scale, - float_status *fp_status) -{ - Accum prod; - Accum acc; - Accum result; - accum_init(&prod); - accum_init(&acc); - accum_init(&result); - - uint8_t a_sign = float32_is_neg(a); - uint8_t b_sign = float32_is_neg(b); - uint8_t c_sign = float32_is_neg(c); - if (float32_is_infinity(a) || - float32_is_infinity(b) || - float32_is_infinity(c)) { - return special_fmaf(a, b, c, fp_status); - } - if (float32_is_any_nan(a) || - float32_is_any_nan(b) || - float32_is_any_nan(c)) { - return special_fmaf(a, b, c, fp_status); - } - if ((scale == 0) && (float32_is_zero(a) || float32_is_zero(b))) { - float32 tmp = float32_mul(a, b, fp_status); - tmp = float32_add(tmp, c, fp_status); - return tmp; - } - - /* (a * 2**b) * (c * 2**d) == a*c * 2**(b+d) */ - prod.mant = int128_mul_6464(float32_getmant(a), float32_getmant(b)); - - /* - * Note: extracting the mantissa into an int is multiplying by - * 2**23, so adjust here - */ - prod.exp = float32_getexp(a) + float32_getexp(b) - SF_BIAS - 23; - prod.sign = a_sign ^ b_sign; - if (float32_is_zero(a) || float32_is_zero(b)) { - prod.exp = -2 * WAY_BIG_EXP; - } - if ((scale > 0) && float32_is_denormal(c)) { - acc.mant = int128_mul_6464(0, 0); - acc.exp = -WAY_BIG_EXP; - acc.sign = c_sign; - acc.sticky = 1; - result = accum_add(prod, acc); - } else if (!float32_is_zero(c)) { - acc.mant = int128_mul_6464(float32_getmant(c), 1); - acc.exp = float32_getexp(c); - acc.sign = c_sign; - result = accum_add(prod, acc); - } else { - result = prod; - } - result.exp += scale; - return accum_round_float32(result, fp_status); -} float64 internal_mpyhh(float64 a, float64 b, unsigned long long int accumulated, From patchwork Sun Dec 8 22:48:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848294 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840385wrt; Sun, 8 Dec 2024 14:51:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXXMyBpT4muxqPJ407848+a7WkMG+kiyM6b3iBXUUrxNORADLayRVGYkFK0RIFXEgYPXfiH1A==@linaro.org X-Google-Smtp-Source: AGHT+IF6pyVFiw40bB1L6D+Rss6OPwHjHic8nXBoq8DNZ0v82GiMHu6Pj2I77BjRcO2StI5hE3Xp X-Received: by 2002:a05:620a:2856:b0:7b6:cae1:a3cc with SMTP id af79cd13be357-7b6cae1a5admr1316003985a.19.1733698303197; Sun, 08 Dec 2024 14:51:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698303; cv=none; d=google.com; s=arc-20240605; b=lNmqxjmIfHagtWh26GsJnm3bZdQjiWgdShyKOjiPkLBXzBWCHUiMzjS1wNcItopozW 2P5i5ItIrXiadhPrVFw8KuaFdJO5VDdbuk7LUQKAcCZM/zmm84lS5YOGCiZFezk0+Qfh bxdqgcLVYkn6HbzLy8rK1fhJA9C9MYdvAK/Rt9/t+etGhNHOzvEZ3bN1NnlGjTQSEREn 5ieIyLMvKI8DAN0ngnIIV3Vcd8rc+KoqGz8VVOTyGt9L5xKAw5bHaBfInc9yvOkLiet+ e/CUX2o5EK5LtUtqK9GjhVuCHUC5GKyi90isgO9GnOwSOTmtvZqyAgpzLZLuV9mmP7Yw 6o1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=9Y0A1gv0BAn4m7bTh6rSrOLuj4Co5Ym2ALez6VlQLvI=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=bhcarT4Uikbx2iL6OmMJxm/qrCCUmrzICJsT5KDaUo9jUobdWyQWTPvL2MpPUYwE6Y xOkO8QPNm310bLr6GS8j4G+4oJSu7SxceiUjlSjIUjVnzRZ6M5W/rgCkqtS1K5sz+zqA MarpNPQjmDih8NlO8MPptFL6HNFV4l+5xK+PEjxW1JD9eJhlvrS+eCwiw3POKQ8xxBxO HRqG4Zn2nO6B06bpcyPAlIk8UBhsgEOXhkFEuh0tYZATe7b67Fz0TGF9+bkMxBBPkf3W NjsHqtPFmK1tkha9LMcLqDN7hvTGQ9HsR/vT40VPx4rt4p5ucFcJklo+gfYQJPoFT2Or HUJQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+R0P7fw; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d612c5bbsi115831785a.260.2024.12.08.14.51.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:51:43 -0800 (PST) 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=i+R0P7fw; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5L-0007Ch-LS; Sun, 08 Dec 2024 17:49:07 -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 1tKQ5J-0007C4-Kl for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:05 -0500 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5H-0006Ff-KV for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:05 -0500 Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-71de7b9d4f4so246415a34.2 for ; Sun, 08 Dec 2024 14:49:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698142; x=1734302942; 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=9Y0A1gv0BAn4m7bTh6rSrOLuj4Co5Ym2ALez6VlQLvI=; b=i+R0P7fwZfPHtkIn/zDQGhjrks9GVMg5sABNAQ5U3e2Ac2XkGzwNv4ncpIiMNuX7RY 5RtLlNflTHyINMdDBEM1zjUp9tjWYBBmLNUE5KJFz8DdTczHIdIDd0J0Xhh4qp+89K7U XoOwWPLgMDRH32ThwdHMBPtrDbFY8N0nqwbNB1N+dBL67U+Fo3d3bO9PWdjuFSMVWmqR 7iFoU3nw7/A8g3u9rUYYMYp5uOOMk/M4SsAjckNirKSuRult4MNmppfff9osUKKjJ6TU 5Yc6SfwgCYmLE5MTiDfJumSsKLN9DsLhfR5A+mUGibJuk2Xgm7s9XLQUQ3aDpHRB9buK U8Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698142; x=1734302942; 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=9Y0A1gv0BAn4m7bTh6rSrOLuj4Co5Ym2ALez6VlQLvI=; b=xH8dRsy+ve7oxCM/p6OqnVtKSruByONjyBEZ47T1uX7nl+vxZkYtlR+qqypatxRtlK q9DWsyNTZA6+D4VOvBubLwaZu3qhAnu0aQY9jVTW2lCughjYP66aWKE1yApO/8tngpZL c5kLWoSvQc4Z6cYw1mc/Isl7F90PK5hFTH8isCf9rSl/k5aBMr/3E/Hk3HCINpCXGv57 axk4YefC+a8IFQNeBWTmDC6VLAatByo/tJXZOs2cn6H5v5r9z235xurXgt1zTxiG11lN +c4vfP9YudixO3xOOqy6LKtUeuvO378IsLzAAMo+vjmdrQrQuSWTjbDo8oh7R1XoFF8T AmWA== X-Gm-Message-State: AOJu0Yzo/ZMCClz1D6wH1t9jVpQLp/eCedsSRvV7D33RNJXKIf7nIjM7 CNypVoric82BhnT1kEMG+eTMqOhrcScCHiasgOnY3j7LG5g5DX5nYM9+kOJyGNtTO45fIbHwZ1o E6kBbYg== X-Gm-Gg: ASbGncvhK/sk0qvz6tNYPPlu6fbA/TgPtv/XQao8phdbL7wRV8zxKe9Vj9ZLMl/tNQI 88dpmRUxOrtEZ3c8nsCIUYIM+pstiRiNELbJsA6YFYFmT1Vf/OdZY9Iyh1rl6hFVbnGo4bp+s5x 0A5080uf0k4uoKfjoAzSYV+kQ7SpilpCOJvbqxstXOsCTeqJ+QWxTRbI3pUSe4hrhyj/o7asPEh +X7LUtiuJDymC0OZbX71gfw36Y1qGm/X20EElTouF2EfXLZijGum3FcDV17AsHHAEdc062ucSNH vxzWWtnvFkcLHFFyY71sxzMQC4MHJYPN0qDx X-Received: by 2002:a05:6808:3012:b0:3e8:1ed7:e6cf with SMTP id 5614622812f47-3eb19c004aamr5545414b6e.7.1733698142464; Sun, 08 Dec 2024 14:49:02 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.49.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:49:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 13/17] target/hexagon: Expand GEN_XF_ROUND Date: Sun, 8 Dec 2024 16:48:40 -0600 Message-ID: <20241208224844.570491-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32c.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 This massive macro is now only used once. Expand it for use only by float64. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- target/hexagon/fma_emu.c | 253 +++++++++++++++++++-------------------- 1 file changed, 125 insertions(+), 128 deletions(-) diff --git a/target/hexagon/fma_emu.c b/target/hexagon/fma_emu.c index 0c7c7f636c..bce3bd4dfb 100644 --- a/target/hexagon/fma_emu.c +++ b/target/hexagon/fma_emu.c @@ -354,136 +354,133 @@ float32 infinite_float32(uint8_t sign) } /* Return a maximum finite value with the requested sign */ -#define GEN_XF_ROUND(SUFFIX, MANTBITS, INF_EXP, INTERNAL_TYPE) \ -static SUFFIX accum_round_##SUFFIX(Accum a, float_status * fp_status) \ -{ \ - if ((int128_gethi(a.mant) == 0) && (int128_getlo(a.mant) == 0) \ - && ((a.guard | a.round | a.sticky) == 0)) { \ - /* result zero */ \ - switch (fp_status->float_rounding_mode) { \ - case float_round_down: \ - return zero_##SUFFIX(1); \ - default: \ - return zero_##SUFFIX(0); \ - } \ - } \ - /* Normalize right */ \ - /* We want MANTBITS bits of mantissa plus the leading one. */ \ - /* That means that we want MANTBITS+1 bits, or 0x000000000000FF_FFFF */ \ - /* So we need to normalize right while the high word is non-zero and \ - * while the low word is nonzero when masked with 0xffe0_0000_0000_0000 */ \ - while ((int128_gethi(a.mant) != 0) || \ - ((int128_getlo(a.mant) >> (MANTBITS + 1)) != 0)) { \ - a = accum_norm_right(a, 1); \ - } \ - /* \ - * OK, now normalize left \ - * We want to normalize left until we have a leading one in bit 24 \ - * Theoretically, we only need to shift a maximum of one to the left if we \ - * shifted out lots of bits from B, or if we had no shift / 1 shift sticky \ - * should be 0 \ - */ \ - while ((int128_getlo(a.mant) & (1ULL << MANTBITS)) == 0) { \ - a = accum_norm_left(a); \ - } \ - /* \ - * OK, now we might need to denormalize because of potential underflow. \ - * We need to do this before rounding, and rounding might make us normal \ - * again \ - */ \ - while (a.exp <= 0) { \ - a = accum_norm_right(a, 1 - a.exp); \ - /* \ - * Do we have underflow? \ - * That's when we get an inexact answer because we ran out of bits \ - * in a denormal. \ - */ \ - if (a.guard || a.round || a.sticky) { \ - float_raise(float_flag_underflow, fp_status); \ - } \ - } \ - /* OK, we're relatively canonical... now we need to round */ \ - if (a.guard || a.round || a.sticky) { \ - float_raise(float_flag_inexact, fp_status); \ - switch (fp_status->float_rounding_mode) { \ - case float_round_to_zero: \ - /* Chop and we're done */ \ - break; \ - case float_round_up: \ - if (a.sign == 0) { \ - a.mant = int128_add(a.mant, int128_one()); \ - } \ - break; \ - case float_round_down: \ - if (a.sign != 0) { \ - a.mant = int128_add(a.mant, int128_one()); \ - } \ - break; \ - default: \ - if (a.round || a.sticky) { \ - /* round up if guard is 1, down if guard is zero */ \ - a.mant = int128_add(a.mant, int128_make64(a.guard)); \ - } else if (a.guard) { \ - /* exactly .5, round up if odd */ \ - a.mant = int128_add(a.mant, int128_and(a.mant, int128_one())); \ - } \ - break; \ - } \ - } \ - /* \ - * OK, now we might have carried all the way up. \ - * So we might need to shr once \ - * at least we know that the lsb should be zero if we rounded and \ - * got a carry out... \ - */ \ - if ((int128_getlo(a.mant) >> (MANTBITS + 1)) != 0) { \ - a = accum_norm_right(a, 1); \ - } \ - /* Overflow? */ \ - if (a.exp >= INF_EXP) { \ - /* Yep, inf result */ \ - float_raise(float_flag_overflow, fp_status); \ - float_raise(float_flag_inexact, fp_status); \ - switch (fp_status->float_rounding_mode) { \ - case float_round_to_zero: \ - return maxfinite_##SUFFIX(a.sign); \ - case float_round_up: \ - if (a.sign == 0) { \ - return infinite_##SUFFIX(a.sign); \ - } else { \ - return maxfinite_##SUFFIX(a.sign); \ - } \ - case float_round_down: \ - if (a.sign != 0) { \ - return infinite_##SUFFIX(a.sign); \ - } else { \ - return maxfinite_##SUFFIX(a.sign); \ - } \ - default: \ - return infinite_##SUFFIX(a.sign); \ - } \ - } \ - /* Underflow? */ \ - if (int128_getlo(a.mant) & (1ULL << MANTBITS)) { \ - /* Leading one means: No, we're normal. So, we should be done... */ \ - INTERNAL_TYPE ret; \ - ret.i = 0; \ - ret.sign = a.sign; \ - ret.exp = a.exp; \ - ret.mant = int128_getlo(a.mant); \ - return ret.i; \ - } \ - assert(a.exp == 1); \ - INTERNAL_TYPE ret; \ - ret.i = 0; \ - ret.sign = a.sign; \ - ret.exp = 0; \ - ret.mant = int128_getlo(a.mant); \ - return ret.i; \ +static float64 accum_round_float64(Accum a, float_status * fp_status) +{ + if ((int128_gethi(a.mant) == 0) && (int128_getlo(a.mant) == 0) + && ((a.guard | a.round | a.sticky) == 0)) { + /* result zero */ + switch (fp_status->float_rounding_mode) { + case float_round_down: + return zero_float64(1); + default: + return zero_float64(0); + } + } + /* Normalize right */ + /* We want DF_MANTBITS bits of mantissa plus the leading one. */ + /* That means that we want DF_MANTBITS+1 bits, or 0x000000000000FF_FFFF */ + /* So we need to normalize right while the high word is non-zero and + * while the low word is nonzero when masked with 0xffe0_0000_0000_0000 */ + while ((int128_gethi(a.mant) != 0) || + ((int128_getlo(a.mant) >> (DF_MANTBITS + 1)) != 0)) { + a = accum_norm_right(a, 1); + } + /* + * OK, now normalize left + * We want to normalize left until we have a leading one in bit 24 + * Theoretically, we only need to shift a maximum of one to the left if we + * shifted out lots of bits from B, or if we had no shift / 1 shift sticky + * should be 0 + */ + while ((int128_getlo(a.mant) & (1ULL << DF_MANTBITS)) == 0) { + a = accum_norm_left(a); + } + /* + * OK, now we might need to denormalize because of potential underflow. + * We need to do this before rounding, and rounding might make us normal + * again + */ + while (a.exp <= 0) { + a = accum_norm_right(a, 1 - a.exp); + /* + * Do we have underflow? + * That's when we get an inexact answer because we ran out of bits + * in a denormal. + */ + if (a.guard || a.round || a.sticky) { + float_raise(float_flag_underflow, fp_status); + } + } + /* OK, we're relatively canonical... now we need to round */ + if (a.guard || a.round || a.sticky) { + float_raise(float_flag_inexact, fp_status); + switch (fp_status->float_rounding_mode) { + case float_round_to_zero: + /* Chop and we're done */ + break; + case float_round_up: + if (a.sign == 0) { + a.mant = int128_add(a.mant, int128_one()); + } + break; + case float_round_down: + if (a.sign != 0) { + a.mant = int128_add(a.mant, int128_one()); + } + break; + default: + if (a.round || a.sticky) { + /* round up if guard is 1, down if guard is zero */ + a.mant = int128_add(a.mant, int128_make64(a.guard)); + } else if (a.guard) { + /* exactly .5, round up if odd */ + a.mant = int128_add(a.mant, int128_and(a.mant, int128_one())); + } + break; + } + } + /* + * OK, now we might have carried all the way up. + * So we might need to shr once + * at least we know that the lsb should be zero if we rounded and + * got a carry out... + */ + if ((int128_getlo(a.mant) >> (DF_MANTBITS + 1)) != 0) { + a = accum_norm_right(a, 1); + } + /* Overflow? */ + if (a.exp >= DF_INF_EXP) { + /* Yep, inf result */ + float_raise(float_flag_overflow, fp_status); + float_raise(float_flag_inexact, fp_status); + switch (fp_status->float_rounding_mode) { + case float_round_to_zero: + return maxfinite_float64(a.sign); + case float_round_up: + if (a.sign == 0) { + return infinite_float64(a.sign); + } else { + return maxfinite_float64(a.sign); + } + case float_round_down: + if (a.sign != 0) { + return infinite_float64(a.sign); + } else { + return maxfinite_float64(a.sign); + } + default: + return infinite_float64(a.sign); + } + } + /* Underflow? */ + if (int128_getlo(a.mant) & (1ULL << DF_MANTBITS)) { + /* Leading one means: No, we're normal. So, we should be done... */ + Double ret; + ret.i = 0; + ret.sign = a.sign; + ret.exp = a.exp; + ret.mant = int128_getlo(a.mant); + return ret.i; + } + assert(a.exp == 1); + Double ret; + ret.i = 0; + ret.sign = a.sign; + ret.exp = 0; + ret.mant = int128_getlo(a.mant); + return ret.i; } -GEN_XF_ROUND(float64, DF_MANTBITS, DF_INF_EXP, Double) - float64 internal_mpyhh(float64 a, float64 b, unsigned long long int accumulated, float_status *fp_status) From patchwork Sun Dec 8 22:48:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848280 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840001wrt; Sun, 8 Dec 2024 14:50:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUCxp1M4caf9uBfRDw29sWxI5pHRR57EI9tyemnzzmLYOMHlz/niZL/WdBHZR16bCLa18LpYg==@linaro.org X-Google-Smtp-Source: AGHT+IF/yDfS/wDmU1a8kLySXShGUgFMCIyrszLe7oTm2a4ru49UV3hSz4aS+7qnDo1eQGI/FBuh X-Received: by 2002:a05:622a:254:b0:466:85eb:6123 with SMTP id d75a77b69052e-46734cf3020mr160390181cf.22.1733698210339; Sun, 08 Dec 2024 14:50:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698210; cv=none; d=google.com; s=arc-20240605; b=TopB5s9aboK54L0kZoe9EGWo6ItcqqhrCWzLhUVnaADgdzXZ7Nvwwvw6trXrQTL69i hjld3RvSc4hiwbtnTBeYhBO2vMkwYQ1m5z9PgOI7GpIYMpKOSqulkQ/X9PNGpX9lr3/y JeSx1etTibyJGKxg5Kj7IHUUry4YuW8fmute+XgFAznEM5vOaeBO/VcEGO+rYDjJZiIq gOnTwrWx8t+LRQT8CGRKiKWYzGi1LItzA1eSJ3vkVCxYKZE4hWXS3vwTMKcSk42bcgtb oG5xvoJLPmm8Tclmw5nu6JwWfPwTrkqI7PIph8zy+mg6k6SMPB3A/eZ6kwB8W9CQJTsd eSag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=l91xWhho4J5dS14PUrzWIvB5MRYtKAuibtsdCvv9Iy0=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=gDPl6EoeyTb0/1iPBCWcaduH6AQ8tQhYLBHQgYWTVt5Fh9HTZq50cOnhUqUPmmjI91 X7sYpZuGYF8lZ/iriMPR00uiT8D5zjstghTRUjqVexAZFoI3JABhLR9HN1CZUqnk/rpV ftWYu7Jr0xHmjilDyWhK7wTPRcVKV1ZDu9N6xhNE1KPnv5cl+ZOf/WDxxt6jHf5oBkbp R6kE5BJncv4+Es4pheIQ2YphA6ENr33ZZUiWKue6KTUd1EIHoIPbT2pPuy96bMQCEu07 fHdIrXCvMeuV1Zvw1WsdLwR0jtGTjqFrAGnR77HvJk/kJvS5ff3n5G8d+Ee+OhfJVOav gawA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZsXhEviF; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-467297fc5e5si99573981cf.381.2024.12.08.14.50.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:50:10 -0800 (PST) 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=ZsXhEviF; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5R-0007DM-5k; Sun, 08 Dec 2024 17:49:14 -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 1tKQ5K-0007CX-MA for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:06 -0500 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5I-0006Fv-QF for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:06 -0500 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-71d40003870so1003039a34.0 for ; Sun, 08 Dec 2024 14:49:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698144; x=1734302944; 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=l91xWhho4J5dS14PUrzWIvB5MRYtKAuibtsdCvv9Iy0=; b=ZsXhEviFBXLSqWxruIYSJ5SfPWVzfrpw+4ehagkuGgDTYxgrXzNDmveimRfu5Vx62l HpdoqbKF5+PFsXix4r1Xc5QHHL7PdEMvv3GIGatsvdKpTQGQx3XKjZUHQe84hN8sg9iv uHUUN7KQsARkl+vKYAEUMcW6N2GhT8oEDMS6cEMec+5l/wdlVYQkelSF7mrm5dTu81lu vII+z7uESLjtm0dynWV8ZdGG86EpN2LCNJBGCHud9OR8sGeLu939Q6SCSQjv50e0XY/q TYnSo83WnSpb0l3LmMZDW7uojlcyHZpblGNAdAPbxeTVX1MsHr5e7yvRDwmqPCFGz6Yo gajQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698144; x=1734302944; 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=l91xWhho4J5dS14PUrzWIvB5MRYtKAuibtsdCvv9Iy0=; b=dsvXrlfsMeYfCXi7ahel59eb3UiVfnh68fv3uUaTr06zWvWE6hbkcV8WTlIO9o7gJ7 eNS1hfXVdsXWgaZ50zZXN+q6noqMho8G7J7Hlbpb9KCL96jB4b/o+YzyuSmnzYBQdnF4 cDSl0yvp1ZwbbcILpqdw0x19fYsR4w7iAwP4qhMRa7wuZtHfduNE8xVbfjS9/YKdUbGS Jmg97s4Vfdk9YBSBt9fxDycLJEoXbgbVizXJ0CxAjF4iTUKrKJhE8yZ/NF872eLr0sdU ZnReff8Pw4PwP1av2EMy3pS54rXSZd+Mq/4CKdPh7OD8E+w5K5JhQzF/Seglbi45hdwk 4vPA== X-Gm-Message-State: AOJu0YyFTuJRnoX2wx/xdAAoZS1Ohuthnq9DUOj9HNnWbGrvUyQ15pKt A2YFptUguc+W/+xpsrzhenweIg8Wo1gKPQosvnWXbgWO6inmIa7fq2NfKU6j8E5HWkKA1zKZrF9 fkAl2NQ== X-Gm-Gg: ASbGnctr8M+DG6eKecUM/3HQNKfW1sxwODVTW50Ak6yBRij98Db8EhPkughPpLTqZa4 oCeNOuCNA4DS6JPlPjPe7kIG/52hxOhupPcCGxhKmedSP5r2CHT8armU/T9wMkd7/BDm+0K1FiA UYKhnk7UyL/wyAgZjyNc22YwLppbAQFQYwJhhvSTjhzYaz9Tbcn5/gXPLR4Dtjb6OyqlpjDkTnm 9t/wq4Ufm3yhCSgSJ6Zq/oEzWqCDDK051+EPRH0T0yPEOs6YLlHCu6IKa2pW7AG2CxlgwVI/b6q xT3D16ahWgTlKyUqDp+TIEIQIKchejsUMEbx X-Received: by 2002:a05:6830:1504:b0:71d:eee3:fd24 with SMTP id 46e09a7af769-71deee3fe4dmr1530980a34.0.1733698143780; Sun, 08 Dec 2024 14:49:03 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.49.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:49:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 14/17] target/hexagon: Remove Float Date: Sun, 8 Dec 2024 16:48:41 -0600 Message-ID: <20241208224844.570491-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.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 This structure, with bitfields, is incorrect for big-endian. Use the existing float32_getexp_raw which uses extract32. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- target/hexagon/fma_emu.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/target/hexagon/fma_emu.c b/target/hexagon/fma_emu.c index bce3bd4dfb..c359eecffd 100644 --- a/target/hexagon/fma_emu.c +++ b/target/hexagon/fma_emu.c @@ -53,16 +53,6 @@ typedef union { }; } Double; -typedef union { - float f; - uint32_t i; - struct { - uint32_t mant:23; - uint32_t exp:8; - uint32_t sign:1; - }; -} Float; - static uint64_t float64_getmant(float64 f64) { Double a = { .i = f64 }; @@ -92,12 +82,12 @@ int32_t float64_getexp(float64 f64) int32_t float32_getexp(float32 f32) { - Float a = { .i = f32 }; + int exp = float32_getexp_raw(f32); if (float32_is_normal(f32)) { - return a.exp; + return exp; } if (float32_is_denormal(f32)) { - return a.exp + 1; + return exp + 1; } return -1; } From patchwork Sun Dec 8 22:48:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848285 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840110wrt; Sun, 8 Dec 2024 14:50:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXsyo5H+xIlpXWOh4Lj2jhairYkN8SRXgWzAnEyVijdhVY4vFmBcULPbWDl+4sGFDT0zcdz3g==@linaro.org X-Google-Smtp-Source: AGHT+IHB8pE8Hdw3EGDDuaPFiSIpomdshPtcU2L7d9p+SC4eTlW31JmpRSBvSfo+EafL8ivG33gt X-Received: by 2002:ad4:5967:0:b0:6d8:aa14:f5b8 with SMTP id 6a1803df08f44-6d8e73e901bmr182633546d6.40.1733698235211; Sun, 08 Dec 2024 14:50:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698235; cv=none; d=google.com; s=arc-20240605; b=k4+6mPT1R/+B2r5mU4AqPzGiQTsoANJbYq7XwGM8+eeUr3HMIom063SC36NTe9yBYk mVe2+IvT+Q+tBLddrbhqds0D8Ji97PUKQRswmPeOQylfG41v+sVAf/zE+SFyhzMuCc6d 0R0UZA7OgLc+AWmeMkJ8FyHdiwWVlc3+QV328ZW2u34+V42qHLFzQ6zduSxjNkSwLfKW 5SOIVa+DP7FuAla3KqS2nruzLWNWr4NhH+G6/mPlhj6VoUY1yoKilSfLNEZJwYySUGhD MXLBEtyLEQkXOsdwYZMP/7HS0xhx5hBSA83C8rJ3rbEKnV8SifuzAYjZiMCkT0D+Dm4D URdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=Z5ajRnZi43a4zINRic96225Rmi62CthD3E3UTNaO55s=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=XrzZ8UJHMwwvypBRfhfytlWdQNSq8Fay0w2yPp7Tmi+1skFZsn1K1s5939uMTGoOcY Lb0eJMoVmX3IultaNFUtRHUKb5JBEOC9fKhYCFks2mmDDhEvUFPg3EuUGKJnnHpKqC4h ctGqC6LhXD9BAe21lybCM8mjXUQEY/01F6F7C8Y/WIkrviUUqN+Ek8tk2FUplRGXm6WJ tLDhAr5MJYkb/eRHbfIuZq4y75QIewc35znJ/qnt+nmi+PkCnh2Un60BvMeKVM+9zEY0 hnoDMJBE8RzaQ0S/5n84c9PkXaqUSZ34krx828EpZ4dGnsO42UOSk9NP4/BGvHCjOBLY azSQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A7DGoGTM; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d2769293si220318285a.532.2024.12.08.14.50.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:50:35 -0800 (PST) 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=A7DGoGTM; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5S-0007Dp-Sx; Sun, 08 Dec 2024 17:49:15 -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 1tKQ5L-0007Cg-Iv for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:07 -0500 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5K-0006GC-3y for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:07 -0500 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-5f22ea6d874so1790145eaf.1 for ; Sun, 08 Dec 2024 14:49:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698145; x=1734302945; 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=Z5ajRnZi43a4zINRic96225Rmi62CthD3E3UTNaO55s=; b=A7DGoGTM7nxRAvX7/wWBYYpf+TJIfiqGu8GyVJQFM8DBuvCNrp3o4h2OexyUWRnjMm el1c3pdztSzIaLyVWJr9wbfg7Ax58Hcjgd8od1M8TuBPPc0F6isq52RHjMVsN+YYkh0t 1kff6Q2cCkmAoeN7dtwdwcybkkFGWb6EOkCY8Hzu13hgkjMB68LcVPnljoXADaRdkQyD 5o7JCefMctNbRP73ihcXDmAz1zjH3xtmElnY/fI1Jf2icA58eg9pQyeXakBhLcrao4rV DBBjlNKsD5Iz3+Ta+c5D8lAe8TGZ4m8TRkh0WCR9S/DJGOxuHjHwgZRUgLalj2XYhd9O XIGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698145; x=1734302945; 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=Z5ajRnZi43a4zINRic96225Rmi62CthD3E3UTNaO55s=; b=ftFwynFszha9UrXy6c3EbFaSgtuHmzMqZDuUEqXdeXh1CFCbdQW81yUOA57OeJpiXl UqCcynuW5b0fLyfALFMPgrpks//BwvXj7EorTkJJgJcvxAzp0hkqToIngBYJ6MRVM0mw XCGaLhjp+Mu8Uwsb6u/pcT5qDsDNn3nXma2sV2oevri+msOdvqi3q3n0/Z1blr9Jla2d gqqHpQIzhDi0UA71BOCY2RmgiPcDQuCJ2tEYJ630wnoYqpEjs+2dBjRGCSQGOsWjZtvF oSUur87X7gRJNYE+W/fYv7GAYiU6vU8XTHFzEYSiZ44PasCD42+jKDKRM0/QU2bwmKkR KDPA== X-Gm-Message-State: AOJu0YwLcnUbYfrTh97r11c/0GWEqZQbz8tTytqDO+CP+yqflAk6egrc oHwk0mDHjM5SjGv3lwZe5DvcOopCl1NuoGXvAieFbaG34R43Rw8zm25LTjw+8NcrORqxlU0sWlW sK8gfOA== X-Gm-Gg: ASbGncuiZDjukfoi52HzZMrunE/fHuBa6nezgDNcng3IGV1rlNcUnz/zP7Hhroh8gXj aPAAFqWPoN8QwMFDvM35Pach+pqPOAylqxqyrdO2oqcnEkomofNFYAVgXFt5y/+SNj8FTBpA8ke ktAfxn0kyfDfu8wdFV8E1gjnhFS5EW6z7hmFuvs0yKMfZxkITVMLuvP5mqRRwOiSM6VDoi8M7Ru k5EGjyzncoitlEuj/KxX8I6wRRwTugG/zTcv6uvqWp3xTukXMOLa64arCyzm4LvpOp8/aA9QWsT ePbRhEI97nXY/R/JlnEhKN3gUv5NQoUpZzRd X-Received: by 2002:a05:6820:1998:b0:5f2:af90:e90 with SMTP id 006d021491bc7-5f2af901244mr2595035eaf.3.1733698145043; Sun, 08 Dec 2024 14:49:05 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:49:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 15/17] target/hexagon: Remove Double Date: Sun, 8 Dec 2024 16:48:42 -0600 Message-ID: <20241208224844.570491-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2f; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2f.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 This structure, with bitfields, is incorrect for big-endian. Use extract64 and deposit64 instead. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- target/hexagon/fma_emu.c | 46 ++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/target/hexagon/fma_emu.c b/target/hexagon/fma_emu.c index c359eecffd..343c40a686 100644 --- a/target/hexagon/fma_emu.c +++ b/target/hexagon/fma_emu.c @@ -43,39 +43,29 @@ #define WAY_BIG_EXP 4096 -typedef union { - double f; - uint64_t i; - struct { - uint64_t mant:52; - uint64_t exp:11; - uint64_t sign:1; - }; -} Double; - static uint64_t float64_getmant(float64 f64) { - Double a = { .i = f64 }; + uint64_t mant = extract64(f64, 0, 52); if (float64_is_normal(f64)) { - return a.mant | 1ULL << 52; + return mant | 1ULL << 52; } if (float64_is_zero(f64)) { return 0; } if (float64_is_denormal(f64)) { - return a.mant; + return mant; } return ~0ULL; } int32_t float64_getexp(float64 f64) { - Double a = { .i = f64 }; + int exp = extract64(f64, 52, 11); if (float64_is_normal(f64)) { - return a.exp; + return exp; } if (float64_is_denormal(f64)) { - return a.exp + 1; + return exp + 1; } return -1; } @@ -346,6 +336,8 @@ float32 infinite_float32(uint8_t sign) /* Return a maximum finite value with the requested sign */ static float64 accum_round_float64(Accum a, float_status * fp_status) { + uint64_t ret; + if ((int128_gethi(a.mant) == 0) && (int128_getlo(a.mant) == 0) && ((a.guard | a.round | a.sticky) == 0)) { /* result zero */ @@ -453,22 +445,16 @@ static float64 accum_round_float64(Accum a, float_status * fp_status) } } /* Underflow? */ - if (int128_getlo(a.mant) & (1ULL << DF_MANTBITS)) { + ret = int128_getlo(a.mant); + if (ret & (1ULL << DF_MANTBITS)) { /* Leading one means: No, we're normal. So, we should be done... */ - Double ret; - ret.i = 0; - ret.sign = a.sign; - ret.exp = a.exp; - ret.mant = int128_getlo(a.mant); - return ret.i; + ret = deposit64(ret, 52, 11, a.exp); + } else { + assert(a.exp == 1); + ret = deposit64(ret, 52, 11, 0); } - assert(a.exp == 1); - Double ret; - ret.i = 0; - ret.sign = a.sign; - ret.exp = 0; - ret.mant = int128_getlo(a.mant); - return ret.i; + ret = deposit64(ret, 63, 1, a.sign); + return ret; } float64 internal_mpyhh(float64 a, float64 b, From patchwork Sun Dec 8 22:48:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848286 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840153wrt; Sun, 8 Dec 2024 14:50:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUnoC3N1NjvgfJ8F3UFphY0sQCXuKuUZ1v9AicMzpxbcdRvafS5h8utA7D7X1dSAfRG1wStLA==@linaro.org X-Google-Smtp-Source: AGHT+IE4d9icXI0R+B81KIQjCpn/ne7fyd8A7Ge/YJu/8La1Tt7SFTK7qyewyV12tg79hn67lsjE X-Received: by 2002:a05:620a:29c2:b0:7b6:c4c7:ecf9 with SMTP id af79cd13be357-7b6c4c7f302mr963662085a.15.1733698244928; Sun, 08 Dec 2024 14:50:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698244; cv=none; d=google.com; s=arc-20240605; b=VROiOQQ+ASbRWCWR6o4fuxHvCcITcCqQakfFGx/AvZ/aIJJ0SdANlOE5S3/GcJ2xLF tGpdmMfQHDOYEQK6dWgvYspIS2AkO3KZTu3sAzjRngyhlkH87Dc5pWqzPRF+LnvWagyn ftAQVN8aYx5MpeDngt2vcIkHzA4v1B5aQ41EQLt8h75ljdV4sX7GHdkjhSb44Rq3S3ho yFaxvNI1mbA9UrnwTFrZUKqGmnwzM9EI4fiTng2UPEMJ3TfH0gyuOaZ0Dv5WQg3Pk04s By+AY3QSGX3w+3UPm7I7bzDP3+6TyomoHw9EfBsZlk2mFX/5Qe9RHhhVUSYLhdh/2v3m sF7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=kB6bt5gsM+uIGBlj2PVExFpGSSwWH11mu7Vzk4S/tlM=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=Vy5ulkefSJN7c4K/CJQbl/+eX/GiaspF4mEWnIcKdaTiYkHkbAIX+SdRiI9byvNuw9 hRfrNLHIFtTfwyr1AwAT71a37X5BTQaaQ8nsMOkIle/HwfFd/0+QMTgB8NCAJm9yzniP UI3HznqTiIzfBZAGP/Bt52kd5pbxZMl/6UxXRG+nwn5t5bh72Mil3S+1k+N5cz0YqKr5 1AvSBXqg2kQ3KzqIl8KIJVWoCYIk6IN7JWN9ayBxtuXbZUw068UR/0ve/mwgmuGC+5Q+ jIVBQ7OKb0RTjiwOfUQ+N8Ca223X5OgaLsu3ZUQiRN1l/pGwSplhGgSlmGkBt8wbqMQp G6Uw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WQzJ1+JN; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6b5aaa992si1021102985a.391.2024.12.08.14.50.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:50:44 -0800 (PST) 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=WQzJ1+JN; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5h-0007L8-8L; Sun, 08 Dec 2024 17:49:29 -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 1tKQ5M-0007D4-8f for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:08 -0500 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5K-0006GV-RO for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:08 -0500 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-71df1f45b0cso170632a34.1 for ; Sun, 08 Dec 2024 14:49:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698146; x=1734302946; 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=kB6bt5gsM+uIGBlj2PVExFpGSSwWH11mu7Vzk4S/tlM=; b=WQzJ1+JNa7euvYNVHjmsaOK5b4JQ22vBD094u7ZSml2jl4gdf/I6NBzrvJd2Q5FmqT 1lIep+UcTijxe883NAah0MugonXHIedLgBHrASLvZpeRbiWkqIk2hIAKrH2h2LQpOlrI O7cNZO8CcwzyAsZ6Zujfld4vFyKBSKqsZVY1VqAX4IAZucUc36InFxMQn14JXioBp7eC ve2pvXJqIWzQnpfhnFMq5VGHRyUABD31VEdm+MEbdk9gdWdFzKkJ1jdru1ycgGBcG9C7 r6K6oO8ckhjihj9jt/X0C+zh3JnFMUxQ/cOkMSBmCed4R+dKq0mZKRvn764ZEHSrOUap BRzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698146; x=1734302946; 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=kB6bt5gsM+uIGBlj2PVExFpGSSwWH11mu7Vzk4S/tlM=; b=Y4rbxnXjgm0W1AJM43hTGNq/ihMjwo9UZ8wqwCoKaGMbmAl6myzYIpZ+uwa0/xnuLd IPUU+SlRhthH8IYbYH65WFGBQtiSHfFMgZD0GsXKlVVQj+taub7r58Xy0lc/cZ0RRm1u R43N17uVcZpyHPje+dbmulJ5Sdg3DD7u5icAH99Dl4u6SoiCeun8j2Eg9OdJ9bzd2dEb 9oADkSG7T82+tH8/mwt02amBsDB8zNwgMNnLtanTjQXPlglTPKA0lYIWr9DoptJPRJn3 We4sSQECpwJVAXQuC718b1cpck6dNM2azHVr+RV98NJUJ5GCrj5ZyTatGM92AyDQUDfT y1vg== X-Gm-Message-State: AOJu0YzFj0jN7Q+RSXvcT5G3LMHAeXvoViYb1HvYUyO+Q2LkfFV0SrtD FKbx7CvGFR/98cA9HiL6urEw3B0KS7OfTxFPE/IXca7al3P/ngkBmFATeNBLub1eJ3kDhrxOFI5 Cx5lZ7Q== X-Gm-Gg: ASbGncskL5p2R6OdmTz5zYVFboWGoRubcHfPZeghHlL/O25tiubj/IKjHCEvQ7W/u6k C1igPvBniWaqR3LVxiZQyemV9bfFeSXJ6y9tx5FL7vRF7HNxgeFxjHBPbxMC6K15xILT6Bw/yMw LMIy+6ILHUdOqGsuQIfQwk/uttMC2TJK7wIfKCWeAFEaEqpvchBQf9EY2ajUybbRYATU/QtAk96 q26Mjsi/nCafvE+1F8g3ImGhfdumu3tP22EkTJQ/+5AA1HVyesdgAaGDufo1/iq6uX/RLiE1NIn wdskw+8E9i20613I4N1UXTZV1wHzQGeibrSe X-Received: by 2002:a05:6830:25d0:b0:718:4fd:bd78 with SMTP id 46e09a7af769-71dced091famr6067572a34.13.1733698145830; Sun, 08 Dec 2024 14:49:05 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:49:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 16/17] target/hexagon: Use mulu64 for int128_mul_6464 Date: Sun, 8 Dec 2024 16:48:43 -0600 Message-ID: <20241208224844.570491-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32a.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 No need to open-code 64x64->128-bit multiplication. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- target/hexagon/fma_emu.c | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/target/hexagon/fma_emu.c b/target/hexagon/fma_emu.c index 343c40a686..6749538c09 100644 --- a/target/hexagon/fma_emu.c +++ b/target/hexagon/fma_emu.c @@ -82,38 +82,12 @@ int32_t float32_getexp(float32 f32) return -1; } -static uint32_t int128_getw0(Int128 x) -{ - return int128_getlo(x); -} - -static uint32_t int128_getw1(Int128 x) -{ - return int128_getlo(x) >> 32; -} - static Int128 int128_mul_6464(uint64_t ai, uint64_t bi) { - Int128 a, b; - uint64_t pp0, pp1a, pp1b, pp1s, pp2; + uint64_t l, h; - a = int128_make64(ai); - b = int128_make64(bi); - pp0 = (uint64_t)int128_getw0(a) * (uint64_t)int128_getw0(b); - pp1a = (uint64_t)int128_getw1(a) * (uint64_t)int128_getw0(b); - pp1b = (uint64_t)int128_getw1(b) * (uint64_t)int128_getw0(a); - pp2 = (uint64_t)int128_getw1(a) * (uint64_t)int128_getw1(b); - - pp1s = pp1a + pp1b; - if ((pp1s < pp1a) || (pp1s < pp1b)) { - pp2 += (1ULL << 32); - } - uint64_t ret_low = pp0 + (pp1s << 32); - if ((ret_low < pp0) || (ret_low < (pp1s << 32))) { - pp2 += 1; - } - - return int128_make128(ret_low, pp2 + (pp1s >> 32)); + mulu64(&l, &h, ai, bi); + return int128_make128(l, h); } static Int128 int128_sub_borrow(Int128 a, Int128 b, int borrow) From patchwork Sun Dec 8 22:48:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848291 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840234wrt; Sun, 8 Dec 2024 14:51:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUKnrjCjpcpuJdkv84GaRlC+0fl6gi0kUrWaXOMdZ4W8A6fsv+GXkzsU5qSQsM4jD6HNARfOg==@linaro.org X-Google-Smtp-Source: AGHT+IEJ2nk+JTX555LzAf3fNu0+YTi5wU8uU0EZ0kXEOm/+AVZBCDh6gNJs6VN7ePdX6Ea6AV0b X-Received: by 2002:ad4:5742:0:b0:6d8:9832:75d0 with SMTP id 6a1803df08f44-6d8e7140396mr166814986d6.17.1733698267298; Sun, 08 Dec 2024 14:51:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698267; cv=none; d=google.com; s=arc-20240605; b=RvPu2lTBRJuKKADwGAyweSfUnb3DVZCcoFidNyuA8QQCjklwtR9L/Y9oGI5rYz9Jzg A9VEFYdi0kfpEdFqgn0g45X9VKyyuWEXlhwnvqxnvNjDtp2xiM2vY1PuFXyGNzLOkxfj F+qHSz3i34KtvLpcJnNpy6rgJg70QVEM/QiKzgIR8wR+HkswkeqsmWUYxcsN2Xq1mIoz /RX0kTXWE9taI13TZv3fege4j8DntaFHLGCzmfbtvARdaM+FTBBmMUwV3y5G0PQubUOe CrgNO+h1yn1dMpZDiYRL4BYi97vJ+TGJTNJMZmIYhadH4Z+pJZVv8pAMj30HFMHE9q8R E9EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=bZcHraMwog49FpjWBRy/5OvBtZMMG8nX2q4nrJkRJ4E=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=juefmm84PmN09z9QlUyXyyoXblkGsnfPMRguY7b06HZmuApYRfYjc2EQhVDo8LVuJz PdUPSTeWKTPK2wT8x8EF9SFV6ik7vnTcHvF95LI30FtWiz4LHxa8mDiSPMrhEt/8wv2a c3IrKqfYN2AcmaBYYCow3Cal43/jyE/yL02+hwMJoQFJKraL90GmngFyV/feGyBUeX/l KqlJ33Gt+/YDBTuSQsGpuT8M0KW+KjQbu6yOUHxqQoY2/G+WoPCnDMtbmGKfUPT4Q5rH HP3Nj0mSzjTWQQtSd+ZN/S/u7AHJ2EojGUHq+JB/IQZMToksKCa9oSAKDi0SSm5f/hp5 VICw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KUXTFPUn; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d905eee390si34906586d6.364.2024.12.08.14.51.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:51:07 -0800 (PST) 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=KUXTFPUn; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKQ5i-0007Pl-DY; Sun, 08 Dec 2024 17:49:30 -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 1tKQ5N-0007DN-Mi for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:11 -0500 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5M-0006Gv-CA for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:09 -0500 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-71d40003870so1003046a34.0 for ; Sun, 08 Dec 2024 14:49:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698147; x=1734302947; 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=bZcHraMwog49FpjWBRy/5OvBtZMMG8nX2q4nrJkRJ4E=; b=KUXTFPUnJ3mYpFD8rolXON8FSOrsl4yt1cys4cWnspxaU8+ki1cwxmsYa+LZl3+yVX OzdNz3n71QZScLOX0YguMu+K4qTWW/A/qFl16ynLzcSp61XrMWWWkFAae9D5hIwSUlgH QWThEp0Qs1HP3CkEp2zrq29lGKOMcg6duzl2bin4yTEahlA6a82WnCGwdUDtjdjlpZ+Z 73FNkYh0+r5zJMiujkDh6OdAEJJtMOvNxRwCj03wGI7RuANtok5KWRfbKVJvbYg2BrnD wQ2G3PAew0pbIgOBx5oawNBHue63dlxII1y8RgLUAAPmL8DWnMplMUvH7E4ckBx9+hZR /bWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698147; x=1734302947; 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=bZcHraMwog49FpjWBRy/5OvBtZMMG8nX2q4nrJkRJ4E=; b=h1+RRircYvKxXl/ylH+PYTb/C+P57pdfxnUTVvzxfdYzGh/ZNR8OVSZwtkP3oTVpzV MusYQs9+F5jFQLena+VtZ1Nf+fst9HICv0o731NvTuxRmLhozt5GMlRBrNLQ8Jv1iT4+ YFkNFb7YQySBwwtos/AkS7OtGcBKT1LD9aQx+LkyMgGFEO3iao/5jSVA80Zj/9x/QAi9 21vo/o1wrXdebIhb4jkQHYNzS1HHHsu3q9QI2npWIHqLiE3h/h3c9d5ZPT2EKzliSEcw 6UDQXaNAykqgfw0jZh50a4pdDvEpPfo0HcbzZdt4OYYhKqEkosAgQteFNkCg0Wl9UOc9 Vu9Q== X-Gm-Message-State: AOJu0YwidJJIXCeAxsK6YcXVySbOsfXl3UHQVOH/8FfX9LaVM8Z182H3 B0sewuHMXaMN40R4yZtucPSQUMn8og5qksMiOYbG+CgTCP6hHJblXsN95Wrl2GV8fCkW5Nl9qEh 543Le2Q== X-Gm-Gg: ASbGnctFE1iA6CZXUHyW+XP9VPkHUIjV5raL2k8bJvOBUM/Ec3HZCRSdxrVDo68yCuF HMttMuQ6M/AYiG418k/kljKZSF2CX4M0krqZItfjVH+5Df+dwfzsqA+EarEco7cQaKYfQOG9uJD nVeAo7WtvQKsVMR6A8RaEkgpfLoBX123wFEIpVIpX1YcZnD+OKhf6u9YMF7uh4Gk/v1MIKdpw5G tyh3eU0KhZPD7JnvcYfhJQDPIuUWDR7QbRkWzlPs/ZLtVGwhdD2lBm9NWkCnU38/bw0hD9vrvir uH72iWSbgG4Dqt2Dorm2DeBXbHkicsn9r+bb X-Received: by 2002:a05:6830:25c4:b0:71d:4488:19f2 with SMTP id 46e09a7af769-71dcf55937emr5427991a34.26.1733698147214; Sun, 08 Dec 2024 14:49:07 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:49:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 17/17] target/hexagon: Simplify internal_mpyhh setup Date: Sun, 8 Dec 2024 16:48:44 -0600 Message-ID: <20241208224844.570491-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.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 Initialize x with accumulated via direct assignment, rather than multiplying by 1. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- target/hexagon/fma_emu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/hexagon/fma_emu.c b/target/hexagon/fma_emu.c index 6749538c09..bc6e742639 100644 --- a/target/hexagon/fma_emu.c +++ b/target/hexagon/fma_emu.c @@ -453,7 +453,7 @@ float64 internal_mpyhh(float64 a, float64 b, float64_is_infinity(b)) { return float64_mul(a, b, fp_status); } - x.mant = int128_mul_6464(accumulated, 1); + x.mant = int128_make64(accumulated); x.sticky = sticky; prod = fGETUWORD(1, float64_getmant(a)) * fGETUWORD(1, float64_getmant(b)); x.mant = int128_add(x.mant, int128_mul_6464(prod, 0x100000000ULL));