From patchwork Wed May 4 21:21:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 9018951 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0B44DBF440 for ; Wed, 4 May 2016 21:27:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 515ED203EB for ; Wed, 4 May 2016 21:27:08 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id E49D2203DF for ; Wed, 4 May 2016 21:27:06 +0000 (UTC) Received: from localhost ([::1]:50391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay4Jy-0001Ph-Up for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 May 2016 17:27:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay4FK-0000s8-9w for qemu-devel@nongnu.org; Wed, 04 May 2016 17:22:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ay4F0-0006X6-9a for qemu-devel@nongnu.org; Wed, 04 May 2016 17:22:08 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:54577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay4F0-0006PA-0L for qemu-devel@nongnu.org; Wed, 04 May 2016 17:21:54 -0400 Received: from Quad.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0MAuhQ-1aqKSf3o1s-009x3S; Wed, 04 May 2016 23:21:42 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 4 May 2016 23:21:07 +0200 Message-Id: <1462396869-22424-11-git-send-email-laurent@vivier.eu> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1462396869-22424-1-git-send-email-laurent@vivier.eu> References: <1462392752-17703-1-git-send-email-laurent@vivier.eu> <1462396869-22424-1-git-send-email-laurent@vivier.eu> X-Provags-ID: V03:K0:7RxLMhQrFZzrk/T9AwVD6GC1EyLQ495aHdQQQ4VrV81RMADKmMB VSVk7qwzRhCIdwcmwRKDhjONzB+kEnNCeMd5oXVdGYrYoYNO3i+29hns+F4H7/rlVU67GPC rYZuPUaSz53XuMBL8F3fjSoolIcBOnwowJx1hFg0ozEhaeRVLN9wIPhvcYaW+O9cYADe5hf 0z31NDtJz2zVOW6NKHVQA== X-UI-Out-Filterresults: notjunk:1; V01:K0:8uxX//NHU78=:7W366kvtfHWNvNQGe6zOHq nD15OCxB1Iq2t+5jOmmy4xgd7ehx+W+OojqR3edEElpzd9OdRAT3MWDOWOlO6m3yO3N5Sfq8/ l17uxu3NDZM2tPPEw1iZlDM4plmzl4U+PXWC59XGfUwdVMWwC81AEwc0+girEu6SDbkQ19Yk2 kp4HoJ/Vq8RpAVT6JpjXSGOyZqJxk1S4y+c8ANYCCoOYL4YeWZ8ko3CNqtnO75M2ZJO6qJXxr 7pVNrgcF5vQI4Tqd+fql80j0F/udl08neL2VDelYecwnhVlw3OzHYJ6RVDD3ZI+HyC6rXfwkj H9rTuYPbI7abRbnkjMouw673zVhu1yDKqwKLGMRme/ysDGULZv6EjLRmezFE0E6Mf5NFJVKbi 5/Gguw+bJsaZ7vSqHpe9q2CM/DZZC62bHjjtzRfkKT6SgHiekJDvRoBCxy8jr2+5Y8RdD3R/I 8U5bsfl5i3nJgTO3aPDJwY0txPMFn0IbG5jsYVdrfOw4YECO9LMIETK5C1K4a93ZgEMQNt/z4 Jo/LbYMUn7Qklf9Vo0zs6qmT4J5ZPnhr3jZFP0c2caSSni/X8EiXF6gKVTy9XdekmlsDJ5oij PgaCfdz9odhxi3pK67fephruuVErew1P7veJi6Sf3VAkUHn2cr3ElWWHAauKmK89R5RunGiEx 6VqB/GgTw5eRc0KzazuKMN8/5Bt3v/6Htqt5l3mYjBwr1HpfQp6/sE5rtOn2zbshKMQw= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.73 Subject: [Qemu-devel] [PATCH 50/52] 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, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org 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 a22ee67..029c166 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -1842,52 +1842,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)); - set_cc_op(s, CC_OP_SUB); + 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)); - tcg_gen_setcondi_i32(TCG_COND_LTU, QREG_CC_X, dest, im); - set_cc_op(s, CC_OP_ADD); + 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)); - set_cc_op(s, CC_OP_CMP); + 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(cas)