From patchwork Wed May 16 18:51:25 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: 914868 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="bgdhonQ3"; 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 40mP4N4krRz9s1B for ; Thu, 17 May 2018 05:04:20 +1000 (AEST) Received: from localhost ([::1]:34238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1ik-00047v-6d for incoming@patchwork.ozlabs.org; Wed, 16 May 2018 15:04:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1X8-0003E4-FJ for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ1X7-0000n6-Om for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:18 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:41365) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJ1X7-0000mX-Hq for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:17 -0400 Received: by mail-wr0-x244.google.com with SMTP id g21-v6so2765954wrb.8 for ; Wed, 16 May 2018 11:52:17 -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=YgXogpiFUW9UC8zbijfwimE9P3gckf5axzu4VqoR++k=; b=bgdhonQ3txEHr8xeUVtu04EImxFG2LZGVBzGtwPrhMH4kGk+leGXyw6/cpv6SgJb9m oK/i5Y6dE8lEulhDMM0bnoiGBUYt5CJvDai3F7raYNgPb0ucaDrpS52uiKfiLXsnDKRH x5cZXuRWCLjK773OKkjbwuq9LHJGDrQfgPd4UNjmWK4SChPdimpbtCU0hZZLRzyCmPGN 0tvmeFm1Ei5Omevr0+/AQbrg3wFx+HVnI2/xEGUW93xXQU5oJBlIQUjdsbthGKbGBHE1 rvujDDXEFrHQzow3IF8fc5IIKxEgPMsGX5NZ8o4haFmx7TBLKy7nTNxt/F4tGzNvFlLj DD6Q== 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=YgXogpiFUW9UC8zbijfwimE9P3gckf5axzu4VqoR++k=; b=R3tqQOUVaUSE/IVAyzVEhwV9wEiU2Fw2VMwwfnn5/VPyW6HDkc7l63EHJZ7zgTsEBS qColdzSLiguPcxZAe+gIp+upNP0E4iM6N3aYKNaXA8w8+u/e9A1JLuDJwVS9YqtK2Anx fHcUMJTie7ZuCiajxtwYQtpGchQd5nKd5Wttv30ejAuc66tHcbO7V2tA+rF0+VY3D0qQ WbN/vcRBUDqfyaeZ93B/lGewQaIJKdD5DvHEUGMnv2SLHZ2n7AWRLpFntygMypHO0mwk RfgAX4QIE9HCOJdaSElPObDVFB2GFZo+GuqvMoNFsHwS825aprCGr9x3RNTTdGE3g8MV If7Q== X-Gm-Message-State: ALKqPwezpBlyHhbm2q+u2/6jYkDI2M4IUKwQDQKKw7N8msFHFpb1Yt+T ZZjpOIcxAEt/JK7Mk2qNqVYLDw== X-Google-Smtp-Source: AB8JxZq6fSAhOIZnW8+sYKmPguwOMx6XPBsHq3/2qZlpLH4OQj5HWGJetNkjIOI6rF2qojWML2Uc6Q== X-Received: by 2002:a19:4f4c:: with SMTP id a12-v6mr15429682lfk.97.1526496736027; Wed, 16 May 2018 11:52:16 -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 l14-v6sm782025lfi.7.2018.05.16.11.52.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 11:52:15 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Wed, 16 May 2018 20:51:25 +0200 Message-Id: <20180516185146.30708-18-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:c0c::244 Subject: [Qemu-devel] [PATCH v3 17/38] target-microblaze: dec_msr: Use bool and extract32 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" Use bool and extract32 to represent the to, clr and clrset flags. No functional change. Reviewed-by: Alistair Francis Reviewed-by: Richard Henderson Signed-off-by: Edgar E. Iglesias --- target/microblaze/translate.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index b0a76fb23b..f623617fa0 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -458,17 +458,20 @@ static void dec_msr(DisasContext *dc) { CPUState *cs = CPU(dc->cpu); TCGv_i32 t0, t1; - unsigned int sr, to, rn; + unsigned int sr, rn; + bool to, clrset; - sr = dc->imm & ((1 << 14) - 1); - to = dc->imm & (1 << 14); + sr = extract32(dc->imm, 0, 14); + to = extract32(dc->imm, 14, 1); + clrset = extract32(dc->imm, 15, 1) == 0; dc->type_b = 1; - if (to) + if (to) { dc->cpustate_changed = 1; + } /* msrclr and msrset. */ - if (!(dc->imm & (1 << 15))) { - unsigned int clr = dc->ir & (1 << 16); + if (clrset) { + bool clr = extract32(dc->ir, 16, 1); LOG_DIS("msr%s r%d imm=%x\n", clr ? "clr" : "set", dc->rd, dc->imm);