From nobody Mon Feb 9 02:13:54 2026 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