From patchwork Fri Oct 28 08:48:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 9401609 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 ACBFB601C0 for ; Fri, 28 Oct 2016 08:50:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1AB22A681 for ; Fri, 28 Oct 2016 08:50:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 968AE2A683; Fri, 28 Oct 2016 08:50:45 +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.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 AC8842A681 for ; Fri, 28 Oct 2016 08:50:42 +0000 (UTC) Received: from localhost ([::1]:47526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c02s4-0006bG-Oh for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Oct 2016 04:50:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c02qb-0005p3-Bm for qemu-devel@nongnu.org; Fri, 28 Oct 2016 04:49:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c02qX-0003D2-BI for qemu-devel@nongnu.org; Fri, 28 Oct 2016 04:49:09 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:63653) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c02qX-0003CY-0J for qemu-devel@nongnu.org; Fri, 28 Oct 2016 04:49:05 -0400 Received: from Quad.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue002) with ESMTPSA (Nemesis) id 0LnXO3-1cXSBR0823-00hyLa; Fri, 28 Oct 2016 10:48:50 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 28 Oct 2016 10:48:31 +0200 Message-Id: <1477644512-21716-18-git-send-email-laurent@vivier.eu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477644512-21716-1-git-send-email-laurent@vivier.eu> References: <1477644512-21716-1-git-send-email-laurent@vivier.eu> X-Provags-ID: V03:K0:g29w09qmucDdbQ4OLTTPwJJWEKQmukv+58DLx6jYp0ta/WaEfp3 1y3yc/qRZEwOw0cRKv/XKG4+/VGluvqdl38j4t7FsPQygbzQgrd7Fnn/egJobaVrk6a6yPb l4/qwvUlrxPyf8+na3dsbBOheqwUVq44SP81Tz+J3i9J6uUU0zB68zSe0Zu4R9W84sjUgUL VtN3Yyok8izeBlgcHjWqw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Maw80LcsNY8=:2C4sRNy/rasHUUrmMj9ihh HmvdmbcG8Kyo0JO1EV8u5g1SAyNpxmOC5YHqwLHZNAvgRwUG4fHc5iwCLJcgpFuSbtV+gq3pm oPWI3PRcsDUQuceJ6ypDOO1l4XA7/raOkB66+2G+xLrXnFfBQ56muPhAkNfgAOAxEh1p2uYD9 FGsTAZ+Ls/15C2zZAuFxzRPFRr5hKWtTNgN/tFEUg8jPBu+d03/2bizadvD8GfD8fgSfP3dH4 Em3gYQmZaCY5d0FSXctYkXpPHi9teyDh2Qb5YxDL06QWwUcl1DjNh7gapVvb20iZ7FQdtu9ie HiE48unGvW6wAZpNlSFjyAqrG98pmJZvCvNz26YGpknIQyPEvk+P8U2xN13W57+B9LzlHM/yO JGDGFv+FALEE6X6+Jl6DYJE639dU5+RxfQRsipEY5Gi3ufgN0favqPP/0zEsuVnj2u2bVADg5 pwa2LonxzFosQOgl/Ond3oUfMvGq8iJLabdb08Z0X7AT4uYBqnpT3PzL0yVw29I7KCkOdnYVX OZqqyRGBlFyckgoiIKbaNZ0ln2s2Y1FUrMKQaPG0BBGaccMbVD5LcYSiGOZTHDp/B9cTWqBxl 5TthuJM726qkMHOKzPLcFKXaNnN7fJLEo8y/QROkDuDwL9DbfpchcYKVIbyLH3uQj1POqbznB u+6TqBCfHIB9jHPVFya0V6la4+xrK+Exz8T7BfChhxuXtyk5ppbo5+tvmQRVz5m5mr3I= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.134 Subject: [Qemu-devel] [PULL 17/18] target-m68k: immediate ops manage word and byte operands 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: Laurent Vivier , gerg@uclinux.org, schwab@linux-m68k.org, agraf@suse.de, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- target-m68k/translate.c | 57 ++++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/target-m68k/translate.c b/target-m68k/translate.c index 57ac2e5..ee0ffe3 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -1461,52 +1461,65 @@ DISAS_INSN(bitop_im) DISAS_INSN(arith_im) { int op; - uint32_t im; + TCGv im; TCGv src1; TCGv dest; TCGv addr; + int opsize; op = (insn >> 9) & 7; - SRC_EA(env, src1, OS_LONG, 0, (op == 6) ? NULL : &addr); - im = read_im32(env, s); + opsize = insn_opsize(insn); + switch (opsize) { + case OS_BYTE: + im = tcg_const_i32((int8_t)read_im8(env, s)); + break; + case OS_WORD: + im = tcg_const_i32((int16_t)read_im16(env, s)); + break; + case OS_LONG: + im = tcg_const_i32(read_im32(env, s)); + break; + default: + abort(); + } + SRC_EA(env, src1, opsize, 1, (op == 6) ? NULL : &addr); dest = tcg_temp_new(); switch (op) { case 0: /* ori */ - tcg_gen_ori_i32(dest, src1, im); - gen_logic_cc(s, dest, OS_LONG); + tcg_gen_or_i32(dest, src1, im); + gen_logic_cc(s, dest, opsize); break; case 1: /* andi */ - tcg_gen_andi_i32(dest, src1, im); - gen_logic_cc(s, dest, OS_LONG); + tcg_gen_and_i32(dest, src1, im); + gen_logic_cc(s, dest, opsize); break; case 2: /* subi */ - tcg_gen_mov_i32(dest, src1); - tcg_gen_setcondi_i32(TCG_COND_LTU, QREG_CC_X, dest, im); - tcg_gen_subi_i32(dest, dest, im); - gen_update_cc_add(dest, tcg_const_i32(im), OS_LONG); - set_cc_op(s, CC_OP_SUBL); + tcg_gen_setcond_i32(TCG_COND_LTU, QREG_CC_X, src1, im); + tcg_gen_sub_i32(dest, src1, im); + gen_update_cc_add(dest, im, opsize); + set_cc_op(s, CC_OP_SUBB + opsize); break; case 3: /* addi */ - tcg_gen_mov_i32(dest, src1); - tcg_gen_addi_i32(dest, dest, im); - gen_update_cc_add(dest, tcg_const_i32(im), OS_LONG); - tcg_gen_setcondi_i32(TCG_COND_LTU, QREG_CC_X, dest, im); - set_cc_op(s, CC_OP_ADDL); + tcg_gen_add_i32(dest, src1, im); + gen_update_cc_add(dest, im, opsize); + tcg_gen_setcond_i32(TCG_COND_LTU, QREG_CC_X, dest, im); + set_cc_op(s, CC_OP_ADDB + opsize); break; case 5: /* eori */ - tcg_gen_xori_i32(dest, src1, im); - gen_logic_cc(s, dest, OS_LONG); + tcg_gen_xor_i32(dest, src1, im); + gen_logic_cc(s, dest, opsize); break; case 6: /* cmpi */ - gen_update_cc_add(src1, tcg_const_i32(im), OS_LONG); - set_cc_op(s, CC_OP_CMPL); + gen_update_cc_cmp(s, src1, im, opsize); break; default: abort(); } + tcg_temp_free(im); if (op != 6) { - DEST_EA(env, insn, OS_LONG, dest, &addr); + DEST_EA(env, insn, opsize, dest, &addr); } + tcg_temp_free(dest); } DISAS_INSN(byterev)