From nobody Tue Oct 28 04:13:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; 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 1514937102336770.3633349506864; Tue, 2 Jan 2018 15:51:42 -0800 (PST) Received: from localhost ([::1]:59675 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWWLK-0006qE-Ap for importer@patchew.org; Tue, 02 Jan 2018 18:51:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWWBT-00079F-Mj for qemu-devel@nongnu.org; Tue, 02 Jan 2018 18:41:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWWBS-0003AZ-JE for qemu-devel@nongnu.org; Tue, 02 Jan 2018 18:41:27 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:64309) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eWWBS-0003A5-7Y for qemu-devel@nongnu.org; Tue, 02 Jan 2018 18:41:26 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.167]) with ESMTPSA (Nemesis) id 0LoMUn-1f8Iqg3cwD-00gF2q; Wed, 03 Jan 2018 00:41:24 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 3 Jan 2018 00:41:04 +0100 Message-Id: <20180102234108.32713-14-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180102234108.32713-1-laurent@vivier.eu> References: <20180102234108.32713-1-laurent@vivier.eu> X-Provags-ID: V03:K0:IW9A+Oxe2J48x9ubsOxzFrLDi/Fch8+l0bJwP9G+X2mpCVcuoR9 yqz+7zE85r85+odlKANcstDM4veMb8xjwUPgAFDjnUorXrtYBMogihbiHMLpCs5pkQGtOWQ x+rJ8mzybqwxp7ZQCPXDBgoSMh+Hja9Ua+/3IOo64IFG9L1SX4apsvruIHpTygI71iTjB3N mzLqTmhkGMMSg71wSZKrw== X-UI-Out-Filterresults: notjunk:1;V01:K0:gNrq+4LU+2o=:+75/MCWp9EouZqaVM36up4 s+JdlJWz26SMd+K5u7T7iVosfPZ1/I1cyIXXxZI1CZfZPNaNjcCpdP9XQ+NnLfowpKmvNR6FX 5yqURvRTzJLB9Y07eNT32l7Ue/5K8TKLQ+9Agr5qCgeXu+0obBp7SvHSVAlt7ra4dZACu77+y 0NMyNdFTDjQ2UeIlzQDuzhed62zsmTX+n4a8iDVY7NAH+73fggr3gmuVw0NEQlJRPcEKXqTT5 yMSE08WocCtdGywFjpdUjqkUo4of3NFhU09oKFeeio1aRp9HeTgiWrLWy9UyJcWD5I7nTOsE4 G12BuabTyuz48jJtbZFv9g8Mmu4zqvEg/AHikoajF1IACuvSkODnCD6eIDh5Q9dqv0nanwfpn m4FljPXx7lzy3qJpOLBnRCyS5U3PKxpvoE99AGjs734WrV4w7tZ8UqI2Dc/oaUkRwIfK0dqF7 bE0GRK/rwth4itA57TIlfW1SAjWsAOPufsYk9x1drvJ1icbGGeKMUrDIIbC5P1HlRY/xFIhaj pBmI6KLE8U59y2AXRDSIcOLvmraCKYjC8ipm/ZZg5Nd8zm22xgE4Mzt/32KWEPSvsgZTiTrWR okQVo2xTGqrjazkaxFTkBlnjCuux+gY0I7g+Qif/TZ/ozWoZuq76ryD0AJP6cHesvnCaQqaKb xIWWIY9hD8caYnErnfwjUmkos0KuFoJOpQX5M7cxGQyL4jCSB/rdX3SWWM2QUevjASuIm+/g+ 1I8kzbmQr3G8igk/hylpb9JQmWwbXdmJFuAK2w== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.134 Subject: [Qemu-devel] [PATCH v6 13/17] target/m68k: move CCR/SR functions 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: Thomas Huth , Richard Henderson , Laurent Vivier 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" The following patches will be clearer if we move functions before adding new ones. Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- target/m68k/translate.c | 111 ++++++++++++++++++++++++--------------------= ---- 1 file changed, 55 insertions(+), 56 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index baaa260875..d879574c1a 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -2131,6 +2131,61 @@ DISAS_INSN(bitop_im) } } =20 +static TCGv gen_get_ccr(DisasContext *s) +{ + TCGv dest; + + update_cc_op(s); + dest =3D tcg_temp_new(); + gen_helper_get_ccr(dest, cpu_env); + return dest; +} + +static TCGv gen_get_sr(DisasContext *s) +{ + TCGv ccr; + TCGv sr; + + ccr =3D gen_get_ccr(s); + sr =3D tcg_temp_new(); + tcg_gen_andi_i32(sr, QREG_SR, 0xffe0); + tcg_gen_or_i32(sr, sr, ccr); + return sr; +} + +static void gen_set_sr_im(DisasContext *s, uint16_t val, int ccr_only) +{ + if (ccr_only) { + tcg_gen_movi_i32(QREG_CC_C, val & CCF_C ? 1 : 0); + tcg_gen_movi_i32(QREG_CC_V, val & CCF_V ? -1 : 0); + tcg_gen_movi_i32(QREG_CC_Z, val & CCF_Z ? 0 : 1); + tcg_gen_movi_i32(QREG_CC_N, val & CCF_N ? -1 : 0); + tcg_gen_movi_i32(QREG_CC_X, val & CCF_X ? 1 : 0); + } else { + gen_helper_set_sr(cpu_env, tcg_const_i32(val)); + } + set_cc_op(s, CC_OP_FLAGS); +} + +static void gen_set_sr(CPUM68KState *env, DisasContext *s, uint16_t insn, + int ccr_only) +{ + if ((insn & 0x38) =3D=3D 0) { + if (ccr_only) { + gen_helper_set_ccr(cpu_env, DREG(insn, 0)); + } else { + gen_helper_set_sr(cpu_env, DREG(insn, 0)); + } + set_cc_op(s, CC_OP_FLAGS); + } else if ((insn & 0x3f) =3D=3D 0x3c) { + uint16_t val; + val =3D read_im16(env, s); + gen_set_sr_im(s, val, ccr_only); + } else { + disas_undef(env, s, insn); + } +} + DISAS_INSN(arith_im) { int op; @@ -2474,16 +2529,6 @@ DISAS_INSN(clr) tcg_temp_free(zero); } =20 -static TCGv gen_get_ccr(DisasContext *s) -{ - TCGv dest; - - update_cc_op(s); - dest =3D tcg_temp_new(); - gen_helper_get_ccr(dest, cpu_env); - return dest; -} - DISAS_INSN(move_from_ccr) { TCGv ccr; @@ -2510,40 +2555,6 @@ DISAS_INSN(neg) tcg_temp_free(dest); } =20 -static void gen_set_sr_im(DisasContext *s, uint16_t val, int ccr_only) -{ - if (ccr_only) { - tcg_gen_movi_i32(QREG_CC_C, val & CCF_C ? 1 : 0); - tcg_gen_movi_i32(QREG_CC_V, val & CCF_V ? -1 : 0); - tcg_gen_movi_i32(QREG_CC_Z, val & CCF_Z ? 0 : 1); - tcg_gen_movi_i32(QREG_CC_N, val & CCF_N ? -1 : 0); - tcg_gen_movi_i32(QREG_CC_X, val & CCF_X ? 1 : 0); - } else { - gen_helper_set_sr(cpu_env, tcg_const_i32(val)); - } - set_cc_op(s, CC_OP_FLAGS); -} - -static void gen_set_sr(CPUM68KState *env, DisasContext *s, uint16_t insn, - int ccr_only) -{ - if ((insn & 0x38) =3D=3D 0) { - if (ccr_only) { - gen_helper_set_ccr(cpu_env, DREG(insn, 0)); - } else { - gen_helper_set_sr(cpu_env, DREG(insn, 0)); - } - set_cc_op(s, CC_OP_FLAGS); - } else if ((insn & 0x3f) =3D=3D 0x3c) { - uint16_t val; - val =3D read_im16(env, s); - gen_set_sr_im(s, val, ccr_only); - } else { - disas_undef(env, s, insn); - } -} - - DISAS_INSN(move_to_ccr) { gen_set_sr(env, s, insn, 1); @@ -4360,18 +4371,6 @@ DISAS_INSN(move16_mem) } } =20 -static TCGv gen_get_sr(DisasContext *s) -{ - TCGv ccr; - TCGv sr; - - ccr =3D gen_get_ccr(s); - sr =3D tcg_temp_new(); - tcg_gen_andi_i32(sr, QREG_SR, 0xffe0); - tcg_gen_or_i32(sr, sr, ccr); - return sr; -} - DISAS_INSN(strldsr) { uint16_t ext; --=20 2.14.3