From patchwork Thu Oct 11 23:41:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 148696 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp85580lji; Thu, 11 Oct 2018 16:47:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV63bY155Q3n6CbZfn8VJSDby//f/4nG1K5K0X3avtj8nw4vWQSHf8+4ppTQXpLcb5hJWsKeL X-Received: by 2002:ac8:2f01:: with SMTP id j1-v6mr3571298qta.87.1539301659802; Thu, 11 Oct 2018 16:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539301659; cv=none; d=google.com; s=arc-20160816; b=ZFvjY37APA//yYoUk2J7kwXZTS/KkOid1Talc8+M3uhkuepApRVbdb9A6ur0sGKASV 65NA1oDkX4MScCIucvt/IUDTcTyYM92F0Fcwid/jLD7RPDvzAXRp8db7qBdkGkagwBih huX4EYoJQGe6LBXUevAArD6Q/onf+F7I8HgyL2br82kcbfhCfzQmDLdNkrKyl7pcrvbe /YeBMrUmLNr8Dxf15aLKlP34up+wueaKOFojqxDAyQEe2F2Vjl6n1tkTwiwe1OL+5z1Q 5r128ZY64LZjDA6/Bq/0VIz5s4N7E4livWhr97gdmDWeUvbXDIIdeNCkV2Qnn0FHTJeG 6A0A== 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:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=FKGYBm3b74Ebw4RKCZXEr3hKePvFludk+sTyBCj+v30=; b=RpvuvyLzI5K6gLXyoOceKGdG/hB/ldZZf98S4AL1e+agDgjM68kp40C3odJbYllapZ 1EqTjopwYdhDTQEXeBmXlUIlY0OdaTh7THNKPZNvLG8qmUJDgYk9xXHcVZ8Rok3C9G0T EzSCL59Crqu4wH4VnZQVqjwrRWepZvB4c8GFqNW5qGsY2nTPtKAecmg2gKV+7jVXuhSh k9QdqtSoV9JFfjwWG7hQsvXZYhqbbqjFhN1IXjhraTWtzlD4BEmwk8n3ccx+V+ScPQ9i 7J/rvzZ0BZcHQUiD/dzlbZ1GOSqs6uEpBy5GaiTn8dhCR8EjzPCyPvPilgwv2HOfE55x UGtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kTrBVSwC; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g9-v6si1558468qtj.96.2018.10.11.16.47.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 11 Oct 2018 16:47:39 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=kTrBVSwC; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAkg7-0005rp-6I for patch@linaro.org; Thu, 11 Oct 2018 19:47:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAkar-0001oP-OB for qemu-devel@nongnu.org; Thu, 11 Oct 2018 19:42:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAkaq-0002In-B9 for qemu-devel@nongnu.org; Thu, 11 Oct 2018 19:42:13 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:34585) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gAkao-0002FV-76 for qemu-devel@nongnu.org; Thu, 11 Oct 2018 19:42:10 -0400 Received: by mail-pl1-x62f.google.com with SMTP id f18-v6so4985258plr.1 for ; Thu, 11 Oct 2018 16:42:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FKGYBm3b74Ebw4RKCZXEr3hKePvFludk+sTyBCj+v30=; b=kTrBVSwCyMCJ1jDWNuGKMaQsUHqoclR8xXA6GZeFv4J+BO5CX8R8jKJ6TUBF9tmg3x 1ja9MAW3oPdD5sacoaQ0+n47xpw2Fr52CPUfw+RSo6Di1UFXUcYEEU09TLy+WY/7S9w1 CFCOEvk56RyV5Cc+rbTnDzFPaxX+K7PNBKLdU= 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=FKGYBm3b74Ebw4RKCZXEr3hKePvFludk+sTyBCj+v30=; b=mUeeZnRGda77jWpPgQO6C2E15dVdOHs0YtPQnoWd+5g7kWWqlzI2kPeRg+kfQ7I63Q btxwP93Z/f+NQUmxOqldpXRHixJcEhwMr3+1bgbB4ePNoYxQ7xOvdrTTc3vU1Lsb3tqm /XOdiCq1LkN7K8MtEw7cAWYNDMqdMRaow7CWOReUCgI/ehorY/elxLqqbT3ExcddKk4h b9zaHmEgRa18om83jeY1/EuQjWjaG0qje8PSp/xYXRo5QD4U6fV3/aeDeqs91l4jknoX jDzTTKM9+QyyUKjN0TSzwNam9yyDTnDFuGNT0ShGliVaEdSwRE5lPaE78zDBi1E1BahH 6F9A== X-Gm-Message-State: ABuFfojD3BRLmz7ZQ2j/TOftNX/a69QdX4o3EPE1OULJpqEYy5oDXhlm kbrkZaTwCik5wAQS3HIsCa3gsJXUVRI= X-Received: by 2002:a17:902:205:: with SMTP id 5-v6mr3503946plc.307.1539301327037; Thu, 11 Oct 2018 16:42:07 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id o12-v6sm12258302pgv.7.2018.10.11.16.42.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Oct 2018 16:42:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 11 Oct 2018 16:41:56 -0700 Message-Id: <20181011234159.11496-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011234159.11496-1-richard.henderson@linaro.org> References: <20181011234159.11496-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::62f Subject: [Qemu-devel] [PATCH 4/7] target/ppc: Split out float_invalid_op_addsub 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: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/ppc/fpu_helper.c | 60 ++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 34 deletions(-) -- 2.17.1 diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 9ae55b1e93..111ce12a37 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -648,6 +648,17 @@ void helper_reset_fpstatus(CPUPPCState *env) set_float_exception_flags(0, &env->fp_status); } +static void float_invalid_op_addsub(CPUPPCState *env, bool set_fpcc, + uintptr_t retaddr, int classes) +{ + if ((classes & ~is_neg) == is_inf) { + /* Magnitude subtraction of infinities */ + float_invalid_op_vxisi(env, set_fpcc, retaddr); + } else if (classes & is_snan) { + float_invalid_op_vxsnan(env, retaddr); + } +} + /* fadd - fadd. */ float64 helper_fadd(CPUPPCState *env, float64 arg1, float64 arg2) { @@ -655,14 +666,9 @@ float64 helper_fadd(CPUPPCState *env, float64 arg1, float64 arg2) int status = get_float_exception_flags(&env->fp_status); if (unlikely(status & float_flag_invalid)) { - if (float64_is_infinity(arg1) && float64_is_infinity(arg2)) { - /* Magnitude subtraction of infinities */ - float_invalid_op_vxisi(env, 1, GETPC()); - } else if (float64_is_signaling_nan(arg1, &env->fp_status) || - float64_is_signaling_nan(arg2, &env->fp_status)) { - /* sNaN addition */ - float_invalid_op_vxsnan(env, GETPC()); - } + float_invalid_op_addsub(env, 1, GETPC(), + float64_classify(arg1) | + float64_classify(arg2)); } return ret; @@ -675,14 +681,9 @@ float64 helper_fsub(CPUPPCState *env, float64 arg1, float64 arg2) int status = get_float_exception_flags(&env->fp_status); if (unlikely(status & float_flag_invalid)) { - if (float64_is_infinity(arg1) && float64_is_infinity(arg2)) { - /* Magnitude subtraction of infinities */ - float_invalid_op_vxisi(env, 1, GETPC()); - } else if (float64_is_signaling_nan(arg1, &env->fp_status) || - float64_is_signaling_nan(arg2, &env->fp_status)) { - /* sNaN addition */ - float_invalid_op_vxsnan(env, GETPC()); - } + float_invalid_op_addsub(env, 1, GETPC(), + float64_classify(arg1) | + float64_classify(arg2)); } return ret; @@ -1803,12 +1804,9 @@ void helper_##name(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_vxisi(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_addsub(env, sfprf, GETPC(), \ + tp##_classify(xa.fld) | \ + tp##_classify(xb.fld)); \ } \ \ if (r2sp) { \ @@ -1852,12 +1850,9 @@ void helper_xsaddqp(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_vxisi(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_addsub(env, 1, GETPC(), + float128_classify(xa.f128) | + float128_classify(xb.f128)); } helper_compute_fprf_float128(env, xt.f128); @@ -3518,12 +3513,9 @@ void helper_xssubqp(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_vxisi(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_addsub(env, 1, GETPC(), + float128_classify(xa.f128) | + float128_classify(xb.f128)); } helper_compute_fprf_float128(env, xt.f128);