From patchwork Mon Feb 11 10:06:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 10805457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E32E213A4 for ; Mon, 11 Feb 2019 10:07:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C800E29B30 for ; Mon, 11 Feb 2019 10:07:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB87A29D27; Mon, 11 Feb 2019 10:07:33 +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=-2.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,FROM_LOCAL_NOVOWEL,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D2EC29B30 for ; Mon, 11 Feb 2019 10:07:32 +0000 (UTC) Received: from localhost ([127.0.0.1]:47421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gt8Ut-0003U6-DV for patchwork-qemu-devel@patchwork.kernel.org; Mon, 11 Feb 2019 05:07:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gt8UG-0003U0-1e for qemu-devel@nongnu.org; Mon, 11 Feb 2019 05:06:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gt8UF-0005r0-BQ for qemu-devel@nongnu.org; Mon, 11 Feb 2019 05:06:52 -0500 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]:47082) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gt8UD-0005ox-DH for qemu-devel@nongnu.org; Mon, 11 Feb 2019 05:06:49 -0500 Received: by mail-lf1-x142.google.com with SMTP id f5so7216415lfc.13 for ; Mon, 11 Feb 2019 02:06:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=0wK7JxaHwwpAGRdp0BuJHcPgJsqy9hKVg2PY0WfT2m0=; b=g2xgdaoxTLl/UkE/GXcScJTwEfVG+mPp/fKqsMPXDzxUKdiXIjgQW4NcNMEQ99pFBY mahcBvKmy2CuOm3xdIBcdtNBY1E9YjM7bYTSIWjcS5EMaBXQH/3B0p14aPuV8kk2WfOS FCZ9PtSvh9P3yQgZv2VyCokdsuXHoVvMZTr1Jdc29s7697szMBGMBgUGtEjqGhVhyklV 9nNTXi3Y6Ll7EcXkGPz34KIYcrCVREVpGElijueaPu+Grit85Cphs5yRN12l4GegauR/ 2CjNJpaiLBdk/Gcri14u0Bocx1cZk8sH9HIBBzvppDyEHbyYYzvCZBQGD4WxfY0RobZu GJOA== 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; bh=0wK7JxaHwwpAGRdp0BuJHcPgJsqy9hKVg2PY0WfT2m0=; b=RBLqCA0tVLAAb3hUTewnAzfbUwX/H+kJHoaJGMswQX9n9n2ceQKJaEMdNysV2gw7Sa p8p4sLcNL6T80uEycTNt0apPC7BaonYc/WHobFt94xqtqOZvHc636xxW0Tk/ClScBh5a VI43FX/ABMtYqzinSSuDTt//x0JPXboL6g3h+u1fkl+moFNWyRrvXPbFfDjk77Y0IIGn dHJXB2Cur8UrO9i5lZp4RRxBsv+pouhYIi8pHLKR42dAeFNrp7sGlC6cU24F/dEyGOZt Q9jy1yW1P5xs9VSbRZ56L653DltdrgaQmzAwAYbvSf5y/oZ9b8+5tzOSKOu0IaO1WRf0 csBQ== X-Gm-Message-State: AHQUAuYOWPCRTmQO8lnjsO28fYN9l3PzpJ92jb0lpQktYGZJssEA4qca N+XsnkqKcQe4mi6Zg6urHsWjMsknvA4= X-Google-Smtp-Source: AHgI3Ia4KZ+p2hQknTxKKxofrgjxO3QznduXlUXd346be0FmogQRC+zrqYMaaWPBK7OG0DH52Ry7Pw== X-Received: by 2002:a19:5504:: with SMTP id n4mr4978505lfe.43.1549879605263; Mon, 11 Feb 2019 02:06:45 -0800 (PST) Received: from octofox.hsd1.ca.comcast.net. (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id l27sm1564304lfk.6.2019.02.11.02.06.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 02:06:44 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Date: Mon, 11 Feb 2019 02:06:31 -0800 Message-Id: <20190211100631.5263-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::142 Subject: [Qemu-devel] [PATCH] target/xtensa: get rid of gen_callw[i] 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: Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Merge gen_callwi and gen_callw into their only users, translate_callw and translate_callxw. Extract jump slot adjustment logic into a separate function and use it in gen_jumpi and translate_callw. Signed-off-by: Max Filippov --- target/xtensa/translate.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 6e4f0ad44c80..62283cd1ccc8 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -387,13 +387,19 @@ static void gen_jump(DisasContext *dc, TCGv dest) gen_jump_slot(dc, dest, -1); } -static void gen_jumpi(DisasContext *dc, uint32_t dest, int slot) +static int adjust_jump_slot(DisasContext *dc, uint32_t dest, int slot) { - TCGv_i32 tmp = tcg_const_i32(dest); if (((dc->base.pc_first ^ dest) & TARGET_PAGE_MASK) != 0) { - slot = -1; + return -1; + } else { + return slot; } - gen_jump_slot(dc, tmp, slot); +} + +static void gen_jumpi(DisasContext *dc, uint32_t dest, int slot) +{ + TCGv_i32 tmp = tcg_const_i32(dest); + gen_jump_slot(dc, tmp, adjust_jump_slot(dc, dest, slot)); tcg_temp_free(tmp); } @@ -410,21 +416,6 @@ static void gen_callw_slot(DisasContext *dc, int callinc, TCGv_i32 dest, gen_jump_slot(dc, dest, slot); } -static void gen_callw(DisasContext *dc, int callinc, TCGv_i32 dest) -{ - gen_callw_slot(dc, callinc, dest, -1); -} - -static void gen_callwi(DisasContext *dc, int callinc, uint32_t dest, int slot) -{ - TCGv_i32 tmp = tcg_const_i32(dest); - if (((dc->base.pc_first ^ dest) & TARGET_PAGE_MASK) != 0) { - slot = -1; - } - gen_callw_slot(dc, callinc, tmp, slot); - tcg_temp_free(tmp); -} - static bool gen_check_loop_end(DisasContext *dc, int slot) { if (dc->base.pc_next == dc->lend) { @@ -1477,7 +1468,9 @@ static void translate_call0(DisasContext *dc, const uint32_t arg[], static void translate_callw(DisasContext *dc, const uint32_t arg[], const uint32_t par[]) { - gen_callwi(dc, par[0], arg[0], 0); + TCGv_i32 tmp = tcg_const_i32(arg[0]); + gen_callw_slot(dc, par[0], tmp, adjust_jump_slot(dc, arg[0], 0)); + tcg_temp_free(tmp); } static void translate_callx0(DisasContext *dc, const uint32_t arg[], @@ -1496,7 +1489,7 @@ static void translate_callxw(DisasContext *dc, const uint32_t arg[], TCGv_i32 tmp = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp, cpu_R[arg[0]]); - gen_callw(dc, par[0], tmp); + gen_callw_slot(dc, par[0], tmp, -1); tcg_temp_free(tmp); }