From patchwork Wed May 16 18:51:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 10404745 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 DC8E96037D for ; Wed, 16 May 2018 19:20:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD719286EB for ; Wed, 16 May 2018 19:20:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C25FB286F8; Wed, 16 May 2018 19:20:52 +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=-4.0 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, FSL_HELO_FAKE, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 2D140286A1 for ; Wed, 16 May 2018 19:20:51 +0000 (UTC) Received: from localhost ([::1]:34705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1yl-0001Ww-0P for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 May 2018 15:20:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1XB-0003H7-O4 for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ1X9-0000ng-97 for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:21 -0400 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]:40316) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJ1X9-0000nP-26 for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:19 -0400 Received: by mail-wm0-x230.google.com with SMTP id j5-v6so4229173wme.5 for ; Wed, 16 May 2018 11:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WTxWxrS7Rlf4+UXt3uiGMh/8ot6E3/hXW80Xg1jg8w8=; b=kq6xfAowUtLdih0v1V6o0oYbsr+bW8+CrA9pcAaqnChnbnna95ZKfTFg3U38fS9fBs MvfquWc7PwoSXxMBmwq/N8LFFmVpp8gYwO6WedLV2LrqOUbBpVH3gq8M8Y9bLBbZ+0qz DHWyjG4ZOtsEQAjyUm/25wtQUof86NG5fJdwGDQooNpfMfF+1SUk9VtFpoq0ZAN2xOOs Vl8+2J2zR9DKddaTMussydi2x4krcfmgVCc5HnZtRROJjS2IffGLrtrCvrfxhazMnY2R oUGzWWSxxnYwSjCrlDnsfVo/dm7a0znbyruTzzyOQj++U9XalJIR2fldHsR6Cu4oRrUg K8rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WTxWxrS7Rlf4+UXt3uiGMh/8ot6E3/hXW80Xg1jg8w8=; b=VBxb8XYZLvM/w/qpJp/QVyVQBh3kzCh9LZnxytKlptdvsfQSbhxRywv0VvkwX0F9De 0gRlz9hW/T660h7ny4OpRnmVc776vnY+zuzUxh51NkA/qUVPj0NTuzNN/125ROTaXvOh 3dlR7yLSBokOW4QBG3fM5PlhVL2vlwaCUY3+zI2s3/PnGKpcHChQRF9YIfW86oj11dfy mHvu8bdexxSZBMsfV9e96c5oG5MwKoCcqaM2g+m/fmuBhooaLfDrdETLKh+tNVqMRcDV Nw/Itd5qLX+aQaUmPJh4tEsSf+Mf8ulaSn97ctjtSVrdFg7ngw/6bUmY4sHFmp57s/nn Vmfg== X-Gm-Message-State: ALKqPwdacLwMtiJvw2Sx2RzGUx2YUIh6CymdrxQI0vePoKfIgDGw1Kn7 lFfj3vb5J2Z/7ax/vzz3c/N2CQ== X-Google-Smtp-Source: AB8JxZpkf17Rl52EdJ+SCTgUWd4lpv7vYB9Y44DdnzIFNJqsTwVE0rLAQDgekGDis61RDlslt21uHA== X-Received: by 2002:a2e:9b01:: with SMTP id u1-v6mr1323170lji.26.1526496737526; Wed, 16 May 2018 11:52:17 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id r15-v6sm532490ljh.6.2018.05.16.11.52.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 11:52:16 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Wed, 16 May 2018 20:51:26 +0200 Message-Id: <20180516185146.30708-19-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180516185146.30708-1-edgar.iglesias@gmail.com> References: <20180516185146.30708-1-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::230 Subject: [Qemu-devel] [PATCH v3 18/38] target-microblaze: dec_msr: Reuse more code when reg-decoding 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: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, sstabellini@kernel.org, sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com, alistair@alistair23.me, richard.henderson@linaro.org, frederic.konrad@adacore.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Reuse more code when decoding register numbers. No functional changes. Reviewed-by: Alistair Francis Reviewed-by: Richard Henderson Signed-off-by: Edgar E. Iglesias --- target/microblaze/translate.c | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index f623617fa0..675db78030 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -531,11 +531,9 @@ static void dec_msr(DisasContext *dc) case 1: msr_write(dc, cpu_R[dc->ra]); break; - case 0x3: - tcg_gen_mov_i32(cpu_SR[SR_EAR], cpu_R[dc->ra]); - break; - case 0x5: - tcg_gen_mov_i32(cpu_SR[SR_ESR], cpu_R[dc->ra]); + case SR_EAR: + case SR_ESR: + tcg_gen_mov_i32(cpu_SR[sr], cpu_R[dc->ra]); break; case 0x7: tcg_gen_andi_i32(cpu_SR[SR_FSR], cpu_R[dc->ra], 31); @@ -562,17 +560,11 @@ static void dec_msr(DisasContext *dc) case 1: msr_read(dc, cpu_R[dc->rd]); break; - case 0x3: - tcg_gen_mov_i32(cpu_R[dc->rd], cpu_SR[SR_EAR]); - break; - case 0x5: - tcg_gen_mov_i32(cpu_R[dc->rd], cpu_SR[SR_ESR]); - break; - case 0x7: - tcg_gen_mov_i32(cpu_R[dc->rd], cpu_SR[SR_FSR]); - break; - case 0xb: - tcg_gen_mov_i32(cpu_R[dc->rd], cpu_SR[SR_BTR]); + case SR_EAR: + case SR_ESR: + case SR_FSR: + case SR_BTR: + tcg_gen_mov_i32(cpu_R[dc->rd], cpu_SR[sr]); break; case 0x800: tcg_gen_ld_i32(cpu_R[dc->rd], @@ -582,19 +574,7 @@ static void dec_msr(DisasContext *dc) tcg_gen_ld_i32(cpu_R[dc->rd], cpu_env, offsetof(CPUMBState, shr)); break; - case 0x2000: - case 0x2001: - case 0x2002: - case 0x2003: - case 0x2004: - case 0x2005: - case 0x2006: - case 0x2007: - case 0x2008: - case 0x2009: - case 0x200a: - case 0x200b: - case 0x200c: + case 0x2000 ... 0x200c: rn = sr & 0xf; tcg_gen_ld_i32(cpu_R[dc->rd], cpu_env, offsetof(CPUMBState, pvr.regs[rn]));