From nobody Mon Feb 9 20:12:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1565700668; cv=none; d=zoho.com; s=zohoarc; b=TP4UBAYogo3DVvwF7Xn4MgKcrOuzSHISf3Vp+uJ5dBF/PBDWl2pPZJFjiJ67TWiv+jHXSbYc0/T4gmR1bDHlIIzG4P1jMk1KYM7gnRj9EvH5K69kYUx6zXmt9an8ZcQKV2wjRUjc5WiQrXnKNt4W4xAVjcYWV9QBEGAyaTuKgck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565700668; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=bzhZ2dvCDc+pUSd5l57iGhNYKTcXOEr6qbHitn8Zc+c=; b=b1NkC1nm4S4+iTNRknwymL8HRXFQQ8Tskl4x06biljbK9tfjyoGo9xf+um43fs1egB+sXYUCzMM2YBILOvNyjrGpu8nUhTGQjhvdyIRdhDbCa+sLZkviNXrBH1ezALlhF3kuiI7RIG8yEyyYj0Iha3YnM1VtD+CzfmhrqrNyzPY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565700668042269.12914863295885; Tue, 13 Aug 2019 05:51:08 -0700 (PDT) Received: from localhost ([::1]:51992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxWGS-00045i-24 for importer@patchew.org; Tue, 13 Aug 2019 08:51:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53558) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxWFM-0002Gq-Bb for qemu-devel@nongnu.org; Tue, 13 Aug 2019 08:49:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hxWFL-0000eZ-1I for qemu-devel@nongnu.org; Tue, 13 Aug 2019 08:49:52 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:54932) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hxWFK-0000dI-RM for qemu-devel@nongnu.org; Tue, 13 Aug 2019 08:49:50 -0400 Received: by mail-wm1-x341.google.com with SMTP id p74so1391013wme.4 for ; Tue, 13 Aug 2019 05:49:50 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id z18sm954417wml.10.2019.08.13.05.49.47 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 13 Aug 2019 05:49:48 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2DE231FF90; Tue, 13 Aug 2019 13:49:47 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bzhZ2dvCDc+pUSd5l57iGhNYKTcXOEr6qbHitn8Zc+c=; b=h982IvVqIYV+ZjyA983mzieTIw4nGQdNXcRCXtWG4Xn6pyY7A8JKwtV/weaGCOla/+ 3pIJJdyOTmEAGTnGpldt+tKp1rk5014Qfmo4TEfJuDYd4TkBsvFbn99P4cPjDV+Y3RPF rXHrds7mqRzSUST2EFnNoGEnNshWY9tXMhw7s4D1HhlNpwGs9EKvMTV91HtKWSRJnzL8 sF5vHcU5v6Rmjra/Qq1ffFinp1K3cLSgMHmbd1Cz03Cie/Ja0xFJ+Sza2tnTEQ6YpT+m eK4ax7sDZgVBdQqyPraxdecytXymdttXBQAfX1bvO3/Lqz9VYD0ovdZOIBRL9qqSYs+U a+WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bzhZ2dvCDc+pUSd5l57iGhNYKTcXOEr6qbHitn8Zc+c=; b=M00A1trmKLwQzbMv/K+x7rATjxuoVL853XDrBmKLeKXQ5LaGmmHDeN3uD9ZrUK3Joi AD2HCN/WcEjsp0FylBl3Oz8JE2eFtY4+6CnenqV3gfH7qUZoM1+V40k55JF0Z9jQCld4 Ih/6Pun/QAqcm/CQiGL63QRtsVlH0D8lU3fOsBZMDRX1NKiZTZcwEC7zwh5mqpISUz3G JgroHHW3W/yW1SMByFVmXIfAKDNpRX+T/TkKzU0/oMhRQdZ0l/tCCrulEzFKfk31mqWw vqV7RAVtSCsNVaXJ9iXb96khY8+QPRW21wbMB0U/XS5gkd9tnkXO2axPRGyjAyoEzRbG bCgA== X-Gm-Message-State: APjAAAUvxcu7bDGBGE5b2tj+uoAfMR0dpjkTKSjp1z17i5Q6+vyb5zZs +5kSLhYIEjUxNKWWzkKKZfDSxQ== X-Google-Smtp-Source: APXvYqydiIN1sPxKSAEE3dgFCJTU+in7UYjQmXbS4QTvLfSaPeur6Zk3fhAioGjb7eBwoBSOeoGX/A== X-Received: by 2002:a7b:ca54:: with SMTP id m20mr3060824wml.102.1565700589733; Tue, 13 Aug 2019 05:49:49 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 13 Aug 2019 13:49:36 +0100 Message-Id: <20190813124946.25322-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190813124946.25322-1-alex.bennee@linaro.org> References: <20190813124946.25322-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v3 03/13] fpu: optimise float[16/32/64]_squash_denormal (HACK?) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , armbru@redhat.com, Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Using the floatXX_pack_raw functions is slight overkill for basically just masking out all but the top bit of the number. This makes the final code exactly the same as pre-conversion. TODO: is this worth it, can the compiler do better with make_float? Signed-off-by: Alex Benn=C3=A9e --- fpu/softfloat.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 0a434555cd8..9e57b7b5933 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -3294,23 +3294,23 @@ float64 float64_silence_nan(float64 a, float_status= *status) | input-denormal exception and return zero. Otherwise just return the valu= e. *-------------------------------------------------------------------------= ---*/ =20 -static FloatParts parts_squash_denormal(FloatParts p, float_status *status) +static bool parts_squash_denormal(FloatParts p, float_status *status) { if (p.exp =3D=3D 0 && p.frac !=3D 0) { float_raise(float_flag_input_denormal, status); - p.frac =3D 0; - p.cls =3D float_class_zero; + return true; } =20 - return p; + return false; } =20 float16 float16_squash_input_denormal(float16 a, float_status *status) { if (status->flush_inputs_to_zero) { FloatParts p =3D float16_unpack_raw(a); - p =3D parts_squash_denormal(p, status); - return float16_pack_raw(p); + if (parts_squash_denormal(p, status)) { + a =3D make_float16(float16_val(a) & 0x8000); + } } return a; } @@ -3319,8 +3319,9 @@ float32 float32_squash_input_denormal(float32 a, floa= t_status *status) { if (status->flush_inputs_to_zero) { FloatParts p =3D float32_unpack_raw(a); - p =3D parts_squash_denormal(p, status); - return float32_pack_raw(p); + if (parts_squash_denormal(p, status)) { + a =3D make_float32(float32_val(a) & 0x80000000); + } } return a; } @@ -3329,8 +3330,9 @@ float64 float64_squash_input_denormal(float64 a, floa= t_status *status) { if (status->flush_inputs_to_zero) { FloatParts p =3D float64_unpack_raw(a); - p =3D parts_squash_denormal(p, status); - return float64_pack_raw(p); + if (parts_squash_denormal(p, status)) { + a =3D make_float64(float64_val(a) & (1ULL << 63)); + } } return a; } --=20 2.20.1