From patchwork Thu Nov 8 12:16:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 150504 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp754938ljp; Thu, 8 Nov 2018 04:23:30 -0800 (PST) X-Google-Smtp-Source: AJdET5ctraAgIYDfjkyWd7fDJgDu0ftMjEHwoUZgfHyn/zmJjl23SxuRhLfxpjtRk0GlEf3qU/lh X-Received: by 2002:a37:73c4:: with SMTP id o187mr3965908qkc.157.1541679810315; Thu, 08 Nov 2018 04:23:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541679810; cv=none; d=google.com; s=arc-20160816; b=bPHXKVhHcjJ6lFZeLiES1uFAI/TRApEfaAeJ4EYGiufQ1y4xQ4NLDuUb1bTw4AJABi 2CIsEdInHrhK07Mgr1fShk4O9/nQWv4Si4CYP7NLkGS/AG82RS1unj1wxSDYavbqAQ73 OjH6cVBKu9tugDf4rdWEIQ6TVdaLpLctpa/UJiQdFI6jzAM2N3Gab0awpsBLxv6gJ/hc GWAsegPfN+Pu5flTysA22BHS+Sd0NdIFhnya6ziFOLmQRRdjJS/OTlD02JluLTkcRxgT DgdWMN7Byxn/sR8g35D50AOyrFS4JZBvhXYG8PRbpboI7yHqsNvBB6S1/1AZvvRkQs78 O1Ng== 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=hHl2dZ55VKbFDn8cjTLFMrftJ4qGuj2Ha1C82QHYJ2w=; b=moEBb0xzVY3Sn8qZmTQs9gMzDnBxnujEn5EIwgCDx799BgfeIlE1uV/XOFyV/aeMj5 aNgegiLASct0UlcbsF1MsN9YEOGO1hC7kpSCi4h13dh9x6isL/qBAwPEygaursJqaAXx sSvzT7IBY6+J3XrJnrDGqNxGInVfIaUEhhGESRHJQQ2fxs2bJOJXzcc9HtaRsGM+pCSi eS++xePPP0GqvVcCt6geaDeX/UiHu+e2EYbhvl9XNVbQjCsGidGdg8JnNcezVbeZw0vX ct+wDnqVj25kFqB8bkxvIpgAGVxMCBtRtjCqE0dxAm8lenAPi8WDzQRsZ6kbIIxsLEqv K2Ag== 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=E570JAZy; 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 q2si2497915qve.72.2018.11.08.04.23.29 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Nov 2018 04:23:30 -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=E570JAZy; 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]:56281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKjLN-0006Ph-I5 for patch@linaro.org; Thu, 08 Nov 2018 07:23:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKjFI-0005Gg-Nj 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-0003j5-Vr for qemu-devel@nongnu.org; Thu, 08 Nov 2018 07:17:12 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:38587) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gKjF9-0003aq-5H; Thu, 08 Nov 2018 07:17:04 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 42rMhz6t7Bz9sDN; 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=1541679411; bh=A9yasmUbAMHyjZjx3e23I9I/soQHZlkIHlHFmejeMn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E570JAZyUrf2hzo1JKOEMuTL5+nDl0GgKcUDou+QcTpeN7TD1gAUC2u1TEtK1BEAR FsqoxQ2h7b+8ZpkPE+BVqc14Pv3SI6r3An/5b8Pg8J2WWVV9UXQQXN2VIMhwC/L4yq HHbR0v83ns4Z+JzDY+WXSEXvLBbUrRL45mj2a/uQ= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 8 Nov 2018 23:16:34 +1100 Message-Id: <20181108121646.26173-11-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: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 10/22] target/ppc: Split out float_invalid_op_mul 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 | 43 +++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 23 deletions(-) -- 2.19.1 diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 111ce12a37..ef251d062f 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -689,6 +689,17 @@ float64 helper_fsub(CPUPPCState *env, float64 arg1, float64 arg2) return ret; } +static void float_invalid_op_mul(CPUPPCState *env, bool set_fprc, + uintptr_t retaddr, int classes) +{ + if ((classes & (is_zero | is_inf)) == (is_zero | is_inf)) { + /* Multiplication of zero by infinity */ + float_invalid_op_vximz(env, set_fprc, retaddr); + } else if (classes & is_snan) { + float_invalid_op_vxsnan(env, retaddr); + } +} + /* fmul - fmul. */ float64 helper_fmul(CPUPPCState *env, float64 arg1, float64 arg2) { @@ -696,15 +707,9 @@ float64 helper_fmul(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_zero(arg2)) || - (float64_is_zero(arg1) && float64_is_infinity(arg2))) { - /* Multiplication of zero by infinity */ - float_invalid_op_vximz(env, 1, GETPC()); - } else if (float64_is_signaling_nan(arg1, &env->fp_status) || - float64_is_signaling_nan(arg2, &env->fp_status)) { - /* sNaN multiplication */ - float_invalid_op_vxsnan(env, GETPC()); - } + float_invalid_op_mul(env, 1, GETPC(), + float64_classify(arg1) | + float64_classify(arg2)); } return ret; @@ -1886,13 +1891,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_zero(xb.fld)) || \ - (tp##_is_infinity(xb.fld) && tp##_is_zero(xa.fld))) { \ - float_invalid_op_vximz(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_mul(env, sfprf, GETPC(), \ + tp##_classify(xa.fld) | \ + tp##_classify(xb.fld)); \ } \ \ if (r2sp) { \ @@ -1933,13 +1934,9 @@ void helper_xsmulqp(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_zero(xb.f128)) || - (float128_is_infinity(xb.f128) && float128_is_zero(xa.f128))) { - float_invalid_op_vximz(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_mul(env, 1, GETPC(), + float128_classify(xa.f128) | + float128_classify(xb.f128)); } helper_compute_fprf_float128(env, xt.f128);