From patchwork Tue May 29 10:50:06 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: 10434995 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 D7E72601E9 for ; Tue, 29 May 2018 11:09:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6D42286E3 for ; Tue, 29 May 2018 11:09:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B99D3286E5; Tue, 29 May 2018 11:09:05 +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=-3.8 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 42A9C286E3 for ; Tue, 29 May 2018 11:09:05 +0000 (UTC) Received: from localhost ([::1]:60183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNcUy-0007hC-3V for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 May 2018 07:09:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNcDe-0001u1-54 for qemu-devel@nongnu.org; Tue, 29 May 2018 06:51:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNcDd-0004Kg-C5 for qemu-devel@nongnu.org; Tue, 29 May 2018 06:51:10 -0400 Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]:45330) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNcDd-0004K4-5i for qemu-devel@nongnu.org; Tue, 29 May 2018 06:51:09 -0400 Received: by mail-wr0-x230.google.com with SMTP id w3-v6so24680245wrl.12 for ; Tue, 29 May 2018 03:51:08 -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=TC6W2A5ZCNupt6SjBAJ0xYHrP3d6Qs3gfDKnXiM8H8E=; b=DVT3v94eNuP1t3Wa/1sSbV7Ape3Trvs62TwsSq6ESN1gpQAAQSz+hkT9rUtZc1qTSG B7cP9XukY8HSj084a2xFqDU+0Om03xOSm6yZmisrXADPPmwyJQPqFVuB3hHB9eSQ6LKA VVBo3Ii3RdR86m7fHbtMR22toLOKwFFhnsi4HvI8MsSVCQOFFwmd5mOiB+1R+YYazENo jrwqru1ulZ0aK4tWnajtqCbRl/4HMtA/itTyFMsjGj1mXzsb8+Wn5gklg/JXR7HVnUEk GUyw505t1IBxfn4fWQw2u0Wy0LfLtPHBglJfrpKz6KDCmIe95eSBnPQdNNkpCRzlvldW RPuA== 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=TC6W2A5ZCNupt6SjBAJ0xYHrP3d6Qs3gfDKnXiM8H8E=; b=qQ/HoDk+0I+RF+ss3oCB1Dc6MhCHvoXT/SSCwSiLVsgmQ0askCW+M8eO3oJ69iseQV /ztuZMoKnE1xBiuLgcbYUCNS/zGyBxVrh0cCwAS8Vp+LAj3WQ2H7essV+VjG5iq4T3ja UQH3YQFe+jVvNwzseTWYv5vk66cm4l00T3D/8ntCfd3Xw23pek0iGr2Sg1b24CvAcNbD tQBBr5r19OhE3EhnudRS5AgpsE2IMl1ejSiTgBADeuyVKto9IWhrefZVvL4lFomOUWeY lDBGkRlhIYkhMP/j4rtlubMEnD+U5rZiwUJR7TL9Mq7REFvl7mKj67mS9tNmltHPKqyo vIDg== X-Gm-Message-State: ALKqPwc6u7J8ZIyyLgAG3oHf+a0VSBXPr6niDfQFKtJzInsKta/iW1ur jAp9GR5bAFPsVxQe53PhnUMDNQ== X-Google-Smtp-Source: ADUXVKLeU+5S4cy2m//C9B8QwcFjXspW0BUjMlZs6gfnypn3mfbVGpi4OHWLZbQM1ivovS0LSkwGyA== X-Received: by 2002:a19:16e1:: with SMTP id 94-v6mr9041694lfw.45.1527591067819; Tue, 29 May 2018 03:51:07 -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 l10-v6sm6373370lja.62.2018.05.29.03.51.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 03:51:06 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Tue, 29 May 2018 12:50:06 +0200 Message-Id: <20180529105011.1914-34-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180529105011.1914-1-edgar.iglesias@gmail.com> References: <20180529105011.1914-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::230 Subject: [Qemu-devel] [PULL v1 33/38] target-microblaze: Use table based condition-codes conversion 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 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 a table based conversion to map condition-codes between MicroBlaze ISA encoding and TCG. No functional change. Reviewed-by: Richard Henderson Signed-off-by: Edgar E. Iglesias --- target/microblaze/translate.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 0d8ef77513..092e182c2f 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1145,28 +1145,27 @@ static void dec_store(DisasContext *dc) static inline void eval_cc(DisasContext *dc, unsigned int cc, TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) { + static const int mb_to_tcg_cc[] = { + [CC_EQ] = TCG_COND_EQ, + [CC_NE] = TCG_COND_NE, + [CC_LT] = TCG_COND_LT, + [CC_LE] = TCG_COND_LE, + [CC_GE] = TCG_COND_GE, + [CC_GT] = TCG_COND_GT, + }; + switch (cc) { - case CC_EQ: - tcg_gen_setcond_i32(TCG_COND_EQ, d, a, b); - break; - case CC_NE: - tcg_gen_setcond_i32(TCG_COND_NE, d, a, b); - break; - case CC_LT: - tcg_gen_setcond_i32(TCG_COND_LT, d, a, b); - break; - case CC_LE: - tcg_gen_setcond_i32(TCG_COND_LE, d, a, b); - break; - case CC_GE: - tcg_gen_setcond_i32(TCG_COND_GE, d, a, b); - break; - case CC_GT: - tcg_gen_setcond_i32(TCG_COND_GT, d, a, b); - break; - default: - cpu_abort(CPU(dc->cpu), "Unknown condition code %x.\n", cc); - break; + case CC_EQ: + case CC_NE: + case CC_LT: + case CC_LE: + case CC_GE: + case CC_GT: + tcg_gen_setcond_i32(mb_to_tcg_cc[cc], d, a, b); + break; + default: + cpu_abort(CPU(dc->cpu), "Unknown condition code %x.\n", cc); + break; } }