From nobody Tue Feb 10 06:25:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539473147529878.5077194498397; Sat, 13 Oct 2018 16:25:47 -0700 (PDT) Received: from localhost ([::1]:46563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBTI2-0006Bd-8z for importer@patchew.org; Sat, 13 Oct 2018 19:25:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBTCf-0002TK-LP for qemu-devel@nongnu.org; Sat, 13 Oct 2018 19:20:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gBTCd-0007xG-3w for qemu-devel@nongnu.org; Sat, 13 Oct 2018 19:20:13 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:60699) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gBTCc-0007wR-Sv for qemu-devel@nongnu.org; Sat, 13 Oct 2018 19:20:10 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 508DF21BF8; Sat, 13 Oct 2018 19:20:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 13 Oct 2018 19:20:09 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id E28F7102D5; Sat, 13 Oct 2018 19:20:08 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=W3FYcD7FhPYXsWu0AHdQnoS5W7vwioe/7XuCuQj6MjE=; b=Wk06H G6T293quSER96+V/JhahkZoYcNVv7WyrN1rPGvHhynJzcBNB8vZXFvsRiHecqMxk 2K4lCs5lGjBxZawqswYWIS4VkOD3PKOSb+1XJOvCgYI5N8ktdYcq8gBgKD10U3m7 L/M3NdZZU+aUBT8IFXsslkIY39UTHYQNinJtlo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=W3FYcD7FhPYXsWu0AHdQnoS5W7vwi oe/7XuCuQj6MjE=; b=mWiNGoyYlkEKXuO/TCJ1Y5O3l8a9mPUUV/rx4jJPqpCYh TOAw6ODVSPIpQxR/v+hpo3UcYLfrA6eveasfNgbBKRaMb9hx8Dr+623GuFHZ8Oum B7m2gy+P80gtyflvkmTDJft4a4bWdDpBBCPIH5zm1QXBGlhmpSHSyXK7VjqsAQat nEbr+xDg5faCuDCHlF9o7lOx8TLhL8trYTKxEFOCLzxKxorgy2Iw8+hvKd5/0MxK y/FGaRipHIQJlWLe/amXahAqw1l+Wbv0bknDrAFfeFupovZSHen5NbB7p7CtftPJ 5I8h5fNgNpHIBv7haG5NvXmbkGRUFEsa7l+P+9gmQ== X-ME-Sender: X-ME-Proxy: From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Sat, 13 Oct 2018 19:19:29 -0400 Message-Id: <20181013231933.28789-10-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181013231933.28789-1-cota@braap.org> References: <20181013231933.28789-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [PATCH v5 09/13] hardfloat: implement float32/64 multiplication X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Performance results for fp-bench: 1. Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz - before: mul-single: 126.91 MFlops mul-double: 118.28 MFlops - after: mul-single: 258.02 MFlops mul-double: 197.96 MFlops 2. ARM Aarch64 A57 @ 2.4GHz - before: mul-single: 37.42 MFlops mul-double: 38.77 MFlops - after: mul-single: 73.41 MFlops mul-double: 76.93 MFlops 3. IBM POWER8E @ 2.1 GHz - before: mul-single: 58.40 MFlops mul-double: 59.33 MFlops - after: mul-single: 60.25 MFlops mul-double: 94.79 MFlops Signed-off-by: Emilio G. Cota --- fpu/softfloat.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index d5d1c555dc..78837fa9d8 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1276,8 +1276,8 @@ float16 __attribute__((flatten)) float16_mul(float16 = a, float16 b, return float16_round_pack_canonical(pr, status); } =20 -float32 __attribute__((flatten)) float32_mul(float32 a, float32 b, - float_status *status) +static float32 QEMU_SOFTFLOAT_ATTR +soft_float32_mul(float32 a, float32 b, float_status *status) { FloatParts pa =3D float32_unpack_canonical(a, status); FloatParts pb =3D float32_unpack_canonical(b, status); @@ -1286,8 +1286,8 @@ float32 __attribute__((flatten)) float32_mul(float32 = a, float32 b, return float32_round_pack_canonical(pr, status); } =20 -float64 __attribute__((flatten)) float64_mul(float64 a, float64 b, - float_status *status) +static float64 QEMU_SOFTFLOAT_ATTR +soft_float64_mul(float64 a, float64 b, float_status *status) { FloatParts pa =3D float64_unpack_canonical(a, status); FloatParts pb =3D float64_unpack_canonical(b, status); @@ -1296,6 +1296,64 @@ float64 __attribute__((flatten)) float64_mul(float64= a, float64 b, return float64_round_pack_canonical(pr, status); } =20 +static float float_mul(float a, float b) +{ + return a * b; +} + +static double double_mul(double a, double b) +{ + return a * b; +} + +static bool f32_mul_fast(float32 a, float32 b, const struct float_status *= s) +{ + return float32_is_zero(a) || float32_is_zero(b); +} + +static bool f64_mul_fast(float64 a, float64 b, const struct float_status *= s) +{ + return float64_is_zero(a) || float64_is_zero(b); +} + +static float32 f32_mul_fast_op(float32 a, float32 b, float_status *s) +{ + bool signbit =3D float32_is_neg(a) ^ float32_is_neg(b); + + return float32_set_sign(float32_zero, signbit); +} + +static float64 f64_mul_fast_op(float64 a, float64 b, float_status *s) +{ + bool signbit =3D float64_is_neg(a) ^ float64_is_neg(b); + + return float64_set_sign(float64_zero, signbit); +} + +float32 __attribute__((flatten)) +float32_mul(float32 a, float32 b, float_status *s) +{ + if (QEMU_HARDFLOAT_2F32_USE_FP) { + return float_gen2(a, b, s, float_mul, soft_float32_mul, float_is_z= on2, + NULL, f32_mul_fast, f32_mul_fast_op); + } else { + return f32_gen2(a, b, s, float_mul, soft_float32_mul, f32_is_zon2,= NULL, + f32_mul_fast, f32_mul_fast_op); + } +} + +float64 __attribute__((flatten)) +float64_mul(float64 a, float64 b, float_status *s) +{ + if (QEMU_HARDFLOAT_2F64_USE_FP) { + return double_gen2(a, b, s, double_mul, soft_float64_mul, + double_is_zon2, NULL, f64_mul_fast, f64_mul_fas= t_op); + } else { + return f64_gen2(a, b, s, double_mul, soft_float64_mul, f64_is_zon2, + NULL, f64_mul_fast, f64_mul_fast_op); + } +} + /* * Returns the result of multiplying the floating-point values `a' and * `b' then adding 'c', with no intermediate rounding step after the --=20 2.17.1