From nobody Thu Nov 6 06:25:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539301634983379.44152344894246; Thu, 11 Oct 2018 16:47:14 -0700 (PDT) Received: from localhost ([::1]:37582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAkfh-000559-T4 for importer@patchew.org; Thu, 11 Oct 2018 19:47:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAkar-0001oQ-Oz 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-0002JV-HV for qemu-devel@nongnu.org; Thu, 11 Oct 2018 19:42:13 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:41803) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gAkao-0002Ga-BJ for qemu-devel@nongnu.org; Thu, 11 Oct 2018 19:42:12 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 23-v6so4903914pgc.8 for ; Thu, 11 Oct 2018 16:42:09 -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.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Oct 2018 16:42:07 -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=uRAhsKb4wbHJPVgtVyUfypr8SUA1MJojDVWvlViH6F0=; b=PNK6Kren3CDGNpiVoU3puaeHBzdvw74w29AbFVRCFubyBMjs9BMwSXsJ41AHSqlUhN iL20nxVMVvZZyyY0dbpQLoZrk2anfCCz1R722E4DGfz2iTh3j++z7iovd3OHJkZ3znoT yf9LAYmpNbPk/gGi2qgBGEmCnvU0AgSEsstqQ= 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=uRAhsKb4wbHJPVgtVyUfypr8SUA1MJojDVWvlViH6F0=; b=IK7cdfXSpapAAolDbiUf3jePM7+0ZVTPHLdTINNoN8C0aw/vdht/Lb/9iowOH8Cu3f noC4NxFCxjULqoyoSQP0VqoQvD8akZL4het7sjvm2TcGUzJyKgAHDbjhSIjSY1uKYUO0 lYWs0IxdUqufmfp4WwGG6Uo6Ks6hDdv0reqa/Y9+1LUaDr+Mxt20PaPYC7o+mRXKjw8Q OFpQr0a2LM5g/JJE84Ln7KtNtVvQpSS1pf2TtbJppHT4uB43PHQy+7O7qSwl+WdwaSGA ND1UtCmmxU3H/pi5SSrNKJ2S4OBuwvsHcS3e/dVAEvd+7rNR2FShCnVMLFlGFaCEZFYb 2xlA== X-Gm-Message-State: ABuFfoiOFM9U7bth7nQUF688X213ZYXXNslQCpnKOtpU9Datyd9TQLHy 3hZ0oBoy6rVni+i8o09JwY2gQ4X9Id4= X-Google-Smtp-Source: ACcGV61eJn3SRvjpn4xnrKimnjsNwSYDntcvUiTIUeFXp5vEYLrDLjXq2tnFZ18E6DzsNaAi/Mthng== X-Received: by 2002:a62:8891:: with SMTP id l139-v6mr3596039pfd.198.1539301328502; Thu, 11 Oct 2018 16:42:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 11 Oct 2018 16:41:57 -0700 Message-Id: <20181011234159.11496-6-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::52b Subject: [Qemu-devel] [PATCH 5/7] 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: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/ppc/fpu_helper.c | 43 +++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 23 deletions(-) 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, fl= oat64 arg2) return ret; } =20 +static void float_invalid_op_mul(CPUPPCState *env, bool set_fprc, + uintptr_t retaddr, int classes) +{ + if ((classes & (is_zero | is_inf)) =3D=3D (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, fl= oat64 arg2) int status =3D get_float_exception_flags(&env->fp_status); =20 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)); } =20 return ret; @@ -1886,13 +1891,9 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ env->fp_status.float_exception_flags |=3D tstat.float_exception_fl= ags; \ = \ 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 opcod= e) env->fp_status.float_exception_flags |=3D tstat.float_exception_flags; =20 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); =20 --=20 2.17.1