From patchwork Thu Jan 4 01:29:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 10143727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E971B6034B for ; Thu, 4 Jan 2018 01:39:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFDAD294D7 for ; Thu, 4 Jan 2018 01:39:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3D38294E2; Thu, 4 Jan 2018 01:39:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E135294D7 for ; Thu, 4 Jan 2018 01:39:11 +0000 (UTC) Received: from localhost ([::1]:44739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWuUw-00088Z-Ha for patchwork-qemu-devel@patchwork.kernel.org; Wed, 03 Jan 2018 20:39:10 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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) } } +static TCGv gen_get_ccr(DisasContext *s) +{ + TCGv dest; + + update_cc_op(s); + dest = tcg_temp_new(); + gen_helper_get_ccr(dest, cpu_env); + return dest; +} + +static TCGv gen_get_sr(DisasContext *s) +{ + TCGv ccr; + TCGv sr; + + ccr = gen_get_ccr(s); + sr = 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) == 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) == 0x3c) { + uint16_t val; + val = 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); } -static TCGv gen_get_ccr(DisasContext *s) -{ - TCGv dest; - - update_cc_op(s); - dest = 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); } -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) == 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) == 0x3c) { - uint16_t val; - val = 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) } } -static TCGv gen_get_sr(DisasContext *s) -{ - TCGv ccr; - TCGv sr; - - ccr = gen_get_ccr(s); - sr = 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;