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: 914888 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kq6xfAow"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40mPQc2Ryjz9s0y for ; Thu, 17 May 2018 05:20:08 +1000 (AEST) Received: from localhost ([::1]:34558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1y1-00004u-UQ for incoming@patchwork.ozlabs.org; Wed, 16 May 2018 15:20:06 -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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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]));