From patchwork Tue May 8 17:31:46 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: 10386757 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 92BD7602C2 for ; Tue, 8 May 2018 17:47:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87CC528E54 for ; Tue, 8 May 2018 17:47:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B4AB29119; Tue, 8 May 2018 17:47:04 +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 F17F828E54 for ; Tue, 8 May 2018 17:47:03 +0000 (UTC) Received: from localhost ([::1]:52637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG6hb-0004bX-5j for patchwork-qemu-devel@patchwork.kernel.org; Tue, 08 May 2018 13:47:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG6Tm-0000Hz-W3 for qemu-devel@nongnu.org; Tue, 08 May 2018 13:32:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG6Ti-0005af-4Z for qemu-devel@nongnu.org; Tue, 08 May 2018 13:32:47 -0400 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:33009) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fG6Th-0005aD-Td for qemu-devel@nongnu.org; Tue, 08 May 2018 13:32:42 -0400 Received: by mail-lf0-x242.google.com with SMTP id m18-v6so47060607lfb.0 for ; Tue, 08 May 2018 10:32: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=tnE4IPMn3iGmPsYOX+SQ6CBbEx9Ol0B1Rxzwh9ZgqzM=; b=EyVtoO3H8U20igXNNpqyIj3haRmg31ZHyQnGgdTb9s/QpAUTDi7HSpG8gKYr04u32c mkj63Re4+SUcjD/x+7Hx1lXuaFAKx6qaU9WPTFX7Odr1lcr1We3NqvMgYlCHFtkcLbNJ zGKUjiC3cHcNpia0MUO7fKsnEIKa1tWSDafUe1ktpw4uxTv0Rw/cmtiALcQtDih9zVs+ WIxzhxZW4kwvReqEmKKtAAHYPD5TtaZdOqQKV2yRfuP4sUxoLV/AX+IO3canjPH9zeIu fOGbkaZQbzf0nLMDKIEl3phloECfleKh9BoCAe6CycyxxL1YZwUtWIOXoosm73Jx7Vlz IbgA== 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=tnE4IPMn3iGmPsYOX+SQ6CBbEx9Ol0B1Rxzwh9ZgqzM=; b=c73290+dIu4Va5g3NFz4VTBsk+u7s1IStxEVWXfhcKPEktHLSVfNNldpc7LBCGKEGF rJU23hcJgZ4wcxTnDJrraInXb3ysaZiMTUsmo1mxgu0M7I4AwUgHITYDBFTO6EucD93R dIfhxYnHaAZkEsgPNdKARdJVrzVtEmZArYivDSdSgu19KPOKdQh+G6VETIibIShSAIVU lfolIHWA3kz6TUr8mZRZUtAO83dKlRXJOdioMwOoooXEC93tC2g4pUox+hrGnReDgQb6 e9QAkfKbIEs1bZthoJTCrulZt0jyoE7w0kujCph4e6JnR7wPfFYlxIWiiNyTYTWkrO5d /8fA== X-Gm-Message-State: ALQs6tCfsbxuzcD96GSuKnHU52LYYrNCXK0NrCkbkGpbmm6oRxydcLFW Axfo3mwLRcmEbJqmwabKKAqz2g== X-Google-Smtp-Source: AB8JxZqeydr6NMeNmYO9m9KfZYXdozRje3Dcy9tF0RNgn9csvZkiAOvIXFg2kWDS8Ixf8ICrzpTj3w== X-Received: by 2002:a19:de19:: with SMTP id v25-v6mr10866893lfg.28.1525800760459; Tue, 08 May 2018 10:32: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 b79-v6sm2022835lfe.28.2018.05.08.10.32.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 May 2018 10:32:39 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Tue, 8 May 2018 19:31:46 +0200 Message-Id: <20180508173152.29327-31-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180508173152.29327-1-edgar.iglesias@gmail.com> References: <20180508173152.29327-1-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::242 Subject: [Qemu-devel] [PATCH v2 30/36] target-microblaze: Simplify address computation using tcg_gen_addi_i32() 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, 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" Simplify address computation using tcg_gen_addi_i32(). tcg_gen_addi_i32() already optimizes the case when the immediate is zero. No functional change. Suggested-by: Richard Henderson Signed-off-by: Edgar E. Iglesias Reviewed-by: Richard Henderson --- target/microblaze/translate.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index bed86dc805..a987444f19 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -895,12 +895,7 @@ static inline void compute_ldst_addr(DisasContext *dc, bool ea, TCGv t) /* Immediate. */ t32 = tcg_temp_new_i32(); if (!extimm) { - if (dc->imm == 0) { - tcg_gen_mov_i32(t32, cpu_R[dc->ra]); - } else { - tcg_gen_movi_i32(t32, (int32_t)((int16_t)dc->imm)); - tcg_gen_add_i32(t32, cpu_R[dc->ra], t32); - } + tcg_gen_addi_i32(t32, cpu_R[dc->ra], (int16_t)dc->imm); } else { tcg_gen_add_i32(t32, cpu_R[dc->ra], *(dec_alu_op_b(dc))); }