From nobody Tue Apr 30 17:44:17 2024 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=gmail.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529250899813507.7210806392527; Sun, 17 Jun 2018 08:54:59 -0700 (PDT) Received: from localhost ([::1]:55623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUa0w-0003Ei-8I for importer@patchew.org; Sun, 17 Jun 2018 11:54:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUZzc-0002eb-58 for qemu-devel@nongnu.org; Sun, 17 Jun 2018 11:53:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUZzY-0001nE-8s for qemu-devel@nongnu.org; Sun, 17 Jun 2018 11:53:28 -0400 Received: from mail-it0-x242.google.com ([2607:f8b0:4001:c0b::242]:34088) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fUZzY-0001mR-3E; Sun, 17 Jun 2018 11:53:24 -0400 Received: by mail-it0-x242.google.com with SMTP id y127-v6so9484329itd.1; Sun, 17 Jun 2018 08:53:23 -0700 (PDT) Received: from localhost.localdomain ([69.14.184.20]) by smtp.gmail.com with ESMTPSA id r200-v6sm3267757ita.24.2018.06.17.08.53.21 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 17 Jun 2018 08:53:21 -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; bh=dC7t7jumLfRCVsIM1KvqvVNOQmhc/1T6QtPEANXCK6w=; b=OLtlttqzWfA8DugWVpYRpcBX91TLb+oLxpRH3Z0c55/Scjst7MIfhuyIeJsOgmc/Wn ULJwZ4HQ+/1WUiYsVAQFQxJGpAN+u5f+gxBmsolfsa7DPmvJfZQNYjfhUfieE/GHcWYd Vb+Z4SakTFASsILQXNjantPPICR+nu+S43sMSbFqELFrqSXnR2IGVxpZaEPNFaRvahTV 9odwbWHSeWGNnzEbwuIt10/w1t/aLRwtNyGqdiGR8afhUf/7VHMRUkTeAZwEFU7g5WtG /kco01b8JR2kv3YbDr/hCPuF6BDn+z3GlkGcv6CkAkPhugv22i0RjRcGeRQDTFQanudU OiAg== 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; bh=dC7t7jumLfRCVsIM1KvqvVNOQmhc/1T6QtPEANXCK6w=; b=aXEOiu+ZhmXe5jEJ3C5vhpr68xi7Ss1BErwlndOaWRf3d0k5tjYxsVeWp5FS5RNmZq EIdXnwPzcASstmZ8M18jF8qa2DIMp4UONcn9pxMnCtdDKDKw28lwCyjt9Rf0kBW3iLfA cKUGknazd7jYNhki3PppfEYdIpxbiZNChuWUZwcUBvxtId9zxGRpMilyA8gBmPX1rv3b rZ/RXBhYpffqQJZ37wabQxSS7QA0cdosoXcZQXxT1kNzVz87orGPDAWe/M7OLthfdVn3 C1m7Bs1uC6wmf+6FFvUeRvrnleTti83na94Ogy6YP+1OE8UhWmdjsD/E0+3r9wIGdYR2 Fugw== X-Gm-Message-State: APt69E3Ws4Aq8e7y4ffNMuKa2JlVKZd9NLMJRJEC7oGUiQJjp0wkbAMx fnOmlgZ0OycEmlDXYMhRnb8= X-Google-Smtp-Source: ADUXVKIB22D0PBSf1Uq3Eboduw/bulEx7AlXPknzZeJwi+7WFpzQgsS8ONSNbwdsj9QyrHEF5e76hg== X-Received: by 2002:a24:4042:: with SMTP id n63-v6mr7024942ita.122.1529250802857; Sun, 17 Jun 2018 08:53:22 -0700 (PDT) From: John Arbuckle To: peter.maydell@linaro.org, qemu-devel@nongnu.org, aurelien@aurel32.net, david@gibson.dropbear.id.au, agraf@suse.de, qemu-ppc@nongnu.org Date: Sun, 17 Jun 2018 11:53:09 -0400 Message-Id: <20180617155309.1653-1-programmingkidx@gmail.com> X-Mailer: git-send-email 2.14.3 (Apple Git-98) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::242 Subject: [Qemu-devel] [PATCH] fpu_helper.c: fix helper_fpscr_clrbit() function 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: John Arbuckle Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fix the helper_fpscr_clrbit() function so it correctly sets the FEX and VX bits. Signed-off-by: John Arbuckle --- target/ppc/fpu_helper.c | 57 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 57 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index d31a933cbb..7e697a11d0 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -325,6 +325,63 @@ void helper_fpscr_clrbit(CPUPPCState *env, uint32_t bi= t) case FPSCR_RN: fpscr_set_rounding_mode(env); break; + case FPSCR_VXSNAN: + case FPSCR_VXISI: + case FPSCR_VXIDI: + case FPSCR_VXZDZ: + case FPSCR_VXIMZ: + case FPSCR_VXVC: + case FPSCR_VXSOFT: + case FPSCR_VXSQRT: + case FPSCR_VXCVI: + { + int vxsnan, vxisi, vxidi, vxzdz, vximz, vxvc, vxsoft, vxsqrt, = vxcvi; + vxsnan =3D (env->fpscr >> (31 - FPSCR_VXSNAN)) & 1; + vxisi =3D (env->fpscr >> (31 - FPSCR_VXISI)) & 1; + vxidi =3D (env->fpscr >> (31 - FPSCR_VXIDI)) & 1; + vxzdz =3D (env->fpscr >> (31 - FPSCR_VXZDZ)) & 1; + vximz =3D (env->fpscr >> (31 - FPSCR_VXIMZ)) & 1; + vxvc =3D (env->fpscr >> (31 - FPSCR_VXVC)) & 1; + vxsoft =3D (env->fpscr >> (31 - FPSCR_VXSOFT)) & 1; + vxsqrt =3D (env->fpscr >> (31 - FPSCR_VXSQRT)) & 1; + vxcvi =3D (env->fpscr >> (31 - FPSCR_VXCVI)) & 1; + if (~(vxsnan & vxisi & vxidi & vxzdz & vximz & vxvc & vxsoft & + vxsqrt & vxcvi)) { + /* Set VX bit to zero */ + env->fpscr =3D env->fpscr & ~(1 << FPSCR_VX); + } + } + break; + case FPSCR_VX: + case FPSCR_OX: + case FPSCR_UX: + case FPSCR_ZX: + case FPSCR_XX: + case FPSCR_VE: + case FPSCR_OE: + case FPSCR_UE: + case FPSCR_ZE: + case FPSCR_XE: + { + int vx, ox, ux, zx, xx, ve, oe, ue, ze, xe; + vx =3D (env->fpscr >> (31 - FPSCR_VX)) & 1; + ox =3D (env->fpscr >> (31 - FPSCR_OX)) & 1; + ux =3D (env->fpscr >> (31 - FPSCR_UX)) & 1; + zx =3D (env->fpscr >> (31 - FPSCR_ZX)) & 1; + xx =3D (env->fpscr >> (31 - FPSCR_XX)) & 1; + ve =3D (env->fpscr >> (31 - FPSCR_VE)) & 1; + oe =3D (env->fpscr >> (31 - FPSCR_OE)) & 1; + ue =3D (env->fpscr >> (31 - FPSCR_UE)) & 1; + ze =3D (env->fpscr >> (31 - FPSCR_ZE)) & 1; + xe =3D (env->fpscr >> (31 - FPSCR_XE)) & 1; + bool fex; + fex =3D (vx & ve) | (ox & oe) | (ux & ue) | (zx & ze) | (xx & = xe); + unsigned int mask; + mask =3D (1 << FPSCR_FEX); + /* Set the FEX bit */ + env->fpscr =3D (env->fpscr & ~mask) | (-fex & mask); + } + break; default: break; } --=20 2.14.3 (Apple Git-98)