From patchwork Sun Jun 20 21:32:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 464344 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:102:0:0:0:0 with SMTP id x2csp1984159jao; Sun, 20 Jun 2021 14:35:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAqDP+26zOi0mPSnTkKBRCcBw3hPX9jYVNBSCZqx/MMNijKnNoKPQ22GmxwjtL9cvLyuNj X-Received: by 2002:ac8:4c8c:: with SMTP id j12mr20710257qtv.390.1624224945582; Sun, 20 Jun 2021 14:35:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624224945; cv=none; d=google.com; s=arc-20160816; b=fjAgAHxOehKWW5Unb9kyx7U7d3GcbIiOKFUjQaKmd9ewdg8Woy8XM26V/8PIpkAfVm 6++QwnKL3VJTiB4qU/oDlB47eMaQrQeJh0ZGOUgGTjY1DBucTkqslM933giZ84y1+w6V yCDAukzQuJXPkXqWlLVChzCXCsVIh4nnscpRaArLnjiy+Q97eSjZKDWeOdTj/hK8ao6x JNmJ6ALxJ9weumN5XCgwAtdO8yX6G6MeULbo7sFKlc/7zLTdcgbvO8YYV5QoMI30zIIU q3vXwsVCRqcgJQZ2fucHCluaqHjvpZrK+RZ9yL8q59YGqYZkOzWjiov1m9BWE2RT8Jyn ZzEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=EMPtI6EgvV/WiXI17jvBtKPkWXlx76mMDamBhdAr7N4=; b=P+Y/mMS6YdQHI2xMdnJpU33l45CqpV+5LZkklrO//Bani9Gob3Efc8GTWPDc4p+HSl izEPOxxstZUvjIq+0VB+nw7pplwJBEjOeFPLY8lK8rAofOpfbIc8kKYGFoU+UZCKqidX 7H4tw5BfCcTW0mLjtN7ZuKFWArAEG74bp/oiOA8E+DJBrb7tU85kMOg5nN7bM6+zmo4y Bi6Wo9BSu5JUx3MWt2F8zFg6rhemqbrc2XdMs3IsY2hidvoOMsQ+314rZRw2ExblUabY zSuHbbpv7p2o5RHdapUqNRKMys8wlhQhs4EuykKsiVrz9yVMXpBcmscDJYjZcbQsv100 1aYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NFskWdxC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b20si9492717qkk.53.2021.06.20.14.35.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Jun 2021 14:35:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NFskWdxC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lv56W-0008LN-WB for patch@linaro.org; Sun, 20 Jun 2021 17:35:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lv53v-0002Sf-FA for qemu-devel@nongnu.org; Sun, 20 Jun 2021 17:33:03 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:42612) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lv53q-0008Ve-7A for qemu-devel@nongnu.org; Sun, 20 Jun 2021 17:33:03 -0400 Received: by mail-pl1-x636.google.com with SMTP id v13so7448243ple.9 for ; Sun, 20 Jun 2021 14:32:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EMPtI6EgvV/WiXI17jvBtKPkWXlx76mMDamBhdAr7N4=; b=NFskWdxC2hSl5DAKKXzUV6VjYI6M0308P+6QbjeNfODbA0ZWPyX8nRXSNXb8kW+I0+ VBLkarpPrG4dzhbd+QRPYS846r6h1ZBefVTQzroS9gOOr8gHl7nNHCP2ueUJIQl6bC/u /TMwkBLCZ6KSqWhOrj/sOiMmN4HhdHtiDoIilxct9KZZ6ltrejeVvf0LQ3p5/FZqXE0a pZQ13G5SyKrmSi09mg8ySSKONxLVCRoz8MUiId3VRroa3VoCbR8M6UErIQbJ1s3KjXKP +GSONPUkbFQb7ux2z/xubVJJcGhDVB9gF4UWDrGvu7JBD2zGsDNak7w6g+QC91dzELbQ rLoA== 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:mime-version:content-transfer-encoding; bh=EMPtI6EgvV/WiXI17jvBtKPkWXlx76mMDamBhdAr7N4=; b=XujEp9hxXNtPq7U+O09EbZz32IoaJhwITsUYiKH7UjKmSxr1AmGP/SKFWL/uh0rRC4 4P688x9iSJIt7tuRVLXoI0CAuKtZChUOI6BgLdPwcIaycd1UUFmpEAwwUjfaVUO5QqxK 92BFDS5t+TSqU8E0Pz4eRlBk29IG1Ro7MsOxOe/dGRiL0iZtkhBhshdvu0Laxoa0V+Vy m4HhNdm9oq4+eyYUJGYneZCDSRNkyoKbAubsYyUT4K+EOa8YiZiP/OQP0com9GuPeHXU G7gW/KXT7LTfB57cjJJRXdwOqeFVaRaG9+W7NadB6V1RAbenfe4nQzYxGS7Ua4hNAq+Z hFXQ== X-Gm-Message-State: AOAM533SJaMBfqhtyxHGGkq0Yn7HJcH7YeELmKnJpDciXYadYaTLVpsC Q2yMWGLT+sLDBDOUwwP+Ax5+j5EkgaisdA== X-Received: by 2002:a17:90a:fb51:: with SMTP id iq17mr23259567pjb.26.1624224776081; Sun, 20 Jun 2021 14:32:56 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id w21sm13608329pfq.143.2021.06.20.14.32.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Jun 2021 14:32:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 11/11] target/cris: Improve JMP_INDIRECT Date: Sun, 20 Jun 2021 14:32:49 -0700 Message-Id: <20210620213249.1494274-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210620213249.1494274-1-richard.henderson@linaro.org> References: <20210620213249.1494274-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@gmail.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use movcond instead of brcond to set env_pc. Discard the btarget and btaken variables to improve register allocation and avoid unnecessary writeback. Signed-off-by: Richard Henderson --- target/cris/translate.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) -- 2.25.1 diff --git a/target/cris/translate.c b/target/cris/translate.c index c33324b988..3200819f32 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -515,17 +515,6 @@ static void t_gen_swapr(TCGv d, TCGv s) tcg_temp_free(org_s); } -static void t_gen_cc_jmp(TCGv pc_true, TCGv pc_false) -{ - TCGLabel *l1 = gen_new_label(); - - /* Conditional jmp. */ - tcg_gen_mov_tl(env_pc, pc_false); - tcg_gen_brcondi_tl(TCG_COND_EQ, env_btaken, 0, l1); - tcg_gen_mov_tl(env_pc, pc_true); - gen_set_label(l1); -} - static bool use_goto_tb(DisasContext *dc, target_ulong dest) { return ((dest ^ dc->base.pc_first) & TARGET_PAGE_MASK) == 0; @@ -3302,8 +3291,17 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) /* fall through */ case JMP_INDIRECT: - t_gen_cc_jmp(env_btarget, tcg_constant_tl(npc)); + tcg_gen_movcond_tl(TCG_COND_NE, env_pc, + env_btaken, tcg_constant_tl(0), + env_btarget, tcg_constant_tl(npc)); is_jmp = DISAS_JUMP; + + /* + * We have consumed btaken and btarget. Hint to the + * tcg compiler that the writeback to env may be dropped. + */ + tcg_gen_discard_tl(env_btaken); + tcg_gen_discard_tl(env_btarget); break; default: