From patchwork Thu May 14 19:20:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandar Markovic X-Patchwork-Id: 11549621 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53556913 for ; Thu, 14 May 2020 19:28:09 +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 29A7B20643 for ; Thu, 14 May 2020 19:28:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lJ969b/l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29A7B20643 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:58844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZJWa-0001R1-7Z for patchwork-qemu-devel@patchwork.kernel.org; Thu, 14 May 2020 15:28:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZJQ5-0007JC-2c for qemu-devel@nongnu.org; Thu, 14 May 2020 15:21:30 -0400 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]:46236) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZJQ4-0007Nr-Af for qemu-devel@nongnu.org; Thu, 14 May 2020 15:21:24 -0400 Received: by mail-lf1-x143.google.com with SMTP id v5so3577242lfp.13 for ; Thu, 14 May 2020 12:21:23 -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=w2OdNVDRCHhqd+l8vRPrEWsQJ/Qc25fF1W1YvWmwiFQ=; b=lJ969b/lI9kFev/pKB2MgWKT9ZNfA12z1m2ZrzwPbCRdKjFxK7pE7moauLxLrFGwNg 2mcz0O+Y1xUl71GnDmacIaKwUfixfLC9JLEwlSCdAz+otTZcoGXTxnKEgEQkz55LRvZ/ oWVg2xKeh+rRheFPDjwmM8HQ/SpRIUOOin3cend6ezfrsR28bjRWwKLMwG5egcO8x0IH f/u4+k4KCQfa34g+pUGi6faNde5qEvckpBYTnMFFEvfnNhbZeqipDfoZRpO/pz4nn8qQ uIU4Oi/ZbbI1/DOGmwWctfmKN6TzVXwvo/tLgb9QlErs1SCAm4oM+3Jdxd6AXK+6l9Ww BiJA== 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=w2OdNVDRCHhqd+l8vRPrEWsQJ/Qc25fF1W1YvWmwiFQ=; b=QMl0aH4DlIY02AcliixBNa5eBxWRDgSx+ozzwzBJUsENcpIWkiroED7j9iK/ZhvA9l cfCWpH27NTxRpWfE5VHCmU43YBp+FHjPDFelJW4f6OlZH+2DUUr4JItGknvCr66w8QY0 SO+jgR1RTuXwGH1QQnx9hdm9mQOJdgenFPGQvX1y1plk+44vs9oF1mkrD9ZsbbECsFnv cvfdd3R8p23rh+GFT6qiq+T0HO45EP6ccMWT0mt25YvROWE4bw/ErOzhZB3+UxF3NDpH Gjrr90wQKzhC9nF/9M5RPeJWM1ixAT2QVcjIKwg0UB7FrYAQUUFXNQFvcmt/QCUdODKL TIxA== X-Gm-Message-State: AOAM532iz6w2CHYS+Vr4BPz4EDaYSS0Y2YOqcU08q4S5j6LYc1zoVaHF FuXZGXmOHGKQNBBoMB+rAhWCPWfngtc= X-Google-Smtp-Source: ABdhPJzPvTWaGVvn/vm9kNMvGNFoG/sfYJASrAfsxMFKu3XMn7wfnvGXzBB0lCKV5TT06diD0TEAVw== X-Received: by 2002:a19:c88e:: with SMTP id y136mr484239lff.78.1589484082589; Thu, 14 May 2020 12:21:22 -0700 (PDT) Received: from localhost.localdomain ([109.245.227.98]) by smtp.gmail.com with ESMTPSA id h3sm2427257lfk.3.2020.05.14.12.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:21:22 -0700 (PDT) From: Aleksandar Markovic To: qemu-devel@nongnu.org Subject: [PATCH v2 11/17] target/mips: fpu: Demacro CLASS. Date: Thu, 14 May 2020 21:20:41 +0200 Message-Id: <20200514192047.5297-12-aleksandar.qemu.devel@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514192047.5297-1-aleksandar.qemu.devel@gmail.com> References: <20200514192047.5297-1-aleksandar.qemu.devel@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::143; envelope-from=aleksandar.qemu.devel@gmail.com; helo=mail-lf1-x143.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: aleksandar.rikalo@rt-rk.com, Aleksandar Markovic Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.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. 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,