From patchwork Thu Nov 8 12:16:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 150506 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp757711ljp; Thu, 8 Nov 2018 04:26:38 -0800 (PST) X-Google-Smtp-Source: AJdET5d/6+3+UIJDQMpxWQ6+cORzZh75sp/MTGoyNJZ0c/oIt6KrSLSv+drMOne7eyFmzBxu0PXh X-Received: by 2002:a0c:89b4:: with SMTP id 49mr4123142qvr.85.1541679998539; Thu, 08 Nov 2018 04:26:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541679998; cv=none; d=google.com; s=arc-20160816; b=gE0FtAvbpPDijVD2bTZlQIjq/rNnkkOnFcVp7fUrO5J5DDKUjlE+q6CNrf+tJNBZgS OrtH44IhpsJEmvoRFii7CpEFC1oaHnh/EkPSwzMPx2dA+3TMGV4kXsxlHWxQX9no3CZz nFZoaxctAu9sWzK4WCF9Gw+tLwse2EgdizEzD7zgjnadFw8s87RaMR5EqNnyu2YkUixw mi3KO7HsBrFgIAiNPkUYrfR7nQT5e+PRZ36h67P5cH190romSOI2Id6VRpKE6prV5Sr0 Ff6g4Egbyh2D9HeWd2S2p5sp+1ar6hBq2gLqG2vrBddnVdmfF+apbzzzSwyyTWpQT7iA t5eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=/hfgQ1tyV4z5msZs4MhvYwweXZYmFwZgIQNQVS2LEIk=; b=PIMiwNwt4oLq3zs21bCEG+uhzNXsSEypD7PmonaNU/T9SJ/C7s2izPuYI9aWbvzV+P dSJco9jf2l9C1YLqdrJ53ZFb2VO/Np4jVhlSY0P9TPMNV9BCmC9gJiywtvl698h6vLpP acnrhdcc1z16+pIOd/gT/X06XeT5TFL8uSEjjB/J6U6yNKlS7Nwxt1pXELQ4AKx2J2OZ EDngx7K0hMkf9Xj1NZa6nJAkEgNRl5mefCo3D6ZIsAo+9MBYk0gnphM1NhSEQCtvew/X 1FppTpFUcD5HbRPGnbNBhkNFqhzayZvWZ3LWNEMy4WpWgAfn45eMwkQoH7dfaBnoIwGr 5haw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gibson.dropbear.id.au header.s=201602 header.b=TaCScD6m; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r1si1207880qkk.116.2018.11.08.04.26.38 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Nov 2018 04:26:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gibson.dropbear.id.au header.s=201602 header.b=TaCScD6m; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:56303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKjOP-0000uk-U0 for patch@linaro.org; Thu, 08 Nov 2018 07:26:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKjFI-0005Ge-Mx for qemu-devel@nongnu.org; Thu, 08 Nov 2018 07:17:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gKjFF-0003ip-V2 for qemu-devel@nongnu.org; Thu, 08 Nov 2018 07:17:12 -0500 Received: from ozlabs.org ([203.11.71.1]:50525) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gKjF9-0003aj-32; Thu, 08 Nov 2018 07:17:04 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 42rMj03d8Sz9sDL; Thu, 8 Nov 2018 23:16:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1541679412; bh=9Ghs4VDqjT0LmDD+Kg69o+dW1vEFBTpBw5cMo2oSpn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TaCScD6mixbICuyU/TdOohKublI+qg7OqpwWZlDRPki2BneLnE0vPB6Pb+dX20mIP G1eFmur38IHDbOSl/hxoQd7ApbzEZUsJAhSIw0Cx03YXgjIbvrv8W+JVCZm1EPdUHC 9rHDkg3SivWqvCiKtkMOcA4VGVIpGNtIaS4Loupo= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 8 Nov 2018 23:16:35 +1100 Message-Id: <20181108121646.26173-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108121646.26173-1-david@gibson.dropbear.id.au> References: <20181108121646.26173-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 11/22] target/ppc: Split out float_invalid_op_div 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: lvivier@redhat.com, Richard Henderson , agraf@suse.de, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 52 +++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 28 deletions(-) -- 2.19.1 diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index ef251d062f..127c08bcec 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -715,6 +715,21 @@ float64 helper_fmul(CPUPPCState *env, float64 arg1, float64 arg2) return ret; } +static void float_invalid_op_div(CPUPPCState *env, bool set_fprc, + uintptr_t retaddr, int classes) +{ + classes &= ~is_neg; + if (classes == is_inf) { + /* Division of infinity by infinity */ + float_invalid_op_vxidi(env, set_fprc, retaddr); + } else if (classes == is_zero) { + /* Division of zero by zero */ + float_invalid_op_vxzdz(env, set_fprc, retaddr); + } else if (classes & is_snan) { + float_invalid_op_vxsnan(env, retaddr); + } +} + /* fdiv - fdiv. */ float64 helper_fdiv(CPUPPCState *env, float64 arg1, float64 arg2) { @@ -723,18 +738,9 @@ float64 helper_fdiv(CPUPPCState *env, float64 arg1, float64 arg2) if (unlikely(status)) { if (status & float_flag_invalid) { - /* Determine what kind of invalid operation was seen. */ - if (float64_is_infinity(arg1) && float64_is_infinity(arg2)) { - /* Division of infinity by infinity */ - float_invalid_op_vxidi(env, 1, GETPC()); - } else if (float64_is_zero(arg1) && float64_is_zero(arg2)) { - /* Division of zero by zero */ - float_invalid_op_vxzdz(env, 1, GETPC()); - } else if (float64_is_signaling_nan(arg1, &env->fp_status) || - float64_is_signaling_nan(arg2, &env->fp_status)) { - /* sNaN division */ - float_invalid_op_vxsnan(env, GETPC()); - } + float_invalid_op_div(env, 1, GETPC(), + float64_classify(arg1) | + float64_classify(arg2)); } if (status & float_flag_divbyzero) { float_zero_divide_excp(env, GETPC()); @@ -1969,14 +1975,9 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) \ env->fp_status.float_exception_flags |= tstat.float_exception_flags; \ \ if (unlikely(tstat.float_exception_flags & float_flag_invalid)) { \ - if (tp##_is_infinity(xa.fld) && tp##_is_infinity(xb.fld)) { \ - float_invalid_op_vxidi(env, sfprf, GETPC()); \ - } else if (tp##_is_zero(xa.fld) && tp##_is_zero(xb.fld)) { \ - float_invalid_op_vxzdz(env, sfprf, GETPC()); \ - } else if (tp##_is_signaling_nan(xa.fld, &tstat) || \ - tp##_is_signaling_nan(xb.fld, &tstat)) { \ - float_invalid_op_vxsnan(env, GETPC()); \ - } \ + float_invalid_op_div(env, sfprf, GETPC(), \ + tp##_classify(xa.fld) | \ + tp##_classify(xb.fld)); \ } \ if (unlikely(tstat.float_exception_flags & float_flag_divbyzero)) { \ float_zero_divide_excp(env, GETPC()); \ @@ -2020,14 +2021,9 @@ void helper_xsdivqp(CPUPPCState *env, uint32_t opcode) env->fp_status.float_exception_flags |= tstat.float_exception_flags; if (unlikely(tstat.float_exception_flags & float_flag_invalid)) { - if (float128_is_infinity(xa.f128) && float128_is_infinity(xb.f128)) { - float_invalid_op_vxidi(env, 1, GETPC()); - } else if (float128_is_zero(xa.f128) && float128_is_zero(xb.f128)) { - float_invalid_op_vxzdz(env, 1, GETPC()); - } else if (float128_is_signaling_nan(xa.f128, &tstat) || - float128_is_signaling_nan(xb.f128, &tstat)) { - float_invalid_op_vxsnan(env, GETPC()); - } + float_invalid_op_div(env, 1, GETPC(), + float128_classify(xa.f128) | + float128_classify(xb.f128)); } if (unlikely(tstat.float_exception_flags & float_flag_divbyzero)) { float_zero_divide_excp(env, GETPC());