From patchwork Wed May 16 18:51:41 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: 10404735 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 62C0C6037D for ; Wed, 16 May 2018 19:14:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 534D228674 for ; Wed, 16 May 2018 19:14:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 477842869A; Wed, 16 May 2018 19:14:21 +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 B424B28699 for ; Wed, 16 May 2018 19:14:20 +0000 (UTC) Received: from localhost ([::1]:34309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1sS-0004jn-0f for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 May 2018 15:14:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1XW-0003ah-PD for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ1XV-00010x-S7 for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:42 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:37879) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJ1XV-00010j-Lg for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:41 -0400 Received: by mail-wr0-x243.google.com with SMTP id h5-v6so2768127wrm.4 for ; Wed, 16 May 2018 11:52:41 -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=Fh3WpcT1leoS9KoNEvc9MfXrAeGcsclPkcj6Uea7oac=; b=LB5KmlTvFgY3wnXthR7KM6GTWmUApqVlPmef//97jCOhP20hWtgBdwuIkeEJoye3u6 63mDyLGZMor+wbmzB5qvUm/31DH/julHBV4fgqn9xAY0jjJdAu+8/3oHCzF4VU2GcUFY RJ+BjtZP9OWq03hCid7mIdBjkKonA8uD7r2oLwfw8jGz2yos0Bt4ErJNVKZ0HsI1Kzcy 8vxTtLBOEJIXJiK+LA2tTY7IXwmlqEDTWxIXtyeJWfTUaxi47RyfEFZAxNfypIJerN5C SHoiZ78AEzLnN+/G0PWwAq6bqcyldGDYtBYHFFOsm2GgculoS+CyP20QdcUNmlOxofp2 o8jw== 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=Fh3WpcT1leoS9KoNEvc9MfXrAeGcsclPkcj6Uea7oac=; b=gpgw9yl/yIgRMamQMN7WIXSe+d0Rd08D3a9OjQrunTBPumI0tZWfq5fcpQWRXsiARU ZXNJ9ZfgrW/80YZF8Zs7QiaHdFrdNXa2j7S6xlRUTd/VJJMvAWyHGHrr3RKIkhhn8KSi bVzBsAIFfvVAcsVX40EKRdUNrjrHBB1BAH5uyR9+Wn34jjMm42ZCaMZ5AKhq/nrXBVQj ovCAZgBiExZJAU35A2alH27Dt3g+R3Dl5D/T+A/ldzLQQVX6/wUrvID9sNaSewjwn1Au yFnKtG3+4ZB3YoM0Mi+oNc6Ptq5bKTiL8NRg5NEzcS1jALidQtRzanO/izFr8xSzxppq 93hQ== X-Gm-Message-State: ALKqPwecXecvZwjASfEQ5CdIF99Vp21VzmUeCcn7W4Xr4yMJhpWGTf20 rzrY5RaKle0uopluUFGY64U5AQ== X-Google-Smtp-Source: AB8JxZopoJp6EQskMQ5vsZuKH2RfY/KrkCRby+W6xFEeXhimzYaQzZJK2x6Sp4G1dN7Tb9dh+QYSNg== X-Received: by 2002:a19:a84f:: with SMTP id r76-v6mr16418105lfe.68.1526496760314; Wed, 16 May 2018 11:52:40 -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 c12-v6sm522485lji.59.2018.05.16.11.52.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 11:52:39 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Wed, 16 May 2018 20:51:41 +0200 Message-Id: <20180516185146.30708-34-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::243 Subject: [Qemu-devel] [PATCH v3 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, 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 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 44395cf189..ed0b6fa881 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; } }