From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148788192872720.355454246174077; Thu, 23 Feb 2017 12:32:08 -0800 (PST) Received: from localhost ([::1]:60896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch03b-0007UB-4G for importer@patchew.org; Thu, 23 Feb 2017 15:32:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVj-0005GV-8z for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVf-0001iZ-8l for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:07 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42477) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVf-0001i1-0C for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:03 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJrc1Z112040 for ; Thu, 23 Feb 2017 14:57:01 -0500 Received: from e28smtp04.in.ibm.com (e28smtp04.in.ibm.com [125.16.236.4]) by mx0a-001b2d01.pphosted.com with ESMTP id 28t4yqkq43-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:01 -0500 Received: from localhost by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:26:57 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp04.in.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:26:55 +0530 Received: from d28relay08.in.ibm.com (d28relay08.in.ibm.com [9.184.220.159]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 5B18C125805E; Fri, 24 Feb 2017 01:27:03 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay08.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJtpk38061160; Fri, 24 Feb 2017 01:25:51 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJusIQ024558; Fri, 24 Feb 2017 01:26:54 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVI024530; Fri, 24 Feb 2017 01:26:53 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:26 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17022319-0012-0000-0000-000003BDB46E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0013-0000-0000-00001B40BBFC Message-Id: <1487879800-12352-2-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v4 01/15] target/ppc: introduce helper_update_ov_legacy 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Removes duplicate code and will be useful for consolidating flags Signed-off-by: Nikunj A Dadhania --- target/ppc/int_helper.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index dd0a892..da4e1a6 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -28,6 +28,15 @@ /*************************************************************************= ****/ /* Fixed point operations helpers */ =20 +static inline void helper_update_ov_legacy(CPUPPCState *env, int ov) +{ + if (unlikely(ov)) { + env->so =3D env->ov =3D 1; + } else { + env->ov =3D 0; + } +} + target_ulong helper_divweu(CPUPPCState *env, target_ulong ra, target_ulong= rb, uint32_t oe) { @@ -49,11 +58,7 @@ target_ulong helper_divweu(CPUPPCState *env, target_ulon= g ra, target_ulong rb, } =20 if (oe) { - if (unlikely(overflow)) { - env->so =3D env->ov =3D 1; - } else { - env->ov =3D 0; - } + helper_update_ov_legacy(env, overflow); } =20 return (target_ulong)rt; @@ -81,11 +86,7 @@ target_ulong helper_divwe(CPUPPCState *env, target_ulong= ra, target_ulong rb, } =20 if (oe) { - if (unlikely(overflow)) { - env->so =3D env->ov =3D 1; - } else { - env->ov =3D 0; - } + helper_update_ov_legacy(env, overflow); } =20 return (target_ulong)rt; @@ -105,11 +106,7 @@ uint64_t helper_divdeu(CPUPPCState *env, uint64_t ra, = uint64_t rb, uint32_t oe) } =20 if (oe) { - if (unlikely(overflow)) { - env->so =3D env->ov =3D 1; - } else { - env->ov =3D 0; - } + helper_update_ov_legacy(env, overflow); } =20 return rt; @@ -127,12 +124,7 @@ uint64_t helper_divde(CPUPPCState *env, uint64_t rau, = uint64_t rbu, uint32_t oe) } =20 if (oe) { - - if (unlikely(overflow)) { - env->so =3D env->ov =3D 1; - } else { - env->ov =3D 0; - } + helper_update_ov_legacy(env, overflow); } =20 return rt; --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487882633365961.546544468442; Thu, 23 Feb 2017 12:43:53 -0800 (PST) Received: from localhost ([::1]:60975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch0Ex-0003OA-UF for importer@patchew.org; Thu, 23 Feb 2017 15:43:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVj-0005Gh-Ak for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVf-0001iX-8S for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:07 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:32889) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVf-0001i2-05 for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:03 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJtFFT061362 for ; Thu, 23 Feb 2017 14:57:01 -0500 Received: from e28smtp01.in.ibm.com (e28smtp01.in.ibm.com [125.16.236.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 28sp4jsshj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:01 -0500 Received: from localhost by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:26:58 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp01.in.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:26:56 +0530 Received: from d28relay10.in.ibm.com (d28relay10.in.ibm.com [9.184.220.161]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id C66A5E005A; Fri, 24 Feb 2017 01:28:35 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay10.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJtp4T16842828; Fri, 24 Feb 2017 01:25:51 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJusK5024582; Fri, 24 Feb 2017 01:26:55 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVJ024530; Fri, 24 Feb 2017 01:26:54 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:27 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022319-7323-0000-0000-000000CAB955 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-7324-0000-0000-0000026CC132 Message-Id: <1487879800-12352-3-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v4 02/15] target/ppc: update ov flag from remaining paths 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: 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: Nikunj A Dadhania --- target/ppc/int_helper.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index da4e1a6..b376860 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -320,22 +320,24 @@ target_ulong helper_divo(CPUPPCState *env, target_ulo= ng arg1, target_ulong arg2) { uint64_t tmp =3D (uint64_t)arg1 << 32 | env->spr[SPR_MQ]; + int ov; =20 if (((int32_t)tmp =3D=3D INT32_MIN && (int32_t)arg2 =3D=3D (int32_t)-1= ) || (int32_t)arg2 =3D=3D 0) { - env->so =3D env->ov =3D 1; + ov =3D 1; env->spr[SPR_MQ] =3D 0; return INT32_MIN; } else { env->spr[SPR_MQ] =3D tmp % arg2; tmp /=3D (int32_t)arg2; if ((int32_t)tmp !=3D tmp) { - env->so =3D env->ov =3D 1; + ov =3D 1; } else { - env->ov =3D 0; + ov =3D 0; } return tmp; } + helper_update_ov_legacy(env, ov); } =20 target_ulong helper_divs(CPUPPCState *env, target_ulong arg1, @@ -356,11 +358,11 @@ target_ulong helper_divso(CPUPPCState *env, target_ul= ong arg1, { if (((int32_t)arg1 =3D=3D INT32_MIN && (int32_t)arg2 =3D=3D (int32_t)-= 1) || (int32_t)arg2 =3D=3D 0) { - env->so =3D env->ov =3D 1; + helper_update_ov_legacy(env, 1); env->spr[SPR_MQ] =3D 0; return INT32_MIN; } else { - env->ov =3D 0; + helper_update_ov_legacy(env, 0); env->spr[SPR_MQ] =3D (int32_t)arg1 % (int32_t)arg2; return (int32_t)arg1 / (int32_t)arg2; } --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487880350321496.4256672249235; Thu, 23 Feb 2017 12:05:50 -0800 (PST) Received: from localhost ([::1]:60743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgze8-00057j-RR for importer@patchew.org; Thu, 23 Feb 2017 15:05:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVk-0005JT-1Q for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVh-0001jl-BC for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:08 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:56900) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVh-0001jC-2u for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:05 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJrbcY051262 for ; Thu, 23 Feb 2017 14:57:04 -0500 Received: from e28smtp02.in.ibm.com (e28smtp02.in.ibm.com [125.16.236.2]) by mx0a-001b2d01.pphosted.com with ESMTP id 28t61r0t18-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:03 -0500 Received: from localhost by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:26:59 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp02.in.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:26:56 +0530 Received: from d28relay06.in.ibm.com (d28relay06.in.ibm.com [9.184.220.150]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 4E706E0024; Fri, 24 Feb 2017 01:28:36 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay06.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJuuEb10616916; Fri, 24 Feb 2017 01:26:56 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJuttN024611; Fri, 24 Feb 2017 01:26:56 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVK024530; Fri, 24 Feb 2017 01:26:54 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:28 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022319-0004-0000-0000-00000542B845 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0005-0000-0000-0000133CC04F Message-Id: <1487879800-12352-4-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v4 03/15] target/ppc: introduce helper_update_ca_legacy 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Update the environment carry variable in the helper. Signed-off-by: Nikunj A Dadhania --- target/ppc/int_helper.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index b376860..d7af671 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -37,6 +37,11 @@ static inline void helper_update_ov_legacy(CPUPPCState *= env, int ov) } } =20 +static inline void helper_update_ca(CPUPPCState *env, int ca) +{ + env->ca =3D ca; +} + target_ulong helper_divweu(CPUPPCState *env, target_ulong ra, target_ulong= rb, uint32_t oe) { @@ -213,24 +218,26 @@ target_ulong helper_sraw(CPUPPCState *env, target_ulo= ng value, target_ulong shift) { int32_t ret; + int ca; =20 if (likely(!(shift & 0x20))) { if (likely((uint32_t)shift !=3D 0)) { shift &=3D 0x1f; ret =3D (int32_t)value >> shift; if (likely(ret >=3D 0 || (value & ((1 << shift) - 1)) =3D=3D 0= )) { - env->ca =3D 0; + ca =3D 0; } else { - env->ca =3D 1; + ca =3D 1; } } else { ret =3D (int32_t)value; - env->ca =3D 0; + ca =3D 0; } } else { ret =3D (int32_t)value >> 31; - env->ca =3D (ret !=3D 0); + ca =3D (ret !=3D 0); } + helper_update_ca(env, ca); return (target_long)ret; } =20 @@ -239,24 +246,26 @@ target_ulong helper_srad(CPUPPCState *env, target_ulo= ng value, target_ulong shift) { int64_t ret; + int ca; =20 if (likely(!(shift & 0x40))) { if (likely((uint64_t)shift !=3D 0)) { shift &=3D 0x3f; ret =3D (int64_t)value >> shift; if (likely(ret >=3D 0 || (value & ((1ULL << shift) - 1)) =3D= =3D 0)) { - env->ca =3D 0; + ca =3D 0; } else { - env->ca =3D 1; + ca =3D 1; } } else { ret =3D (int64_t)value; - env->ca =3D 0; + ca =3D 0; } } else { ret =3D (int64_t)value >> 63; - env->ca =3D (ret !=3D 0); + ca =3D (ret !=3D 0); } + helper_update_ca(env, ca); return ret; } #endif --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487883118019167.14270755225914; Thu, 23 Feb 2017 12:51:58 -0800 (PST) Received: from localhost ([::1]:32793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch0Mm-0001Dy-Pc for importer@patchew.org; Thu, 23 Feb 2017 15:51:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVl-0005Mb-JI for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVh-0001js-CK for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:09 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37981) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVh-0001jE-3K for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:05 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJshXZ009646 for ; Thu, 23 Feb 2017 14:57:04 -0500 Received: from e28smtp02.in.ibm.com (e28smtp02.in.ibm.com [125.16.236.2]) by mx0a-001b2d01.pphosted.com with ESMTP id 28t6050x9v-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:03 -0500 Received: from localhost by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:00 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp02.in.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:26:57 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 210F1E005A; Fri, 24 Feb 2017 01:28:37 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay05.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJusTd11993270; Fri, 24 Feb 2017 01:26:54 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJuu7t024635; Fri, 24 Feb 2017 01:26:56 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVL024530; Fri, 24 Feb 2017 01:26:55 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:29 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022319-0004-0000-0000-00000542B84A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0005-0000-0000-0000133CC051 Message-Id: <1487879800-12352-5-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v4 04/15] target/ppc: add gen_op_update_ca_legacy() helper 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Update cpu_ca using the helper routine. This will help in consolidating xer flags code Signed-off-by: Nikunj A Dadhania --- target/ppc/translate.c | 91 ++++++++++++++++++++++++++++++++++------------= ---- 1 file changed, 63 insertions(+), 28 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index b09e16f..ae7b43d 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -792,6 +792,11 @@ static void gen_cmpb(DisasContext *ctx) =20 /*** Integer arithmetic = ***/ =20 +static inline void gen_op_update_ca_legacy(TCGv ca) +{ + tcg_gen_mov_tl(cpu_ca, ca); +} + static inline void gen_op_arith_compute_ov(DisasContext *ctx, TCGv arg0, TCGv arg1, TCGv arg2, int sub) { @@ -818,11 +823,16 @@ static inline void gen_op_arith_add(DisasContext *ctx= , TCGv ret, TCGv arg1, bool compute_ov, bool compute_rc0) { TCGv t0 =3D ret; + TCGv ca =3D tcg_temp_new(); =20 if (compute_ca || compute_ov) { t0 =3D tcg_temp_new(); } =20 + if (add_ca) { + tcg_gen_mov_tl(ca, cpu_ca); + } + if (compute_ca) { if (NARROW_MODE(ctx)) { /* Caution: a non-obvious corner case of the spec is that we @@ -832,32 +842,34 @@ static inline void gen_op_arith_add(DisasContext *ctx= , TCGv ret, TCGv arg1, tcg_gen_xor_tl(t1, arg1, arg2); /* add without carry */ tcg_gen_add_tl(t0, arg1, arg2); if (add_ca) { - tcg_gen_add_tl(t0, t0, cpu_ca); + tcg_gen_add_tl(t0, t0, ca); } - tcg_gen_xor_tl(cpu_ca, t0, t1); /* bits changed w/ carr= y */ + tcg_gen_xor_tl(ca, t0, t1); /* bits changed w/ carry */ tcg_temp_free(t1); - tcg_gen_shri_tl(cpu_ca, cpu_ca, 32); /* extract bit 32 */ - tcg_gen_andi_tl(cpu_ca, cpu_ca, 1); + tcg_gen_extract_tl(ca, ca, 32, 1); } else { TCGv zero =3D tcg_const_tl(0); if (add_ca) { - tcg_gen_add2_tl(t0, cpu_ca, arg1, zero, cpu_ca, zero); - tcg_gen_add2_tl(t0, cpu_ca, t0, cpu_ca, arg2, zero); + tcg_gen_add2_tl(t0, ca, arg1, zero, ca, zero); + tcg_gen_add2_tl(t0, ca, t0, ca, arg2, zero); } else { - tcg_gen_add2_tl(t0, cpu_ca, arg1, zero, arg2, zero); + tcg_gen_add2_tl(t0, ca, arg1, zero, arg2, zero); } tcg_temp_free(zero); } } else { tcg_gen_add_tl(t0, arg1, arg2); if (add_ca) { - tcg_gen_add_tl(t0, t0, cpu_ca); + tcg_gen_add_tl(t0, t0, ca); } } =20 if (compute_ov) { gen_op_arith_compute_ov(ctx, t0, arg1, arg2, 0); } + if (compute_ca) { + gen_op_update_ca_legacy(ca); + } if (unlikely(compute_rc0)) { gen_set_Rc0(ctx, t0); } @@ -866,6 +878,7 @@ static inline void gen_op_arith_add(DisasContext *ctx, = TCGv ret, TCGv arg1, tcg_gen_mov_tl(ret, t0); tcg_temp_free(t0); } + tcg_temp_free(ca); } /* Add functions with two operands */ #define GEN_INT_ARITH_ADD(name, opc3, add_ca, compute_ca, compute_ov) = \ @@ -1327,10 +1340,14 @@ static inline void gen_op_arith_subf(DisasContext *= ctx, TCGv ret, TCGv arg1, bool compute_ov, bool compute_rc0) { TCGv t0 =3D ret; + TCGv ca =3D tcg_temp_new(); =20 if (compute_ca || compute_ov) { t0 =3D tcg_temp_new(); } + if (add_ca) { + tcg_gen_extract_tl(ca, cpu_xer, XER_CA_BIT, 1); + } =20 if (compute_ca) { /* dest =3D ~arg1 + arg2 [+ ca]. */ @@ -1342,34 +1359,33 @@ static inline void gen_op_arith_subf(DisasContext *= ctx, TCGv ret, TCGv arg1, TCGv t1 =3D tcg_temp_new(); tcg_gen_not_tl(inv1, arg1); if (add_ca) { - tcg_gen_add_tl(t0, arg2, cpu_ca); + tcg_gen_add_tl(t0, arg2, ca); } else { tcg_gen_addi_tl(t0, arg2, 1); } tcg_gen_xor_tl(t1, arg2, inv1); /* add without carry */ tcg_gen_add_tl(t0, t0, inv1); tcg_temp_free(inv1); - tcg_gen_xor_tl(cpu_ca, t0, t1); /* bits changes w/ car= ry */ + tcg_gen_xor_tl(ca, t0, t1); /* bits changes w/ carry */ tcg_temp_free(t1); - tcg_gen_shri_tl(cpu_ca, cpu_ca, 32); /* extract bit 32 */ - tcg_gen_andi_tl(cpu_ca, cpu_ca, 1); + tcg_gen_extract_tl(ca, ca, 32, 1); /* extract bit 32 */ } else if (add_ca) { TCGv zero, inv1 =3D tcg_temp_new(); tcg_gen_not_tl(inv1, arg1); zero =3D tcg_const_tl(0); - tcg_gen_add2_tl(t0, cpu_ca, arg2, zero, cpu_ca, zero); - tcg_gen_add2_tl(t0, cpu_ca, t0, cpu_ca, inv1, zero); + tcg_gen_add2_tl(t0, ca, arg2, zero, ca, zero); + tcg_gen_add2_tl(t0, ca, t0, ca, inv1, zero); tcg_temp_free(zero); tcg_temp_free(inv1); } else { - tcg_gen_setcond_tl(TCG_COND_GEU, cpu_ca, arg2, arg1); + tcg_gen_setcond_tl(TCG_COND_GEU, ca, arg2, arg1); tcg_gen_sub_tl(t0, arg2, arg1); } } else if (add_ca) { /* Since we're ignoring carry-out, we can simplify the standard ~arg1 + arg2 + ca to arg2 - arg1 + ca - 1. */ tcg_gen_sub_tl(t0, arg2, arg1); - tcg_gen_add_tl(t0, t0, cpu_ca); + tcg_gen_add_tl(t0, t0, ca); tcg_gen_subi_tl(t0, t0, 1); } else { tcg_gen_sub_tl(t0, arg2, arg1); @@ -1378,6 +1394,9 @@ static inline void gen_op_arith_subf(DisasContext *ct= x, TCGv ret, TCGv arg1, if (compute_ov) { gen_op_arith_compute_ov(ctx, t0, arg1, arg2, 1); } + if (compute_ca) { + gen_op_update_ca_legacy(ca); + } if (unlikely(compute_rc0)) { gen_set_Rc0(ctx, t0); } @@ -1386,6 +1405,7 @@ static inline void gen_op_arith_subf(DisasContext *ct= x, TCGv ret, TCGv arg1, tcg_gen_mov_tl(ret, t0); tcg_temp_free(t0); } + tcg_temp_free(ca); } /* Sub functions with Two operands functions */ #define GEN_INT_ARITH_SUBF(name, opc3, add_ca, compute_ca, compute_ov) = \ @@ -2119,23 +2139,27 @@ static void gen_srawi(DisasContext *ctx) int sh =3D SH(ctx->opcode); TCGv dst =3D cpu_gpr[rA(ctx->opcode)]; TCGv src =3D cpu_gpr[rS(ctx->opcode)]; + TCGv ca =3D tcg_temp_new(); + if (sh =3D=3D 0) { tcg_gen_ext32s_tl(dst, src); - tcg_gen_movi_tl(cpu_ca, 0); + tcg_gen_movi_tl(ca, 0); } else { TCGv t0; tcg_gen_ext32s_tl(dst, src); - tcg_gen_andi_tl(cpu_ca, dst, (1ULL << sh) - 1); + tcg_gen_andi_tl(ca, dst, (1ULL << sh) - 1); t0 =3D tcg_temp_new(); tcg_gen_sari_tl(t0, dst, TARGET_LONG_BITS - 1); - tcg_gen_and_tl(cpu_ca, cpu_ca, t0); + tcg_gen_and_tl(ca, ca, t0); tcg_temp_free(t0); - tcg_gen_setcondi_tl(TCG_COND_NE, cpu_ca, cpu_ca, 0); + tcg_gen_setcondi_tl(TCG_COND_NE, ca, ca, 0); tcg_gen_sari_tl(dst, dst, sh); } if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, dst); } + gen_op_update_ca_legacy(ca); + tcg_temp_free(ca); } =20 /* srw & srw. */ @@ -2197,22 +2221,25 @@ static inline void gen_sradi(DisasContext *ctx, int= n) int sh =3D SH(ctx->opcode) + (n << 5); TCGv dst =3D cpu_gpr[rA(ctx->opcode)]; TCGv src =3D cpu_gpr[rS(ctx->opcode)]; + TCGv ca =3D tcg_temp_new(); if (sh =3D=3D 0) { tcg_gen_mov_tl(dst, src); - tcg_gen_movi_tl(cpu_ca, 0); + tcg_gen_movi_tl(ca, 0); } else { TCGv t0; - tcg_gen_andi_tl(cpu_ca, src, (1ULL << sh) - 1); + tcg_gen_andi_tl(ca, src, (1ULL << sh) - 1); t0 =3D tcg_temp_new(); tcg_gen_sari_tl(t0, src, TARGET_LONG_BITS - 1); - tcg_gen_and_tl(cpu_ca, cpu_ca, t0); + tcg_gen_and_tl(ca, ca, t0); tcg_temp_free(t0); - tcg_gen_setcondi_tl(TCG_COND_NE, cpu_ca, cpu_ca, 0); + tcg_gen_setcondi_tl(TCG_COND_NE, ca, ca, 0); tcg_gen_sari_tl(dst, src, sh); } if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, dst); } + gen_op_update_ca_legacy(ca); + tcg_temp_free(ca); } =20 static void gen_sradi0(DisasContext *ctx) @@ -4990,16 +5017,20 @@ static void gen_sraiq(DisasContext *ctx) TCGLabel *l1 =3D gen_new_label(); TCGv t0 =3D tcg_temp_new(); TCGv t1 =3D tcg_temp_new(); + TCGv ca =3D tcg_temp_local_new(); + tcg_gen_shri_tl(t0, cpu_gpr[rS(ctx->opcode)], sh); tcg_gen_shli_tl(t1, cpu_gpr[rS(ctx->opcode)], 32 - sh); tcg_gen_or_tl(t0, t0, t1); gen_store_spr(SPR_MQ, t0); - tcg_gen_movi_tl(cpu_ca, 0); + tcg_gen_movi_tl(ca, 0); tcg_gen_brcondi_tl(TCG_COND_EQ, t1, 0, l1); tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rS(ctx->opcode)], 0, l1); - tcg_gen_movi_tl(cpu_ca, 1); + tcg_gen_movi_tl(ca, 1); gen_set_label(l1); tcg_gen_sari_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], sh= ); + gen_op_update_ca_legacy(ca); + tcg_temp_free(ca); tcg_temp_free(t0); tcg_temp_free(t1); if (unlikely(Rc(ctx->opcode) !=3D 0)) @@ -5014,6 +5045,8 @@ static void gen_sraq(DisasContext *ctx) TCGv t0 =3D tcg_temp_new(); TCGv t1 =3D tcg_temp_local_new(); TCGv t2 =3D tcg_temp_local_new(); + TCGv ca =3D tcg_temp_local_new(); + tcg_gen_andi_tl(t2, cpu_gpr[rB(ctx->opcode)], 0x1F); tcg_gen_shr_tl(t0, cpu_gpr[rS(ctx->opcode)], t2); tcg_gen_sar_tl(t1, cpu_gpr[rS(ctx->opcode)], t2); @@ -5028,11 +5061,13 @@ static void gen_sraq(DisasContext *ctx) gen_set_label(l1); tcg_temp_free(t0); tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], t1); - tcg_gen_movi_tl(cpu_ca, 0); + tcg_gen_movi_tl(ca, 0); tcg_gen_brcondi_tl(TCG_COND_GE, t1, 0, l2); tcg_gen_brcondi_tl(TCG_COND_EQ, t2, 0, l2); - tcg_gen_movi_tl(cpu_ca, 1); + tcg_gen_movi_tl(ca, 1); gen_set_label(l2); + gen_op_update_ca_legacy(ca); + tcg_temp_free(ca); tcg_temp_free(t1); tcg_temp_free(t2); if (unlikely(Rc(ctx->opcode) !=3D 0)) --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487882473209785.9520726709219; Thu, 23 Feb 2017 12:41:13 -0800 (PST) Received: from localhost ([::1]:60957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch0CM-00006P-QA for importer@patchew.org; Thu, 23 Feb 2017 15:41:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVk-0005L0-RM for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVg-0001jP-Nx for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:08 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37240 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVg-0001j6-In for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:04 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJrbKd034265 for ; Thu, 23 Feb 2017 14:57:04 -0500 Received: from e28smtp03.in.ibm.com (e28smtp03.in.ibm.com [125.16.236.3]) by mx0b-001b2d01.pphosted.com with ESMTP id 28t5vvh9d7-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:03 -0500 Received: from localhost by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:00 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp03.in.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:26:58 +0530 Received: from d28relay09.in.ibm.com (d28relay09.in.ibm.com [9.184.220.160]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id C5FFDE0045; Fri, 24 Feb 2017 01:28:37 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay09.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJuvjd10551440; Fri, 24 Feb 2017 01:26:57 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJuu8c024667; Fri, 24 Feb 2017 01:26:57 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVM024530; Fri, 24 Feb 2017 01:26:56 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:30 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022319-0008-0000-0000-00000530B831 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0009-0000-0000-00001338C029 Message-Id: <1487879800-12352-6-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v4 05/15] target/ppc: add gen_op_update_ov_legacy() helper 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Update cpu_ov/so using the helper Signed-off-by: Nikunj A Dadhania --- target/ppc/translate.c | 84 ++++++++++++++++++++++++++++++++++------------= ---- 1 file changed, 57 insertions(+), 27 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index ae7b43d..4c0e985 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -797,24 +797,43 @@ static inline void gen_op_update_ca_legacy(TCGv ca) tcg_gen_mov_tl(cpu_ca, ca); } =20 +static inline void gen_op_update_ov_legacy(TCGv ov) +{ + tcg_gen_mov_tl(cpu_ov, ov); + tcg_gen_or_tl(cpu_so, ov); +} + +/* Sub functions with one operand and one immediate */ +#define GEN_UPDATE_OV(name, const_val) \ +static void glue(gen_op_, name)(void) \ +{ \ + TCGv t0 =3D tcg_const_tl(const_val); \ + gen_op_update_ov_legacy(t0); \ + tcg_temp_free(t0); \ +} +GEN_UPDATE_OV(set_ov, 1); +GEN_UPDATE_OV(clear_ov, 0); + static inline void gen_op_arith_compute_ov(DisasContext *ctx, TCGv arg0, TCGv arg1, TCGv arg2, int sub) { TCGv t0 =3D tcg_temp_new(); + TCGv ov =3D tcg_temp_new(); =20 - tcg_gen_xor_tl(cpu_ov, arg0, arg2); + tcg_gen_xor_tl(ov, arg0, arg2); tcg_gen_xor_tl(t0, arg1, arg2); if (sub) { - tcg_gen_and_tl(cpu_ov, cpu_ov, t0); + tcg_gen_and_tl(ov, ov, t0); } else { - tcg_gen_andc_tl(cpu_ov, cpu_ov, t0); + tcg_gen_andc_tl(ov, ov, t0); } tcg_temp_free(t0); if (NARROW_MODE(ctx)) { - tcg_gen_ext32s_tl(cpu_ov, cpu_ov); + tcg_gen_ext32s_tl(ov, ov); } - tcg_gen_shri_tl(cpu_ov, cpu_ov, TARGET_LONG_BITS - 1); - tcg_gen_or_tl(cpu_so, cpu_so, cpu_ov); + tcg_gen_shri_tl(ov, ov, TARGET_LONG_BITS - 1); + gen_op_update_ov_legacy(ov); + tcg_temp_free(ov); } =20 /* Common add function */ @@ -997,8 +1016,10 @@ static inline void gen_op_arith_divw(DisasContext *ct= x, TCGv ret, TCGv arg1, tcg_gen_extu_i32_tl(ret, t3); } if (compute_ov) { - tcg_gen_extu_i32_tl(cpu_ov, t2); - tcg_gen_or_tl(cpu_so, cpu_so, cpu_ov); + TCGv ov =3D tcg_temp_new(); + tcg_gen_extu_i32_tl(ov, t2); + gen_op_update_ov_legacy(ov); + tcg_temp_free(ov); } tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); @@ -1068,8 +1089,7 @@ static inline void gen_op_arith_divd(DisasContext *ct= x, TCGv ret, TCGv arg1, tcg_gen_divu_i64(ret, t0, t1); } if (compute_ov) { - tcg_gen_mov_tl(cpu_ov, t2); - tcg_gen_or_tl(cpu_so, cpu_so, cpu_ov); + gen_op_update_ov_legacy(t2); } tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); @@ -1249,6 +1269,7 @@ static void gen_mullwo(DisasContext *ctx) { TCGv_i32 t0 =3D tcg_temp_new_i32(); TCGv_i32 t1 =3D tcg_temp_new_i32(); + TCGv ov =3D tcg_temp_new(); =20 tcg_gen_trunc_tl_i32(t0, cpu_gpr[rA(ctx->opcode)]); tcg_gen_trunc_tl_i32(t1, cpu_gpr[rB(ctx->opcode)]); @@ -1261,8 +1282,9 @@ static void gen_mullwo(DisasContext *ctx) =20 tcg_gen_sari_i32(t0, t0, 31); tcg_gen_setcond_i32(TCG_COND_NE, t0, t0, t1); - tcg_gen_extu_i32_tl(cpu_ov, t0); - tcg_gen_or_tl(cpu_so, cpu_so, cpu_ov); + tcg_gen_extu_i32_tl(ov, t0); + gen_op_update_ov_legacy(ov); + tcg_temp_free(ov); =20 tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); @@ -1316,14 +1338,16 @@ static void gen_mulldo(DisasContext *ctx) { TCGv_i64 t0 =3D tcg_temp_new_i64(); TCGv_i64 t1 =3D tcg_temp_new_i64(); + TCGv ov =3D tcg_temp_new(); =20 tcg_gen_muls2_i64(t0, t1, cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]); tcg_gen_mov_i64(cpu_gpr[rD(ctx->opcode)], t0); =20 tcg_gen_sari_i64(t0, t0, 63); - tcg_gen_setcond_i64(TCG_COND_NE, cpu_ov, t0, t1); - tcg_gen_or_tl(cpu_so, cpu_so, cpu_ov); + tcg_gen_setcond_i64(TCG_COND_NE, ov, t0, t1); + gen_op_update_ov_legacy(ov); + tcg_temp_free(ov); =20 tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); @@ -4586,12 +4610,13 @@ static void gen_abso(DisasContext *ctx) TCGLabel *l1 =3D gen_new_label(); TCGLabel *l2 =3D gen_new_label(); TCGLabel *l3 =3D gen_new_label(); + TCGv ov =3D tcg_temp_local_new(); + /* Start with XER OV disabled, the most likely case */ - tcg_gen_movi_tl(cpu_ov, 0); + tcg_gen_movi_tl(ov, 0); tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rA(ctx->opcode)], 0, l2); tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[rA(ctx->opcode)], 0x80000000, = l1); - tcg_gen_movi_tl(cpu_ov, 1); - tcg_gen_movi_tl(cpu_so, 1); + tcg_gen_movi_tl(ov, 1); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); @@ -4601,6 +4626,8 @@ static void gen_abso(DisasContext *ctx) gen_set_label(l3); if (unlikely(Rc(ctx->opcode) !=3D 0)) gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + gen_op_update_ov_legacy(ov); + tcg_temp_free(ov); } =20 /* clcs */ @@ -4671,8 +4698,9 @@ static void gen_dozo(DisasContext *ctx) TCGv t0 =3D tcg_temp_new(); TCGv t1 =3D tcg_temp_new(); TCGv t2 =3D tcg_temp_new(); + TCGv ov =3D tcg_temp_local_new(); /* Start with XER OV disabled, the most likely case */ - tcg_gen_movi_tl(cpu_ov, 0); + tcg_gen_movi_tl(ov, 0); tcg_gen_brcond_tl(TCG_COND_GE, cpu_gpr[rB(ctx->opcode)], cpu_gpr[rA(ct= x->opcode)], l1); tcg_gen_sub_tl(t0, cpu_gpr[rB(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); tcg_gen_xor_tl(t1, cpu_gpr[rB(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); @@ -4680,8 +4708,7 @@ static void gen_dozo(DisasContext *ctx) tcg_gen_andc_tl(t1, t1, t2); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], t0); tcg_gen_brcondi_tl(TCG_COND_GE, t1, 0, l2); - tcg_gen_movi_tl(cpu_ov, 1); - tcg_gen_movi_tl(cpu_so, 1); + tcg_gen_movi_tl(ov, 1); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_movi_tl(cpu_gpr[rD(ctx->opcode)], 0); @@ -4691,6 +4718,8 @@ static void gen_dozo(DisasContext *ctx) tcg_temp_free(t2); if (unlikely(Rc(ctx->opcode) !=3D 0)) gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + gen_op_update_ov_legacy(ov); + tcg_temp_free(ov); } =20 /* dozi */ @@ -4795,9 +4824,10 @@ static void gen_mulo(DisasContext *ctx) TCGLabel *l1 =3D gen_new_label(); TCGv_i64 t0 =3D tcg_temp_new_i64(); TCGv_i64 t1 =3D tcg_temp_new_i64(); + TCGv ov =3D tcg_temp_local_new(); TCGv t2 =3D tcg_temp_new(); /* Start with XER OV disabled, the most likely case */ - tcg_gen_movi_tl(cpu_ov, 0); + tcg_gen_movi_tl(ov, 0); tcg_gen_extu_tl_i64(t0, cpu_gpr[rA(ctx->opcode)]); tcg_gen_extu_tl_i64(t1, cpu_gpr[rB(ctx->opcode)]); tcg_gen_mul_i64(t0, t0, t1); @@ -4807,14 +4837,15 @@ static void gen_mulo(DisasContext *ctx) tcg_gen_trunc_i64_tl(cpu_gpr[rD(ctx->opcode)], t1); tcg_gen_ext32s_i64(t1, t0); tcg_gen_brcond_i64(TCG_COND_EQ, t0, t1, l1); - tcg_gen_movi_tl(cpu_ov, 1); - tcg_gen_movi_tl(cpu_so, 1); + tcg_gen_movi_tl(ov, 1); gen_set_label(l1); tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); tcg_temp_free(t2); if (unlikely(Rc(ctx->opcode) !=3D 0)) gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + gen_op_update_ov_legacy(ov); + tcg_temp_free(ov); } =20 /* nabs - nabs. */ @@ -4844,7 +4875,7 @@ static void gen_nabso(DisasContext *ctx) tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); gen_set_label(l2); /* nabs never overflows */ - tcg_gen_movi_tl(cpu_ov, 0); + gen_op_clear_ov(); if (unlikely(Rc(ctx->opcode) !=3D 0)) gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); } @@ -5474,7 +5505,7 @@ static inline void gen_405_mulladd_insn(DisasContext = *ctx, int opc2, int opc3, =20 if (opc3 & 0x10) { /* Start with XER OV disabled, the most likely case */ - tcg_gen_movi_tl(cpu_ov, 0); + gen_op_clear_ov(); } if (opc3 & 0x01) { /* Signed */ @@ -5497,8 +5528,7 @@ static inline void gen_405_mulladd_insn(DisasContext = *ctx, int opc2, int opc3, } if (opc3 & 0x10) { /* Check overflow */ - tcg_gen_movi_tl(cpu_ov, 1); - tcg_gen_movi_tl(cpu_so, 1); + gen_op_set_ov(); } gen_set_label(l1); tcg_gen_mov_tl(cpu_gpr[rt], t0); --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487880906331786.46323991013; Thu, 23 Feb 2017 12:15:06 -0800 (PST) Received: from localhost ([::1]:60790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzn7-0006Aa-4n for importer@patchew.org; Thu, 23 Feb 2017 15:15:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVm-0005Ng-8N for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVi-0001kq-Py for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:10 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:32984) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVi-0001kT-Gr for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:06 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJtDQZ061220 for ; Thu, 23 Feb 2017 14:57:05 -0500 Received: from e28smtp06.in.ibm.com (e28smtp06.in.ibm.com [125.16.236.6]) by mx0a-001b2d01.pphosted.com with ESMTP id 28sp4jssk6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:04 -0500 Received: from localhost by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:01 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:26:59 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 0FA28125805C; Fri, 24 Feb 2017 01:27:07 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay03.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJuwWR6029552; Fri, 24 Feb 2017 01:26:58 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJuvsP024692; Fri, 24 Feb 2017 01:26:58 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVN024530; Fri, 24 Feb 2017 01:26:57 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:31 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17022319-0020-0000-0000-000000C1BB9D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0021-0000-0000-0000027DC34A Message-Id: <1487879800-12352-7-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v4 06/15] target/ppc: remove xer split-out flags(so, ov, ca) 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now get rid all the split out variables so, ca, ov. After this patch, all the bits are stored in CPUPPCState::xer at appropriate places. Signed-off-by: Nikunj A Dadhania --- target/ppc/cpu.c | 8 +--- target/ppc/cpu.h | 26 ++++++------ target/ppc/int_helper.c | 12 +++--- target/ppc/translate.c | 106 +++++++++++++++++++++++++-------------------= ---- 4 files changed, 78 insertions(+), 74 deletions(-) diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index de3004b..3c08dac 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -23,14 +23,10 @@ =20 target_ulong cpu_read_xer(CPUPPCState *env) { - return env->xer | (env->so << XER_SO) | (env->ov << XER_OV) | - (env->ca << XER_CA); + return env->xer; } =20 void cpu_write_xer(CPUPPCState *env, target_ulong xer) { - env->so =3D (xer >> XER_SO) & 1; - env->ov =3D (xer >> XER_OV) & 1; - env->ca =3D (xer >> XER_CA) & 1; - env->xer =3D xer & ~((1u << XER_SO) | (1u << XER_OV) | (1u << XER_CA)); + env->xer =3D xer; } diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index b559b67..f1a7ca0 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -962,9 +962,6 @@ struct CPUPPCState { #endif /* XER (with SO, OV, CA split out) */ target_ulong xer; - target_ulong so; - target_ulong ov; - target_ulong ca; /* Reservation address */ target_ulong reserve_addr; /* Reservation value */ @@ -1369,16 +1366,19 @@ int ppc_compat_max_threads(PowerPCCPU *cpu); #define CRF_CH_AND_CL (1 << CRF_SO_BIT) =20 /* XER definitions */ -#define XER_SO 31 -#define XER_OV 30 -#define XER_CA 29 -#define XER_CMP 8 -#define XER_BC 0 -#define xer_so (env->so) -#define xer_ov (env->ov) -#define xer_ca (env->ca) -#define xer_cmp ((env->xer >> XER_CMP) & 0xFF) -#define xer_bc ((env->xer >> XER_BC) & 0x7F) +#define XER_SO_BIT 31 +#define XER_OV_BIT 30 +#define XER_CA_BIT 29 +#define XER_CMP_BIT 8 +#define XER_BC_BIT 0 +#define XER_SO (1 << XER_SO_BIT) +#define XER_OV (1 << XER_OV_BIT) +#define XER_CA (1 << XER_CA_BIT) +#define xer_so ((env->xer & XER_SO) >> XER_SO_BIT) +#define xer_ov ((env->xer & XER_OV) >> XER_OV_BIT) +#define xer_ca ((env->xer & XER_CA) >> XER_CA_BIT) +#define xer_cmp ((env->xer >> XER_CMP_BIT) & 0xFF) +#define xer_bc ((env->xer >> XER_BC_BIT) & 0x7F) =20 /* SPR definitions */ #define SPR_MQ (0x000) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index d7af671..b0c3c2b 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -30,16 +30,18 @@ =20 static inline void helper_update_ov_legacy(CPUPPCState *env, int ov) { - if (unlikely(ov)) { - env->so =3D env->ov =3D 1; - } else { - env->ov =3D 0; + env->xer =3D env->xer & ~(XER_OV); + if (ov) { + env->xer |=3D XER_SO | XER_OV; } } =20 static inline void helper_update_ca(CPUPPCState *env, int ca) { - env->ca =3D ca; + env->xer =3D env->xer & ~(XER_CA); + if (ca) { + env->xer |=3D XER_CA; + } } =20 target_ulong helper_divweu(CPUPPCState *env, target_ulong ra, target_ulong= rb, diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 4c0e985..5be1bb9 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -71,7 +71,7 @@ static TCGv cpu_lr; #if defined(TARGET_PPC64) static TCGv cpu_cfar; #endif -static TCGv cpu_xer, cpu_so, cpu_ov, cpu_ca; +static TCGv cpu_xer; static TCGv cpu_reserve; static TCGv cpu_fpscr; static TCGv_i32 cpu_access_type; @@ -167,12 +167,6 @@ void ppc_translate_init(void) =20 cpu_xer =3D tcg_global_mem_new(cpu_env, offsetof(CPUPPCState, xer), "xer"); - cpu_so =3D tcg_global_mem_new(cpu_env, - offsetof(CPUPPCState, so), "SO"); - cpu_ov =3D tcg_global_mem_new(cpu_env, - offsetof(CPUPPCState, ov), "OV"); - cpu_ca =3D tcg_global_mem_new(cpu_env, - offsetof(CPUPPCState, ca), "CA"); =20 cpu_reserve =3D tcg_global_mem_new(cpu_env, offsetof(CPUPPCState, reserve_addr), @@ -607,8 +601,11 @@ static inline void gen_op_cmp(TCGv arg0, TCGv arg1, in= t s, int crf) { TCGv t0 =3D tcg_temp_new(); TCGv_i32 t1 =3D tcg_temp_new_i32(); + TCGv so =3D tcg_temp_new(); =20 - tcg_gen_trunc_tl_i32(cpu_crf[crf], cpu_so); + tcg_gen_extract_tl(so, cpu_xer, XER_SO_BIT, 1); + tcg_gen_trunc_tl_i32(cpu_crf[crf], so); + tcg_temp_free(so); =20 tcg_gen_setcond_tl((s ? TCG_COND_LT: TCG_COND_LTU), t0, arg0, arg1); tcg_gen_trunc_tl_i32(t1, t0); @@ -794,13 +791,24 @@ static void gen_cmpb(DisasContext *ctx) =20 static inline void gen_op_update_ca_legacy(TCGv ca) { - tcg_gen_mov_tl(cpu_ca, ca); + TCGv t0 =3D tcg_temp_new(); + tcg_gen_movi_tl(t0, XER_CA); + tcg_gen_andc_tl(cpu_xer, cpu_xer, t0); + tcg_gen_shli_tl(t0, ca, XER_CA_BIT); + tcg_gen_or_tl(cpu_xer, cpu_xer, t0); + tcg_temp_free(t0); } =20 static inline void gen_op_update_ov_legacy(TCGv ov) { - tcg_gen_mov_tl(cpu_ov, ov); - tcg_gen_or_tl(cpu_so, ov); + TCGv t1 =3D tcg_temp_new(); + TCGv zero =3D tcg_const_tl(0); + tcg_gen_movi_tl(t1, XER_OV); + tcg_gen_andc_tl(cpu_xer, cpu_xer, t1); + tcg_gen_movi_tl(t1, XER_OV | XER_SO); + tcg_gen_movcond_tl(TCG_COND_EQ, cpu_xer, ov, zero, cpu_xer, t1); + tcg_temp_free(t1); + tcg_temp_free(zero); } =20 /* Sub functions with one operand and one immediate */ @@ -849,7 +857,7 @@ static inline void gen_op_arith_add(DisasContext *ctx, = TCGv ret, TCGv arg1, } =20 if (add_ca) { - tcg_gen_mov_tl(ca, cpu_ca); + tcg_gen_extract_tl(ca, cpu_xer, XER_CA_BIT, 1); } =20 if (compute_ca) { @@ -3151,8 +3159,12 @@ static void gen_conditional_store(DisasContext *ctx,= TCGv EA, int reg, int memop) { TCGLabel *l1; + TCGv so =3D tcg_temp_new(); + + tcg_gen_extract_tl(so, cpu_xer, XER_SO_BIT, 1); + tcg_gen_trunc_tl_i32(cpu_crf[0], so); + tcg_temp_free(so); =20 - tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); l1 =3D gen_new_label(); tcg_gen_brcond_tl(TCG_COND_NE, EA, cpu_reserve, l1); tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], CRF_EQ); @@ -3230,6 +3242,7 @@ static void gen_stqcx_(DisasContext *ctx) #if !defined(CONFIG_USER_ONLY) TCGLabel *l1; TCGv gpr1, gpr2; + TCGv so =3D tcg_temp_new(); #endif =20 if (unlikely((rD(ctx->opcode) & 1))) { @@ -3246,7 +3259,10 @@ static void gen_stqcx_(DisasContext *ctx) #if defined(CONFIG_USER_ONLY) gen_conditional_store(ctx, EA, reg, 16); #else - tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); + tcg_gen_extract_tl(so, cpu_xer, XER_SO_BIT, 1); + tcg_gen_trunc_tl_i32(cpu_crf[0], so); + tcg_temp_free(so); + l1 =3D gen_new_label(); tcg_gen_brcond_tl(TCG_COND_NE, EA, cpu_reserve, l1); tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], CRF_EQ); @@ -3756,51 +3772,26 @@ static void gen_tdi(DisasContext *ctx) =20 static void gen_read_xer(TCGv dst) { - TCGv t0 =3D tcg_temp_new(); - TCGv t1 =3D tcg_temp_new(); - TCGv t2 =3D tcg_temp_new(); tcg_gen_mov_tl(dst, cpu_xer); - tcg_gen_shli_tl(t0, cpu_so, XER_SO); - tcg_gen_shli_tl(t1, cpu_ov, XER_OV); - tcg_gen_shli_tl(t2, cpu_ca, XER_CA); - tcg_gen_or_tl(t0, t0, t1); - tcg_gen_or_tl(dst, dst, t2); - tcg_gen_or_tl(dst, dst, t0); - tcg_temp_free(t0); - tcg_temp_free(t1); - tcg_temp_free(t2); } =20 static void gen_write_xer(TCGv src) { - tcg_gen_andi_tl(cpu_xer, src, - ~((1u << XER_SO) | (1u << XER_OV) | (1u << XER_CA))); - tcg_gen_extract_tl(cpu_so, src, XER_SO, 1); - tcg_gen_extract_tl(cpu_ov, src, XER_OV, 1); - tcg_gen_extract_tl(cpu_ca, src, XER_CA, 1); + tcg_gen_mov_tl(cpu_xer, src); } =20 /* mcrxr */ static void gen_mcrxr(DisasContext *ctx) { - TCGv_i32 t0 =3D tcg_temp_new_i32(); - TCGv_i32 t1 =3D tcg_temp_new_i32(); TCGv_i32 dst =3D cpu_crf[crfD(ctx->opcode)]; + TCGv t0 =3D tcg_temp_new(); =20 - tcg_gen_trunc_tl_i32(t0, cpu_so); - tcg_gen_trunc_tl_i32(t1, cpu_ov); - tcg_gen_trunc_tl_i32(dst, cpu_ca); - tcg_gen_shli_i32(t0, t0, 3); - tcg_gen_shli_i32(t1, t1, 2); - tcg_gen_shli_i32(dst, dst, 1); - tcg_gen_or_i32(dst, dst, t0); - tcg_gen_or_i32(dst, dst, t1); - tcg_temp_free_i32(t0); - tcg_temp_free_i32(t1); - - tcg_gen_movi_tl(cpu_so, 0); - tcg_gen_movi_tl(cpu_ov, 0); - tcg_gen_movi_tl(cpu_ca, 0); + tcg_gen_trunc_tl_i32(dst, cpu_xer); + tcg_gen_shri_i32(dst, dst, XER_CA_BIT - 1); + tcg_gen_andi_i32(dst, dst, 0xE); + tcg_gen_movi_tl(t0, XER_SO | XER_OV | XER_CA); + tcg_gen_andc_tl(cpu_xer, cpu_xer, t0); + tcg_temp_free(t0); } =20 /* mfcr mfocrf */ @@ -4421,6 +4412,7 @@ static void gen_slbfee_(DisasContext *ctx) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGLabel *l1, *l2; + TCGv so; =20 if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); @@ -4430,7 +4422,11 @@ static void gen_slbfee_(DisasContext *ctx) cpu_gpr[rB(ctx->opcode)]); l1 =3D gen_new_label(); l2 =3D gen_new_label(); - tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); + so =3D tcg_temp_new(); + + tcg_gen_extract_tl(so, cpu_xer, XER_SO_BIT, 1); + tcg_gen_trunc_tl_i32(cpu_crf[0], so); + tcg_temp_free(so); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[rS(ctx->opcode)], -1, l1); tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], CRF_EQ); tcg_gen_br(l2); @@ -5854,7 +5850,12 @@ static void gen_tlbsx_40x(DisasContext *ctx) tcg_temp_free(t0); if (Rc(ctx->opcode)) { TCGLabel *l1 =3D gen_new_label(); - tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); + TCGv so =3D tcg_temp_new(); + + tcg_gen_extract_tl(so, cpu_xer, XER_SO_BIT, 1); + tcg_gen_trunc_tl_i32(cpu_crf[0], so); + tcg_temp_free(so); + tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[rD(ctx->opcode)], -1, l1); tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], 0x02); gen_set_label(l1); @@ -5929,7 +5930,12 @@ static void gen_tlbsx_440(DisasContext *ctx) tcg_temp_free(t0); if (Rc(ctx->opcode)) { TCGLabel *l1 =3D gen_new_label(); - tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); + TCGv so =3D tcg_temp_new(); + + tcg_gen_extract_tl(so, cpu_xer, XER_SO_BIT, 1); + tcg_gen_trunc_tl_i32(cpu_crf[0], so); + tcg_temp_free(so); + tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[rD(ctx->opcode)], -1, l1); tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], 0x02); gen_set_label(l1); --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487882190388343.73553550400584; Thu, 23 Feb 2017 12:36:30 -0800 (PST) Received: from localhost ([::1]:60926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch07o-0003U4-DO for importer@patchew.org; Thu, 23 Feb 2017 15:36:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVl-0005Me-Jr for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVh-0001k5-FK for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:09 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51834 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVh-0001jZ-Az for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:05 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJrkun077276 for ; Thu, 23 Feb 2017 14:57:04 -0500 Received: from e28smtp06.in.ibm.com (e28smtp06.in.ibm.com [125.16.236.6]) by mx0b-001b2d01.pphosted.com with ESMTP id 28t4yqbq3x-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:04 -0500 Received: from localhost by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:01 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:27:00 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 4EEDFE005A; Fri, 24 Feb 2017 01:28:39 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay05.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJuu1C11665516; Fri, 24 Feb 2017 01:26:56 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJuw9F024727; Fri, 24 Feb 2017 01:26:58 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVO024530; Fri, 24 Feb 2017 01:26:57 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:32 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022319-0020-0000-0000-000000C1BB9E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0021-0000-0000-0000027DC34B Message-Id: <1487879800-12352-8-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v4 07/15] target/ppc: support for 32-bit carry and overflow 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" POWER ISA 3.0 adds CA32 and OV32 status in 64-bit mode. Add the flags and corresponding defines. Moreover, CA32 is updated when CA is updated and OV32 is updated when OV is updated. Arithmetic instructions: * Addition and Substractions: addic, addic., subfic, addc, subfc, adde, subfe, addme, subfme, addze, and subfze always updates CA and CA32. =3D> CA reflects the carry out of bit 0 in 64-bit mode and out of bit 32 in 32-bit mode. =3D> CA32 reflects the carry out of bit 32 independent of the mode. =3D> SO and OV reflects overflow of the 64-bit result in 64-bit mode and overflow of the low-order 32-bit result in 32-bit mode =3D> OV32 reflects overflow of the low-order 32-bit independent of the mode * Multiply Low and Divide: For mulld, divd, divde, divdu and divdeu: SO, OV, and OV32 bits reflects overflow of the 64-bit result For mullw, divw, divwe, divwu and divweu: SO, OV, and OV32 bits reflects overflow of the 32-bit result * Negate with OE=3D1 (nego) For 64-bit mode if the register RA contains 0x8000_0000_0000_0000, OV and OV32 are set to 1. For 32-bit mode if the register RA contains 0x8000_0000, OV and OV32 are set to 1. Signed-off-by: Nikunj A Dadhania --- target/ppc/cpu.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index f1a7ca0..e789d4b 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1369,14 +1369,20 @@ int ppc_compat_max_threads(PowerPCCPU *cpu); #define XER_SO_BIT 31 #define XER_OV_BIT 30 #define XER_CA_BIT 29 +#define XER_OV32_BIT 19 +#define XER_CA32_BIT 18 #define XER_CMP_BIT 8 #define XER_BC_BIT 0 #define XER_SO (1 << XER_SO_BIT) #define XER_OV (1 << XER_OV_BIT) #define XER_CA (1 << XER_CA_BIT) +#define XER_OV32 (1 << XER_OV32_BIT) +#define XER_CA32 (1 << XER_CA32_BIT) #define xer_so ((env->xer & XER_SO) >> XER_SO_BIT) #define xer_ov ((env->xer & XER_OV) >> XER_OV_BIT) #define xer_ca ((env->xer & XER_CA) >> XER_CA_BIT) +#define xer_ov32 ((env->xer & XER_OV32) >> XER_OV32_BIT) +#define xer_ca32 ((env->xer & XER_CA32) >> XER_CA32_BIT) #define xer_cmp ((env->xer >> XER_CMP_BIT) & 0xFF) #define xer_bc ((env->xer >> XER_BC_BIT) & 0x7F) =20 @@ -2343,6 +2349,7 @@ enum { =20 /*************************************************************************= ****/ =20 +#define is_isa300(ctx) (!!(ctx->insns_flags2 & PPC2_ISA300)) target_ulong cpu_read_xer(CPUPPCState *env); void cpu_write_xer(CPUPPCState *env, target_ulong xer); =20 --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487882810646800.9625610574457; Thu, 23 Feb 2017 12:46:50 -0800 (PST) Received: from localhost ([::1]:60998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch0Hp-0005dc-7y for importer@patchew.org; Thu, 23 Feb 2017 15:46:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVl-0005LV-5k for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVj-0001lk-SK for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:09 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60110 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVj-0001l5-L3 for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:07 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJtNoI044104 for ; Thu, 23 Feb 2017 14:57:07 -0500 Received: from e28smtp03.in.ibm.com (e28smtp03.in.ibm.com [125.16.236.3]) by mx0a-001b2d01.pphosted.com with ESMTP id 28t3cwqyfc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:06 -0500 Received: from localhost by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:03 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp03.in.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:27:00 +0530 Received: from d28relay08.in.ibm.com (d28relay08.in.ibm.com [9.184.220.159]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 42452125804F; Fri, 24 Feb 2017 01:27:08 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay08.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJtuUl9437420; Fri, 24 Feb 2017 01:25:56 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJuxPA024756; Fri, 24 Feb 2017 01:26:59 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVP024530; Fri, 24 Feb 2017 01:26:58 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:33 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17022319-0008-0000-0000-00000530B835 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0009-0000-0000-00001338C02C Message-Id: <1487879800-12352-9-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v4 08/15] target/ppc: update ca32 in arithmetic add 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Adds routine to compute ca32 - gen_op_arith_compute_ca32 For 64-bit mode use the compute ca32 routine. While for 32-bit mode, CA and CA32 will have same value. Signed-off-by: Nikunj A Dadhania --- target/ppc/translate.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 5be1bb9..c98e708 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -799,6 +799,28 @@ static inline void gen_op_update_ca_legacy(TCGv ca) tcg_temp_free(t0); } =20 +static inline void gen_op_update_ca_isa300(TCGv ca, TCGv ca32) +{ + TCGv t0 =3D tcg_temp_new(); + + tcg_gen_movi_tl(t0, XER_CA | XER_CA32); + tcg_gen_andc_tl(cpu_xer, cpu_xer, t0); + tcg_gen_shli_tl(t0, ca, XER_CA_BIT); + tcg_gen_or_tl(cpu_xer, cpu_xer, t0); + tcg_gen_shli_tl(t0, ca32, XER_CA32_BIT); + tcg_gen_or_tl(cpu_xer, cpu_xer, t0); + tcg_temp_free(t0); +} + +static inline void gen_op_update_ca(DisasContext *ctx, TCGv ca, TCGv ca32) +{ + if (is_isa300(ctx)) { + gen_op_update_ca_isa300(ca, ca32); + } else { + gen_op_update_ca_legacy(ca); + } +} + static inline void gen_op_update_ov_legacy(TCGv ov) { TCGv t1 =3D tcg_temp_new(); @@ -844,6 +866,23 @@ static inline void gen_op_arith_compute_ov(DisasContex= t *ctx, TCGv arg0, tcg_temp_free(ov); } =20 +static inline void gen_op_arith_compute_ca32(DisasContext *ctx, TCGv ca32, + TCGv res, TCGv arg0, TCGv arg= 1, + int sub) +{ + TCGv t0; + + if (!is_isa300(ctx)) { + return; + } + + t0 =3D tcg_temp_new(); + tcg_gen_xor_tl(t0, arg0, arg1); + tcg_gen_xor_tl(t0, t0, res); + tcg_gen_extract_tl(ca32, t0, 32, 1); + tcg_temp_free(t0); +} + /* Common add function */ static inline void gen_op_arith_add(DisasContext *ctx, TCGv ret, TCGv arg1, TCGv arg2, bool add_ca, bool compute_c= a, @@ -851,6 +890,7 @@ static inline void gen_op_arith_add(DisasContext *ctx, = TCGv ret, TCGv arg1, { TCGv t0 =3D ret; TCGv ca =3D tcg_temp_new(); + TCGv ca32 =3D tcg_temp_new(); =20 if (compute_ca || compute_ov) { t0 =3D tcg_temp_new(); @@ -874,6 +914,9 @@ static inline void gen_op_arith_add(DisasContext *ctx, = TCGv ret, TCGv arg1, tcg_gen_xor_tl(ca, t0, t1); /* bits changed w/ carry */ tcg_temp_free(t1); tcg_gen_extract_tl(ca, ca, 32, 1); + if (is_isa300(ctx)) { + tcg_gen_mov_tl(ca32, ca); + } } else { TCGv zero =3D tcg_const_tl(0); if (add_ca) { @@ -882,6 +925,7 @@ static inline void gen_op_arith_add(DisasContext *ctx, = TCGv ret, TCGv arg1, } else { tcg_gen_add2_tl(t0, ca, arg1, zero, arg2, zero); } + gen_op_arith_compute_ca32(ctx, ca32, t0, arg1, arg2, 0); tcg_temp_free(zero); } } else { @@ -895,7 +939,7 @@ static inline void gen_op_arith_add(DisasContext *ctx, = TCGv ret, TCGv arg1, gen_op_arith_compute_ov(ctx, t0, arg1, arg2, 0); } if (compute_ca) { - gen_op_update_ca_legacy(ca); + gen_op_update_ca(ctx, ca, ca32); } if (unlikely(compute_rc0)) { gen_set_Rc0(ctx, t0); @@ -906,6 +950,7 @@ static inline void gen_op_arith_add(DisasContext *ctx, = TCGv ret, TCGv arg1, tcg_temp_free(t0); } tcg_temp_free(ca); + tcg_temp_free(ca32); } /* Add functions with two operands */ #define GEN_INT_ARITH_ADD(name, opc3, add_ca, compute_ca, compute_ov) = \ --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487883245551804.0230443974551; Thu, 23 Feb 2017 12:54:05 -0800 (PST) Received: from localhost ([::1]:32799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch0Oo-0002W7-Tg for importer@patchew.org; Thu, 23 Feb 2017 15:54:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVn-0005UI-Iy for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVj-0001lb-ID for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:11 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48008) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVj-0001km-8P for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:07 -0500 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJtM1Z054466 for ; Thu, 23 Feb 2017 14:57:06 -0500 Received: from e28smtp09.in.ibm.com (e28smtp09.in.ibm.com [125.16.236.9]) by mx0a-001b2d01.pphosted.com with ESMTP id 28sku9nh9g-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:05 -0500 Received: from localhost by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:03 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp09.in.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:27:01 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id EADBB125805F; Fri, 24 Feb 2017 01:27:08 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay03.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJv0J69437254; Fri, 24 Feb 2017 01:27:00 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJuxXb024781; Fri, 24 Feb 2017 01:27:00 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVQ024530; Fri, 24 Feb 2017 01:26:59 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:34 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17022319-0032-0000-0000-000001ECBF61 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0033-0000-0000-0000121DC78D Message-Id: <1487879800-12352-10-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v4 09/15] target/ppc: update ca32 in arithmetic substract 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: 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: Nikunj A Dadhania --- target/ppc/translate.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index c98e708..143b595 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -877,7 +877,11 @@ static inline void gen_op_arith_compute_ca32(DisasCont= ext *ctx, TCGv ca32, } =20 t0 =3D tcg_temp_new(); - tcg_gen_xor_tl(t0, arg0, arg1); + if (sub) { + tcg_gen_eqv_tl(t0, arg0, arg1); + } else { + tcg_gen_xor_tl(t0, arg0, arg1); + } tcg_gen_xor_tl(t0, t0, res); tcg_gen_extract_tl(ca32, t0, 32, 1); tcg_temp_free(t0); @@ -1418,6 +1422,7 @@ static inline void gen_op_arith_subf(DisasContext *ct= x, TCGv ret, TCGv arg1, { TCGv t0 =3D ret; TCGv ca =3D tcg_temp_new(); + TCGv ca32 =3D tcg_temp_new(); =20 if (compute_ca || compute_ov) { t0 =3D tcg_temp_new(); @@ -1446,17 +1451,22 @@ static inline void gen_op_arith_subf(DisasContext *= ctx, TCGv ret, TCGv arg1, tcg_gen_xor_tl(ca, t0, t1); /* bits changes w/ carry */ tcg_temp_free(t1); tcg_gen_extract_tl(ca, ca, 32, 1); /* extract bit 32 */ + if (is_isa300(ctx)) { + tcg_gen_mov_tl(ca32, ca); + } } else if (add_ca) { TCGv zero, inv1 =3D tcg_temp_new(); tcg_gen_not_tl(inv1, arg1); zero =3D tcg_const_tl(0); tcg_gen_add2_tl(t0, ca, arg2, zero, ca, zero); tcg_gen_add2_tl(t0, ca, t0, ca, inv1, zero); + gen_op_arith_compute_ca32(ctx, ca32, t0, inv1, arg2, 0); tcg_temp_free(zero); tcg_temp_free(inv1); } else { tcg_gen_setcond_tl(TCG_COND_GEU, ca, arg2, arg1); tcg_gen_sub_tl(t0, arg2, arg1); + gen_op_arith_compute_ca32(ctx, ca32, t0, arg1, arg2, 1); } } else if (add_ca) { /* Since we're ignoring carry-out, we can simplify the @@ -1472,7 +1482,7 @@ static inline void gen_op_arith_subf(DisasContext *ct= x, TCGv ret, TCGv arg1, gen_op_arith_compute_ov(ctx, t0, arg1, arg2, 1); } if (compute_ca) { - gen_op_update_ca_legacy(ca); + gen_op_update_ca(ctx, ca, ca32); } if (unlikely(compute_rc0)) { gen_set_Rc0(ctx, t0); --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487881721043492.0803630165252; Thu, 23 Feb 2017 12:28:41 -0800 (PST) Received: from localhost ([::1]:60873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch00F-0004ZD-RA for importer@patchew.org; Thu, 23 Feb 2017 15:28:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVo-0005ZE-Ri for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVl-0001nI-2F for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:12 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54421) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVk-0001m4-O0 for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:08 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJs1NE061764 for ; Thu, 23 Feb 2017 14:57:07 -0500 Received: from e28smtp02.in.ibm.com (e28smtp02.in.ibm.com [125.16.236.2]) by mx0a-001b2d01.pphosted.com with ESMTP id 28t5wb181e-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:07 -0500 Received: from localhost by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:04 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp02.in.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:27:01 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 74D223940061; Fri, 24 Feb 2017 01:27:01 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay01.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJv1ef43778114; Fri, 24 Feb 2017 01:27:01 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJv00e024796; Fri, 24 Feb 2017 01:27:00 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVR024530; Fri, 24 Feb 2017 01:26:59 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:35 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022319-0004-0000-0000-00000542B854 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0005-0000-0000-0000133CC05E Message-Id: <1487879800-12352-11-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v4 10/15] target/ppc: add gen_op_update_ov_isa300() 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Introduce routine to update OV and OV32 in case it is POWER9 and above. Signed-off-by: Nikunj A Dadhania --- target/ppc/translate.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 143b595..ea0a356 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -833,6 +833,31 @@ static inline void gen_op_update_ov_legacy(TCGv ov) tcg_temp_free(zero); } =20 +static inline void gen_op_update_ov_isa300(TCGv ov, TCGv ov32) +{ + TCGv t1 =3D tcg_temp_new(); + TCGv t2 =3D tcg_temp_new(); + tcg_gen_movi_tl(t1, XER_OV | XER_OV32); + tcg_gen_andc_tl(cpu_xer, cpu_xer, t1); + tcg_gen_shli_tl(t1, ov, XER_OV_BIT); + tcg_gen_shli_tl(t2, ov, XER_SO_BIT); + tcg_gen_or_tl(t1, t1, t2); + tcg_gen_shli_tl(t2, ov32, XER_OV32_BIT); + tcg_gen_or_tl(t1, t1, t2); + tcg_gen_or_tl(cpu_xer, cpu_xer, t1); + tcg_temp_free(t1); + tcg_temp_free(t2); +} + +static inline void gen_op_update_ov(DisasContext *ctx, TCGv ov, TCGv ov32) +{ + if (is_isa300(ctx)) { + gen_op_update_ov_isa300(ov, ov32); + } else { + gen_op_update_ov_legacy(ov); + } +} + /* Sub functions with one operand and one immediate */ #define GEN_UPDATE_OV(name, const_val) \ static void glue(gen_op_, name)(void) \ --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487880617427169.36897608988488; Thu, 23 Feb 2017 12:10:17 -0800 (PST) Received: from localhost ([::1]:60760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgziR-0001Vf-Mq for importer@patchew.org; Thu, 23 Feb 2017 15:10:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVl-0005Mx-S6 for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVk-0001mh-HP for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:09 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51898 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVk-0001lx-BS for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:08 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJrkFK077237 for ; Thu, 23 Feb 2017 14:57:07 -0500 Received: from e28smtp02.in.ibm.com (e28smtp02.in.ibm.com [125.16.236.2]) by mx0b-001b2d01.pphosted.com with ESMTP id 28t4yqbq64-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:07 -0500 Received: from localhost by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:04 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp02.in.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:27:02 +0530 Received: from d28relay08.in.ibm.com (d28relay08.in.ibm.com [9.184.220.159]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id CB468E005A; Fri, 24 Feb 2017 01:28:41 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay08.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJtvKZ9896014; Fri, 24 Feb 2017 01:25:57 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJv1eE024810; Fri, 24 Feb 2017 01:27:01 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVS024530; Fri, 24 Feb 2017 01:27:00 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:36 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022319-0004-0000-0000-00000542B856 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0005-0000-0000-0000133CC05F Message-Id: <1487879800-12352-12-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v4 11/15] target/ppc: update OV/OV32 for mull[d, w] insns 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For Multiply Word: SO, OV, and OV32 bits reflects overflow of the 32-bit result For Multiply DoubleWord: SO, OV, and OV32 bits reflects overflow of the 64-bit result Signed-off-by: Nikunj A Dadhania --- target/ppc/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index ea0a356..e1105e8 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1365,7 +1365,7 @@ static void gen_mullwo(DisasContext *ctx) tcg_gen_sari_i32(t0, t0, 31); tcg_gen_setcond_i32(TCG_COND_NE, t0, t0, t1); tcg_gen_extu_i32_tl(ov, t0); - gen_op_update_ov_legacy(ov); + gen_op_update_ov(ctx, ov, ov); tcg_temp_free(ov); =20 tcg_temp_free_i32(t0); @@ -1428,7 +1428,7 @@ static void gen_mulldo(DisasContext *ctx) =20 tcg_gen_sari_i64(t0, t0, 63); tcg_gen_setcond_i64(TCG_COND_NE, ov, t0, t1); - gen_op_update_ov_legacy(ov); + gen_op_update_ov(ctx, ov, ov); tcg_temp_free(ov); =20 tcg_temp_free_i64(t0); --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487881444264811.5494195068791; Thu, 23 Feb 2017 12:24:04 -0800 (PST) Received: from localhost ([::1]:60849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzvn-0007WZ-3G for importer@patchew.org; Thu, 23 Feb 2017 15:24:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVl-0005Mo-Pz for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVk-0001mN-C0 for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:09 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38431 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVk-0001lh-4e for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:08 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJrbRJ157217 for ; Thu, 23 Feb 2017 14:57:07 -0500 Received: from e28smtp03.in.ibm.com (e28smtp03.in.ibm.com [125.16.236.3]) by mx0b-001b2d01.pphosted.com with ESMTP id 28t1a1xxrp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:07 -0500 Received: from localhost by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:04 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp03.in.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:27:03 +0530 Received: from d28relay06.in.ibm.com (d28relay06.in.ibm.com [9.184.220.150]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 5FABBE005E; Fri, 24 Feb 2017 01:28:42 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay06.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJv2Io12189860; Fri, 24 Feb 2017 01:27:02 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJv12k024824; Fri, 24 Feb 2017 01:27:02 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVT024530; Fri, 24 Feb 2017 01:27:01 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:37 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022319-0008-0000-0000-00000530B837 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0009-0000-0000-00001338C02F Message-Id: <1487879800-12352-13-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v4 12/15] target/ppc: update OV/OV32 for divide operations 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add helper_update_ov_isa300() in the int_helper for updating the overflow flags. For Divide Word: SO, OV, and OV32 bits reflects overflow of the 32-bit result For Divide DoubleWord: SO, OV, and OV32 bits reflects overflow of the 64-bit result Signed-off-by: Nikunj A Dadhania --- target/ppc/int_helper.c | 17 +++++++++++++++++ target/ppc/translate.c | 8 ++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index b0c3c2b..8cedce6 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -36,6 +36,23 @@ static inline void helper_update_ov_legacy(CPUPPCState *= env, int ov) } } =20 +static inline void helper_update_ov_isa300(CPUPPCState *env, int ov, int o= v32) +{ + env->xer =3D env->xer & ~(XER_OV | XER_OV32); + if (ov) { + env->xer |=3D XER_SO | XER_OV | XER_OV32; + } +} + +static inline void helper_update_ov(CPUPPCState *env, int ov) +{ + if (is_isa300(env)) { + helper_update_ov_isa300(env, ov, ov); + } else { + helper_update_ov_legacy(env, ov); + } +} + static inline void helper_update_ca(CPUPPCState *env, int ca) { env->xer =3D env->xer & ~(XER_CA); diff --git a/target/ppc/translate.c b/target/ppc/translate.c index e1105e8..f7d37b0 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1100,7 +1100,7 @@ static inline void gen_op_arith_divw(DisasContext *ct= x, TCGv ret, TCGv arg1, if (compute_ov) { TCGv ov =3D tcg_temp_new(); tcg_gen_extu_i32_tl(ov, t2); - gen_op_update_ov_legacy(ov); + gen_op_update_ov(ctx, ov, ov); tcg_temp_free(ov); } tcg_temp_free_i32(t0); @@ -1171,7 +1171,7 @@ static inline void gen_op_arith_divd(DisasContext *ct= x, TCGv ret, TCGv arg1, tcg_gen_divu_i64(ret, t0, t1); } if (compute_ov) { - gen_op_update_ov_legacy(t2); + gen_op_update_ov(ctx, t2, t2); } tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); @@ -1189,10 +1189,10 @@ static void glue(gen_, name)(DisasContext *ctx) cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], = \ sign, compute_ov); = \ } -/* divwu divwu. divwuo divwuo. */ +/* divdu divdu. divduo divduo. */ GEN_INT_ARITH_DIVD(divdu, 0x0E, 0, 0); GEN_INT_ARITH_DIVD(divduo, 0x1E, 0, 1); -/* divw divw. divwo divwo. */ +/* divd divd. divdo divdo. */ GEN_INT_ARITH_DIVD(divd, 0x0F, 1, 0); GEN_INT_ARITH_DIVD(divdo, 0x1F, 1, 1); =20 --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487882993110625.8695011636465; Thu, 23 Feb 2017 12:49:53 -0800 (PST) Received: from localhost ([::1]:32784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch0Km-0000Eh-2K for importer@patchew.org; Thu, 23 Feb 2017 15:49:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVm-0005QT-PU for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVl-0001nU-6q for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:10 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46958 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVk-0001mq-Ve for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:09 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJsArJ069998 for ; Thu, 23 Feb 2017 14:57:08 -0500 Received: from e28smtp02.in.ibm.com (e28smtp02.in.ibm.com [125.16.236.2]) by mx0b-001b2d01.pphosted.com with ESMTP id 28t39t0ek0-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:07 -0500 Received: from localhost by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:05 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp02.in.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:27:03 +0530 Received: from d28relay10.in.ibm.com (d28relay10.in.ibm.com [9.184.220.161]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 37C7CE0024; Fri, 24 Feb 2017 01:28:43 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay10.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJtx0H17563832; Fri, 24 Feb 2017 01:25:59 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJv2ZX024841; Fri, 24 Feb 2017 01:27:02 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVU024530; Fri, 24 Feb 2017 01:27:01 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:38 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022319-0004-0000-0000-00000542B858 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0005-0000-0000-0000133CC062 Message-Id: <1487879800-12352-14-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v4 13/15] target/ppc: update OV/OV32 flags for add/sub 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" * SO and OV reflects overflow of the 64-bit result in 64-bit mode and overflow of the low-order 32-bit result in 32-bit mode * OV32 reflects overflow of the low-order 32-bit independent of the mode Signed-off-by: Nikunj A Dadhania --- target/ppc/translate.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index f7d37b0..dc75cca 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -874,6 +874,7 @@ static inline void gen_op_arith_compute_ov(DisasContext= *ctx, TCGv arg0, { TCGv t0 =3D tcg_temp_new(); TCGv ov =3D tcg_temp_new(); + TCGv ov32 =3D tcg_temp_new(); =20 tcg_gen_xor_tl(ov, arg0, arg2); tcg_gen_xor_tl(t0, arg1, arg2); @@ -884,11 +885,19 @@ static inline void gen_op_arith_compute_ov(DisasConte= xt *ctx, TCGv arg0, } tcg_temp_free(t0); if (NARROW_MODE(ctx)) { - tcg_gen_ext32s_tl(ov, ov); + tcg_gen_extract_tl(ov, ov, 31, 1); + if (is_isa300(ctx)) { + tcg_gen_mov_tl(ov32, ov); + } + } else { + if (is_isa300(ctx)) { + tcg_gen_extract_tl(ov32, ov, 31, 1); + } + tcg_gen_extract_tl(ov, ov, 63, 1); } - tcg_gen_shri_tl(ov, ov, TARGET_LONG_BITS - 1); - gen_op_update_ov_legacy(ov); + gen_op_update_ov(ctx, ov, ov32); tcg_temp_free(ov); + tcg_temp_free(ov32); } =20 static inline void gen_op_arith_compute_ca32(DisasContext *ctx, TCGv ca32, --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148788198959244.79925171578327; Thu, 23 Feb 2017 12:33:09 -0800 (PST) Received: from localhost ([::1]:60899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch04a-0000RX-90 for importer@patchew.org; Thu, 23 Feb 2017 15:33:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVs-0005nA-6J for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVo-0001pu-3v for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:16 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38514 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVn-0001pa-UP for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:12 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJrcBw157279 for ; Thu, 23 Feb 2017 14:57:11 -0500 Received: from e28smtp06.in.ibm.com (e28smtp06.in.ibm.com [125.16.236.6]) by mx0b-001b2d01.pphosted.com with ESMTP id 28t1a1xxtc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:10 -0500 Received: from localhost by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:07 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:27:04 +0530 Received: from d28relay10.in.ibm.com (d28relay10.in.ibm.com [9.184.220.161]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 1180B394004E; Fri, 24 Feb 2017 01:27:04 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay10.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJtxNO17563836; Fri, 24 Feb 2017 01:25:59 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJv2KN024866; Fri, 24 Feb 2017 01:27:03 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVV024530; Fri, 24 Feb 2017 01:27:02 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:39 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022319-0020-0000-0000-000000C1BBA5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0021-0000-0000-0000027DC352 Message-Id: <1487879800-12352-15-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v4 14/15] target/ppc: use tcg ops for neg instruction 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: 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: Nikunj A Dadhania Reviewed-by: Richard Henderson --- target/ppc/translate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index dc75cca..5af9667 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1583,7 +1583,10 @@ static inline void gen_op_arith_neg(DisasContext *ct= x, bool compute_ov) =20 static void gen_neg(DisasContext *ctx) { - gen_op_arith_neg(ctx, 0); + tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); + if (unlikely(Rc(ctx->opcode))) { + gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 static void gen_nego(DisasContext *ctx) --=20 2.7.4 From nobody Thu May 2 02:39:52 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487883376442131.30958872167673; Thu, 23 Feb 2017 12:56:16 -0800 (PST) Received: from localhost ([::1]:32812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch0Qx-0003un-89 for importer@patchew.org; Thu, 23 Feb 2017 15:56:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgzVo-0005XJ-F1 for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgzVm-0001pJ-W1 for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:12 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33104) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgzVm-0001oR-NS for qemu-devel@nongnu.org; Thu, 23 Feb 2017 14:57:10 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NJtDA5061201 for ; Thu, 23 Feb 2017 14:57:09 -0500 Received: from e28smtp03.in.ibm.com (e28smtp03.in.ibm.com [125.16.236.3]) by mx0a-001b2d01.pphosted.com with ESMTP id 28sp4jssq1-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 14:57:09 -0500 Received: from localhost by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 01:27:06 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp03.in.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 01:27:05 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 8E17AE0024; Fri, 24 Feb 2017 01:28:44 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay05.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NJv1fw11665520; Fri, 24 Feb 2017 01:27:01 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NJv3Hm024890; Fri, 24 Feb 2017 01:27:04 +0530 Received: from abhimanyu.in.ibm.com ([9.102.3.191]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NJurVW024530; Fri, 24 Feb 2017 01:27:03 +0530 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Date: Fri, 24 Feb 2017 01:26:40 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1487879800-12352-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022319-0008-0000-0000-00000530B839 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022319-0009-0000-0000-00001338C031 Message-Id: <1487879800-12352-16-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230177 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v4 15/15] target/ppc: add mcrxrx instruction 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-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" mcrxrx: Move to CR from XER Extended Signed-off-by: Nikunj A Dadhania --- target/ppc/translate.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 5af9667..f4e41e5 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -3886,6 +3886,32 @@ static void gen_mcrxr(DisasContext *ctx) tcg_temp_free(t0); } =20 +#ifdef TARGET_PPC64 +/* mcrxrx */ +static void gen_mcrxrx(DisasContext *ctx) +{ + TCGv t0 =3D tcg_temp_new(); + TCGv t1 =3D tcg_temp_new(); + TCGv_i32 dst =3D cpu_crf[crfD(ctx->opcode)]; + + /* copy OV and OV32 */ + tcg_gen_extract_tl(t0, cpu_xer, XER_OV_BIT, 1); + tcg_gen_extract_tl(t1, cpu_xer, XER_OV32_BIT, 1); + tcg_gen_shli_tl(t0, t0, 1); + tcg_gen_or_tl(t0, t0, t1); + tcg_gen_shli_tl(t0, t0, 1); + /* copy CA and CA32 */ + tcg_gen_extract_tl(t1, cpu_xer, XER_CA_BIT, 1); + tcg_gen_or_tl(t0, t0, t1); + tcg_gen_shli_tl(t0, t0, 1); + tcg_gen_extract_tl(t1, cpu_xer, XER_CA32_BIT, 1); + tcg_gen_or_tl(t0, t0, t1); + tcg_gen_trunc_tl_i32(dst, t0); + tcg_temp_free(t0); + tcg_temp_free(t1); +} +#endif + /* mfcr mfocrf */ static void gen_mfcr(DisasContext *ctx) { @@ -6584,6 +6610,7 @@ GEN_HANDLER(mtcrf, 0x1F, 0x10, 0x04, 0x00000801, PPC_= MISC), #if defined(TARGET_PPC64) GEN_HANDLER(mtmsrd, 0x1F, 0x12, 0x05, 0x001EF801, PPC_64B), GEN_HANDLER_E(setb, 0x1F, 0x00, 0x04, 0x0003F801, PPC_NONE, PPC2_ISA300), +GEN_HANDLER_E(mcrxrx, 0x1F, 0x00, 0x12, 0x007FF801, PPC_NONE, PPC2_ISA300), #endif GEN_HANDLER(mtmsr, 0x1F, 0x12, 0x04, 0x001EF801, PPC_MISC), GEN_HANDLER(mtspr, 0x1F, 0x13, 0x0E, 0x00000000, PPC_MISC), --=20 2.7.4