From nobody Tue Feb 10 08:27:11 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 1522884160225645.5246412113748; Wed, 4 Apr 2018 16:22:40 -0700 (PDT) Received: from localhost ([::1]:37983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3rjj-0004Nq-E0 for importer@patchew.org; Wed, 04 Apr 2018 19:22:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3rZg-0004P6-4v for qemu-devel@nongnu.org; Wed, 04 Apr 2018 19:12:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3rZf-00047R-17 for qemu-devel@nongnu.org; Wed, 04 Apr 2018 19:12:16 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:49101) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f3rZe-00046n-Rk for qemu-devel@nongnu.org; Wed, 04 Apr 2018 19:12:14 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5B77121C30; Wed, 4 Apr 2018 19:11:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 04 Apr 2018 19:11:18 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id ED76EE4924; Wed, 4 Apr 2018 19:11:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=ba1CD9ZQemWEsv 1shEIkNxJpSxn2x7tcfDWuuUzVMj4=; b=sT3t/7/QVK1Ns/HD7ylS2XMn4vufcl Q0qdNIzNsGazCM+jnY9ppcZZwfWMCyTlfCLvJCTtT3vIsIcLJC1hWuWAZY4YslNn D+Aaywj6lcjZyO9DDkfG9UE5053M/7NaryL8Op2oxMbmwGjh8fsGsEKdpsU4Ja59 g3ckUPTwhEFkw= 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-sender:x-me-sender:x-sasl-enc; s= fm2; bh=ba1CD9ZQemWEsv1shEIkNxJpSxn2x7tcfDWuuUzVMj4=; b=HtBk3Sar E9jtdiVDG/tSHpgtaFTIwxKq+oljmsorxKHW9tF5ydHwV2x1h90eqVp1BLacSEU2 TG23lFCVZnVpz52ZkW3wZ38PY4hmqFWa1RTPLAE3fxdBAtNMOnHS+u6SweOn9NYX dJUudiQU7DqemVLq8apavCRXeR3LHueMfJUwBM34mnKeRY8ZCrPM4jzgWdjME7zo Hj8SlaQAV47lAI2VhZi5noz9ty6XKzVV12gshywv4E0Lj1gRjUwAGhEpXx3w1Uh8 pUq076ZhB6DHlv84aCuW92MAJEUGPxwIRp9vHngxCZ96++O83A2kMUBaMXQEZmPp +Mg+NVcXzQbbCg== X-ME-Sender: From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 4 Apr 2018 19:11:11 -0400 Message-Id: <1522883475-27858-12-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522883475-27858-1-git-send-email-cota@braap.org> References: <1522883475-27858-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.29 Subject: [Qemu-devel] [PATCH v3 11/15] hardfloat: support 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: Peter Maydell , Mark Cave-Ayland , Richard Henderson , Laurent Vivier , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Aurelien Jarno 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 ca0b8ab..2c68b9d 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1281,8 +1281,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); @@ -1291,8 +1291,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); @@ -1301,6 +1301,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.7.4