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: 10404701 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 3A96C601F9 for ; Wed, 16 May 2018 19:05:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2733028671 for ; Wed, 16 May 2018 19:05:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1694128680; Wed, 16 May 2018 19:05:08 +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 4163028671 for ; Wed, 16 May 2018 19:05:04 +0000 (UTC) Received: from localhost ([::1]:34249 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1jT-0005R2-Rd for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 May 2018 15:05:03 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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);