From patchwork Mon May 18 19:41:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandar Markovic X-Patchwork-Id: 282437 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, 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 F3B12C433E0 for ; Mon, 18 May 2020 19:52:49 +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 B6EBA20657 for ; Mon, 18 May 2020 19:52:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NryjKmI3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6EBA20657 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]:40122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaloe-0000uP-Ue for qemu-devel@archiver.kernel.org; Mon, 18 May 2020 15:52:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jalec-0002wm-Tj for qemu-devel@nongnu.org; Mon, 18 May 2020 15:42:26 -0400 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]:36198) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jalec-0004cF-5c for qemu-devel@nongnu.org; Mon, 18 May 2020 15:42:26 -0400 Received: by mail-lf1-x144.google.com with SMTP id c21so9140645lfb.3 for ; Mon, 18 May 2020 12:42:25 -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 :mime-version:content-transfer-encoding; bh=7DTiRZYqiOEJbT1KL7IFIXdClbFolr0SKEXu5py2ATU=; b=NryjKmI3y0/hm81Y1Ob+GeHOUi2ZC72yKs75RgNRALLbq3OkQ91+Lcs2Tnrm0nD4d3 9pw1VQUwMNWTagJgjgjOj58MCEnl4QELe0VHi0OLTaVrzaSyCZ+1kKxo+ALiHUAgiMmw KqMhHFbM0VbecXL4vMzq2c3vnFx5jWnnKvJd3PLHyFQd6OprfZ2jcmdTuA9hbtb9elVk 917LD1xceennjvarr8r8gwHzHAhJrTr/wvc/k6tlDU2AGGuXtzWPDr9kkOJU+pLg6tS9 Gq6yYwqzu3XJ0tGpsdosn7Id0IX8mHDfjt0tBnLBOZKguXF4eSVGqf5qKiC9KRdlgzIz 2sBg== 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=7DTiRZYqiOEJbT1KL7IFIXdClbFolr0SKEXu5py2ATU=; b=PmlJjpeYLWNBVIYlFtJHh0XgK7v3HaqJYn7oEfrnHV5pUoNljIJsY9jZA45/k6SsYk BM7dLX+7Gw3maVKu7/Wm4NdFYHdpPr7dwUvHifwNYBJDd6CAcnfIJsi6NMdHTzzglNmW tu5QnKX5CMhWxgJnRGijys3X7mP9Bn1CtizZ6c/IWMeFt0BOszk9rR7cKBgk1iGK+ynb 5b8ZlRqT8+QiqQxr8nQrs0dNYw0NQd1OutFWlw64uXv8EWfYBsYSpdD3MOQSWVdJtAxN 85MbTH3+s4M3DM71p24hY+1yuriDgE7YjwuR5rlEx0atmKlbSvJtNw87PwPVwYHW/+uR LD6A== X-Gm-Message-State: AOAM531929cHJ+y6nGRNd+0lJZmX8zl5eL6AgopTx3UzOUq0deXcFRWA 5W62hmpB/gnv2Bqvq666TYZxYAb6ZPc= X-Google-Smtp-Source: ABdhPJxrbEVK9uGM1HPiFQXlW55VheRoqDHNkHs2ikGGKyPx5tOMah3grVPRkaWr3q0Jg9Iuo1bvig== X-Received: by 2002:a05:6512:3f8:: with SMTP id n24mr13098345lfq.179.1589830944521; Mon, 18 May 2020 12:42:24 -0700 (PDT) Received: from localhost.localdomain ([109.245.227.98]) by smtp.gmail.com with ESMTPSA id r15sm7593128lfp.34.2020.05.18.12.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 12:42:24 -0700 (PDT) From: Aleksandar Markovic To: qemu-devel@nongnu.org Subject: [PATCH v5 12/22] target/mips: fpu: Demacro CLASS. Date: Mon, 18 May 2020 21:41:39 +0200 Message-Id: <20200518194149.16281-13-aleksandar.qemu.devel@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518194149.16281-1-aleksandar.qemu.devel@gmail.com> References: <20200518194149.16281-1-aleksandar.qemu.devel@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::144; envelope-from=aleksandar.qemu.devel@gmail.com; helo=mail-lf1-x144.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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, 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.rikalo@syrmia.com, Aleksandar Markovic 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 --- target/mips/fpu_helper.c | 70 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/target/mips/fpu_helper.c b/target/mips/fpu_helper.c index e8e50e4bc0..b3903f5357 100644 --- a/target/mips/fpu_helper.c +++ b/target/mips/fpu_helper.c @@ -1165,10 +1165,76 @@ uint ## bits ## _t helper_float_ ## name(CPUMIPSState *env, \ return float_ ## name(arg, &env->active_fpu.fp_status); \ } -FLOAT_CLASS(class_s, 32) -FLOAT_CLASS(class_d, 64) #undef FLOAT_CLASS +uint64_t float_class_d(uint64_t arg, float_status *status) +{ + if (float64_is_signaling_nan(arg, status)) { + return FLOAT_CLASS_SIGNALING_NAN; + } else if (float64_is_quiet_nan(arg, status)) { + return FLOAT_CLASS_QUIET_NAN; + } else if (float64_is_neg(arg)) { + if (float64_is_infinity(arg)) { + return FLOAT_CLASS_NEGATIVE_INFINITY; + } else if (float64_is_zero(arg)) { + return FLOAT_CLASS_NEGATIVE_ZERO; + } else if (float64_is_zero_or_denormal(arg)) { + return FLOAT_CLASS_NEGATIVE_SUBNORMAL; + } else { + return FLOAT_CLASS_NEGATIVE_NORMAL; + } + } else { + if (float64_is_infinity(arg)) { + return FLOAT_CLASS_POSITIVE_INFINITY; + } else if (float64_is_zero(arg)) { + return FLOAT_CLASS_POSITIVE_ZERO; + } else if (float64_is_zero_or_denormal(arg)) { + return FLOAT_CLASS_POSITIVE_SUBNORMAL; + } else { + return FLOAT_CLASS_POSITIVE_NORMAL; + } + } +} + +uint64_t helper_float_class_d(CPUMIPSState *env, uint64_t arg) +{ + return float_class_d(arg, &env->active_fpu.fp_status); +} + +uint32_t float_class_s(uint32_t arg, float_status *status) +{ + if (float32_is_signaling_nan(arg, status)) { + return FLOAT_CLASS_SIGNALING_NAN; + } else if (float32_is_quiet_nan(arg, status)) { + return FLOAT_CLASS_QUIET_NAN; + } else if (float32_is_neg(arg)) { + if (float32_is_infinity(arg)) { + return FLOAT_CLASS_NEGATIVE_INFINITY; + } else if (float32_is_zero(arg)) { + return FLOAT_CLASS_NEGATIVE_ZERO; + } else if (float32_is_zero_or_denormal(arg)) { + return FLOAT_CLASS_NEGATIVE_SUBNORMAL; + } else { + return FLOAT_CLASS_NEGATIVE_NORMAL; + } + } else { + if (float32_is_infinity(arg)) { + return FLOAT_CLASS_POSITIVE_INFINITY; + } else if (float32_is_zero(arg)) { + return FLOAT_CLASS_POSITIVE_ZERO; + } else if (float32_is_zero_or_denormal(arg)) { + return FLOAT_CLASS_POSITIVE_SUBNORMAL; + } else { + return FLOAT_CLASS_POSITIVE_NORMAL; + } + } +} + +uint32_t helper_float_class_s(CPUMIPSState *env, uint32_t arg) +{ + return float_class_s(arg, &env->active_fpu.fp_status); +} + /* binary operations */ uint64_t helper_float_add_d(CPUMIPSState *env,