From patchwork Tue Jun 9 16:28:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandar Markovic X-Patchwork-Id: 281060 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C6AAC433E0 for ; Tue, 9 Jun 2020 16:39:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07D4720737 for ; Tue, 9 Jun 2020 16:39:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V5V8sKI8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07D4720737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jihHp-0003TN-4d for qemu-devel@archiver.kernel.org; Tue, 09 Jun 2020 12:39:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jih7J-00063z-GG for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:28:49 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:38798) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jih7I-00018J-Fg for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:28:49 -0400 Received: by mail-wr1-x42b.google.com with SMTP id e1so22047331wrt.5 for ; Tue, 09 Jun 2020 09:28:48 -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:in-reply-to:references; bh=5sXF/az5kQhp13/eu0ouGNik7qqbeKCa9azeT75DNvc=; b=V5V8sKI8ddlBRjfnbTEvsCTie2I4pJd17Viy9ynI+kELhMjrRSLPZ/Pwuv2TEjBQLx OGkHJAzWE8raUAWvZJz0YHgYkyhUkr6wY0Nnwp+hu0YbgnXXQXPYmf9cJc5T3GHTaBzL RXe0kIMJHDGDwGT4+rbhYMuZ4hmsZFwEv0YrCef9WbbpwO64ESFKDqn1Bv+4WI+Yu5p9 eA1tHEq8Hw5njqgIDDdzeILjPRIuonqANBoFNhNaEGX18e0GaOqnfSqLKJ3HO2ibgoEr VRd79asEtc+on4ssWsr5seMIoZFIzA5krSXHVe4szLgeFdCzgRLyM7zyO52w1PBgkR7s bGQw== 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; bh=5sXF/az5kQhp13/eu0ouGNik7qqbeKCa9azeT75DNvc=; b=NVQYcAwVFNB2XLkGDitoJo8U+S6a9PaOgpqXTKJoY6qHkqhms/KWqk67IAIWmGzSpY UVLU0mLuue32HGRPfYMoljjEUvAEADW2FktanPNUDW8JS6yrdHYa1ccuWrFupsUW7fnu zwcre80ryEvjZXfWa80wGqD/TJNvBmtlqj5xJymCYtRVzD+s0o5PmB2dX3+i//NuiU88 U5uG3Eq1bSRBF4VsW0YECThyZVOuSqYYeV/uQBr0liHY2gtc7UigV67SnGA96o54h8yC bNfmIw/V+ybv9dO5GXI6cEHC0Br+NnqpRY9fflA7CnkQ9KykNv2HEjEf2L0/W/faRIre d9xA== X-Gm-Message-State: AOAM533O7SbrMfPfk0Pfnq3o4BTWkbOrJ7o29OPdsbTlbjpj+1k9tvNF SHHiENCTeSYYzC2ZwBGcJgJ79Pns X-Google-Smtp-Source: ABdhPJyqzu+OW3x/6MODy1CsJa9AOxTEi/NHnzcN2o5O9LA9DA7M3kEMhKmsQanLFpA8VNL6lgYuPQ== X-Received: by 2002:a5d:4d01:: with SMTP id z1mr5769618wrt.29.1591720126963; Tue, 09 Jun 2020 09:28:46 -0700 (PDT) Received: from rtrkw774-lin.syrmia.com ([46.240.135.226]) by smtp.gmail.com with ESMTPSA id 23sm3643598wmo.18.2020.06.09.09.28.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jun 2020 09:28:46 -0700 (PDT) From: Aleksandar Markovic To: qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [PULL 10/20] target/mips: fpu: Demacro NMADD. Date: Tue, 9 Jun 2020 18:28:28 +0200 Message-Id: <1591720118-7378-11-git-send-email-aleksandar.qemu.devel@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1591720118-7378-1-git-send-email-aleksandar.qemu.devel@gmail.com> References: <1591720118-7378-1-git-send-email-aleksandar.qemu.devel@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=aleksandar.qemu.devel@gmail.com; helo=mail-wr1-x42b.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, URIBL_BLOCKED=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: aleksandar.qemu.devel@gmail.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This is just a cosmetic change to enable tools like gcov, gdb, callgrind, etc. to better display involved source code. Reviewed-by: Aleksandar Rikalo Signed-off-by: Aleksandar Markovic Message-Id: <20200518200920.17344-9-aleksandar.qemu.devel@gmail.com> --- target/mips/fpu_helper.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/target/mips/fpu_helper.c b/target/mips/fpu_helper.c index e37fc40..d4c065f 100644 --- a/target/mips/fpu_helper.c +++ b/target/mips/fpu_helper.c @@ -1495,7 +1495,6 @@ uint64_t helper_float_ ## name ## _ps(CPUMIPSState *env, \ update_fcr31(env, GETPC()); \ return ((uint64_t)fsth0 << 32) | fst0; \ } -FLOAT_FMA(nmadd, float_muladd_negate_result) FLOAT_FMA(nmsub, float_muladd_negate_result | float_muladd_negate_c) #undef FLOAT_FMA @@ -1577,6 +1576,49 @@ uint64_t helper_float_msub_ps(CPUMIPSState *env, uint64_t fdt0, return ((uint64_t)fsth0 << 32) | fstl0; } +uint64_t helper_float_nmadd_d(CPUMIPSState *env, uint64_t fst0, + uint64_t fst1, uint64_t fst2) +{ + fst0 = float64_mul(fst0, fst1, &env->active_fpu.fp_status); + fst0 = float64_add(fst0, fst2, &env->active_fpu.fp_status); + fst0 = float64_chs(fst0); + + update_fcr31(env, GETPC()); + return fst0; +} + +uint32_t helper_float_nmadd_s(CPUMIPSState *env, uint32_t fst0, + uint32_t fst1, uint32_t fst2) +{ + fst0 = float32_mul(fst0, fst1, &env->active_fpu.fp_status); + fst0 = float32_add(fst0, fst2, &env->active_fpu.fp_status); + fst0 = float32_chs(fst0); + + update_fcr31(env, GETPC()); + return fst0; +} + +uint64_t helper_float_nmadd_ps(CPUMIPSState *env, uint64_t fdt0, + uint64_t fdt1, uint64_t fdt2) +{ + uint32_t fstl0 = fdt0 & 0XFFFFFFFF; + uint32_t fsth0 = fdt0 >> 32; + uint32_t fstl1 = fdt1 & 0XFFFFFFFF; + uint32_t fsth1 = fdt1 >> 32; + uint32_t fstl2 = fdt2 & 0XFFFFFFFF; + uint32_t fsth2 = fdt2 >> 32; + + fstl0 = float32_mul(fstl0, fstl1, &env->active_fpu.fp_status); + fstl0 = float32_add(fstl0, fstl2, &env->active_fpu.fp_status); + fstl0 = float32_chs(fstl0); + fsth0 = float32_mul(fsth0, fsth1, &env->active_fpu.fp_status); + fsth0 = float32_add(fsth0, fsth2, &env->active_fpu.fp_status); + fsth0 = float32_chs(fsth0); + + update_fcr31(env, GETPC()); + return ((uint64_t)fsth0 << 32) | fstl0; +} + #define FLOAT_FMADDSUB(name, bits, muladd_arg) \ uint ## bits ## _t helper_float_ ## name(CPUMIPSState *env, \