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;