From nobody Tue Oct 28 04:16:44 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 1515030003862312.19659567482597; Wed, 3 Jan 2018 17:40:03 -0800 (PST) Received: from localhost ([::1]:44739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWuVf-00088Z-H6 for importer@patchew.org; Wed, 03 Jan 2018 20:39:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWuLV-0000ts-LG for qemu-devel@nongnu.org; Wed, 03 Jan 2018 20:29:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWuLU-0007Bv-GR for qemu-devel@nongnu.org; Wed, 03 Jan 2018 20:29:25 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:56562) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eWuLU-0007Ar-4S for qemu-devel@nongnu.org; Wed, 03 Jan 2018 20:29:24 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.183]) with ESMTPSA (Nemesis) id 0Lbr40-1fDhsD3x3M-00jIQI; Thu, 04 Jan 2018 02:29:22 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 4 Jan 2018 02:29:09 +0100 Message-Id: <20180104012913.30763-14-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180104012913.30763-1-laurent@vivier.eu> References: <20180104012913.30763-1-laurent@vivier.eu> X-Provags-ID: V03:K0:zfI/AxSTD69XmgC1YAkYTvxl2EislXqfm/sbTUIoOsKsPlOPSSH 0n2ET7jVlcodkuOqpra+bNjZaspTgs4Rsjo00x5k7EuQbOdrdmw9Sjd2ko2eIreK5KPuhid 4DZbj0gTC6IDlie/iXra2aHktLkAHaS3eo1qZRg+gcMxV6iArxXR4h2LBtXXVP8/EF3hoYk gok3l5Dl/XJQwcjOskD4Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:wxg3z4CTqNg=:kMDOSH+QVvWsn0xMa/78/b +KbYRPTGbxf1LDpkwkyHXzx7PUzw7BsyNOEuvxNytcux1SdL60BwpXupdAYh7J6yOY1zmuVVJ TlT2iwryM/hEBpYIzkfXR5icNzpB8IZO73SSdCrShIedmh2CdysUDLUyj/xtlxS8DZ6Xpq/N3 Fm6/TRQaLvOk0inLy35s8h2/wfkdn3hCj1+q6hTvhmFAHnPYyQl4K8vSf0Z9Bv62iI8ah5+3B G/6kywqee0hmQJWicy6Pktdlzb1Put3RZr7joeogHYkeEteVoZ4/Vf6lLhba6pKdSpaDvmkAc pF1Vl64rFN0hFhiwyIG5S/A3FalqGFr6Z0tTm/ddSnGENMLT54XsiI83/xfoFxKt5SxAPhntI U6qoEey72gW1XrcrSkx4dQIOcxVfEjLsg/rdu1+MVlC8QJlZUttyYkoPr2dphlBRseQMSF1We YWU09ewCfqRHxP9UrCz2yDEUshNmTs62AV6CcEJ1BD+G+ORblOtHJ7aybBTE1UFwGWL/twA82 Nk+TXfdEQ2BotBMagcOjR54pqDDpDf8cFDLwdLYN0a8xAlBLlNQa8VguiOvi2bWiKb3xsQDm6 76h8nZSO1wG3eXg1Aul1NnKVUBQlCfHqwNb9iVv0LhqqGz2ZyAHldNJ6flWqmGj2SY+8C4Fr+ qe2zz9mkMzUVfvgpc6P1Zwk5o7UjQbHJtzqEkqcObZw75XJCQ545/KSySIXlUktMuIKHsiK55 rf3BuYHpTcBa9/euirc7/T4J2oWj7NMzA2XyVQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.24 Subject: [Qemu-devel] [PATCH v7 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 b8ed85c237..1f867a4f7a 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); @@ -4359,18 +4370,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