From nobody Tue Oct 28 01:17:06 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588620677; cv=none; d=zohomail.com; s=zohoarc; b=MZ2OQDgv1eM7Yc9uCdAJ3dB+5goSURizajO8ZxBqtl6ygr88cLQ+1Pw21dLw9VpvY8rzinFySKE9v2RsNT/JnA/ekRm3/paKCRsc6dUGpUgILrRH642YhlHmrhyoGIoODG/pvtj2qfxOMLaKnUoqiaZwlVjXZCdehFaD9FZcP1M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588620677; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=4MNjzkbAJCWvqiKh2DZRO4y4MY5dOBDH4eK8eltsp9I=; b=URb4uC86V2EMv6m8FgX5fjjCuvuJJWCKi403CK5pMNKtaUVY5Mu4jhhBv/b0SOt2VG3Eut4qnV5KbIp8o1zApAbfctxF5NfDpMByU9FiQGaDieqBPuEoWS9ATD999+nAaENfFv1iTDByZb9cbccwFyH379wihuTwhEJfQXa+L9c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1588620677010502.9656012482948; Mon, 4 May 2020 12:31:17 -0700 (PDT) Received: from localhost ([::1]:49642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVgo7-0006vf-2f for importer@patchew.org; Mon, 04 May 2020 15:31:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVgn8-0006AD-Co; Mon, 04 May 2020 15:30:14 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:39875) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jVgn7-0000wm-Fm; Mon, 04 May 2020 15:30:14 -0400 Received: by mail-pf1-x441.google.com with SMTP id 18so6037203pfx.6; Mon, 04 May 2020 12:30:12 -0700 (PDT) Received: from localhost.localdomain ([117.62.175.86]) by smtp.googlemail.com with ESMTPSA id y78sm9527842pfb.127.2020.05.04.12.30.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2020 12:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4MNjzkbAJCWvqiKh2DZRO4y4MY5dOBDH4eK8eltsp9I=; b=nOdI6x7SUBh+voS9Yx6N1ersUOM/JIk2sokBKxfVTzONvTGZy2TJ7ZexT7K2giesrn 3uA7ikOF1X2HFEg2W3txDmz3WQcfJddj4wWI+5N260vZN3KzlNZGjPQL4phy61ANzfQn DI7scojw2UlNZdtNA77haBkJEtyHS3qwwpC52LAIP32PAEbIT4HioZv7awQuI02d9ycN xf1We5eQvFUzX/3aEVKd9PzrXnwb6IhB0l15p/CEULKdMGUFmUXEHJJHZnEbJmfGNrKB kFFahM/fQ71h7fGA53f94/wrSIYUVHobFY3Db42JERLJneoOsxwRSQKuk7yxGr2hTYbY QoFQ== 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:mime-version :content-transfer-encoding; bh=4MNjzkbAJCWvqiKh2DZRO4y4MY5dOBDH4eK8eltsp9I=; b=IUyb4VQN2aNCESXH9CIo/rUMJ7ukUFY4w5J7BIpMOpyl9bI75+4GI1PcMbix7ElSWH D/spGMW+CGMzMMN8KwXV8ihxH0ZQYiZIkAx4F6XDFzT/MK4lK8HdSzGBMIgfY8isbTSX BOmj0WoQqyFZCj9G4xn7G1elw5xtqhIlobIQmrVI9jQnsVKYF0MdPBfo32p9eWIFjHrE 0mzWTloe/gTCV4rsM/gFu6L3+2tQffr1jAzvnDEwhgT5mU/jvNmNJsn7610PjW3l/3A6 yCLnRSTeNG9UPpqSJzV+JGC2omRczM+a1W0MxKngluT7XeGniVeCb3am3PVTWkPy6r/a +I9A== X-Gm-Message-State: AGi0PuaatVNbJIj27Zuzd9ZRYAyAM+3hznpRVxYX5VLfLVRZiXND7YzO W8lCVMHS6LrNKS1f3nf3QdYa8jiCnlpGdQ== X-Google-Smtp-Source: APiQypKqmOjPNfsRcHkH0xiaq+6BL67uZ6FlcgZipnLT27eNdqU9hZqenaDDPu/bARrpQ/mpBXI5fg== X-Received: by 2002:a63:f30a:: with SMTP id l10mr499003pgh.372.1588620610121; Mon, 04 May 2020 12:30:10 -0700 (PDT) From: luoyonggang@gmail.com To: qemu-devel@nongnu.org Subject: [PATCH] ppc: Use hard-float in ppc fp_hlper as early as possible. This would increase the performance better than enable hard-float it in soft-float.c; Just using fadd fsub fmul fdiv as a simple bench demo. With this patch, performance are increased 2x. and 1.3x than the one enable hard-float in soft-float.c Both version are not considerate inexact fp exception yet. Date: Tue, 5 May 2020 03:29:54 +0800 Message-Id: <20200504192954.1387-1-luoyonggang@gmail.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::441; envelope-from=luoyonggang@gmail.com; helo=mail-pf1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: richard.henderson@linaro.org, Yonggang Luo , qemu-ppc@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Yonggang Luo Just post as an idea to improve PPC fp performance. With this idea, we have no need to adjust the helper orders. Signed-off-by: Yonggang Luo --- target/ppc/fpu_helper.c | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 2bd49a2cdf..79051e4540 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -926,6 +926,17 @@ static void float_invalid_op_addsub(CPUPPCState *env, = bool set_fpcc, /* fadd - fadd. */ float64 helper_fadd(CPUPPCState *env, float64 arg1, float64 arg2) { + CPU_DoubleU u1, u2; + + u1.d =3D arg1; + u2.d =3D arg2; + CPU_DoubleU retDouble; + retDouble.nd =3D u1.nd + u2.nd; + if (likely(float64_is_zero_or_normal(retDouble.d))) + { + /* TODO: Handling inexact */ + return retDouble.d; + } float64 ret =3D float64_add(arg1, arg2, &env->fp_status); int status =3D get_float_exception_flags(&env->fp_status); =20 @@ -941,6 +952,17 @@ float64 helper_fadd(CPUPPCState *env, float64 arg1, fl= oat64 arg2) /* fsub - fsub. */ float64 helper_fsub(CPUPPCState *env, float64 arg1, float64 arg2) { + CPU_DoubleU u1, u2; + + u1.d =3D arg1; + u2.d =3D arg2; + CPU_DoubleU retDouble; + retDouble.nd =3D u1.nd - u2.nd; + if (likely(float64_is_zero_or_normal(retDouble.d))) + { + /* TODO: Handling inexact */ + return retDouble.d; + } float64 ret =3D float64_sub(arg1, arg2, &env->fp_status); int status =3D get_float_exception_flags(&env->fp_status); =20 @@ -967,6 +989,17 @@ static void float_invalid_op_mul(CPUPPCState *env, boo= l set_fprc, /* fmul - fmul. */ float64 helper_fmul(CPUPPCState *env, float64 arg1, float64 arg2) { + CPU_DoubleU u1, u2; + + u1.d =3D arg1; + u2.d =3D arg2; + CPU_DoubleU retDouble; + retDouble.nd =3D u1.nd * u2.nd; + if (likely(float64_is_zero_or_normal(retDouble.d))) + { + /* TODO: Handling inexact */ + return retDouble.d; + } float64 ret =3D float64_mul(arg1, arg2, &env->fp_status); int status =3D get_float_exception_flags(&env->fp_status); =20 @@ -997,6 +1030,17 @@ static void float_invalid_op_div(CPUPPCState *env, bo= ol set_fprc, /* fdiv - fdiv. */ float64 helper_fdiv(CPUPPCState *env, float64 arg1, float64 arg2) { + CPU_DoubleU u1, u2; + + u1.d =3D arg1; + u2.d =3D arg2; + CPU_DoubleU retDouble; + retDouble.nd =3D u1.nd / u2.nd; + if (likely(float64_is_zero_or_normal(retDouble.d))) + { + /* TODO: Handling inexact */ + return retDouble.d; + } float64 ret =3D float64_div(arg1, arg2, &env->fp_status); int status =3D get_float_exception_flags(&env->fp_status); =20 --=20 2.23.0.windows.1