From patchwork Fri Feb 2 05:49:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 769132 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp753479wrc; Thu, 1 Feb 2024 21:51:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFo1peG4hI+r6k+ET2FBj6CbMxvOzDVSXorUXXEOSJla5r+0PSX24TUhOyciv0DZnkmqI4I X-Received: by 2002:a05:6214:1d22:b0:686:9442:9059 with SMTP id f2-20020a0562141d2200b0068694429059mr2483856qvd.3.1706853101567; Thu, 01 Feb 2024 21:51:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706853101; cv=none; d=google.com; s=arc-20160816; b=VE48FHyDwSiJBuzTAUp9YIrwXG80tVdA0u8aRFDRFpsMfamRX+wdAfRF12VBkdoXle C8aRJ3a96m9s1Gfo5p9ETLJpqT9Bo/qq2AnwPaiwz61XuHNTBTBmat5oEyxBUzWq+z7J B+kgfFErDPJ6GuaBVxG6zIJB2Em0fN+4uyEU/HdZS6GP7sDR/JLx9WNeytOloYVSROmq 22uGns9guCLG06dbh8OvfKOTDDAuZE74Mh/Vk5XIaMJBm1iZzKG6Ds1P0ygjClwYCQLy mawqEvN0NthwuJ5jVf3sQ/oyBffB/uIU0AOgTGu7D+EjG4JryaVzJGBZyrzEW2XeirFj 4/cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=2CLw1/Gtxm8k7/hVT+/nUKJ1+Eret/bnzWs0hJWPqBU=; fh=YyU8sdN3nbJtzkT/ehukT3qoA1WwzUmgD9JixwE+h1w=; b=JNNgvu7ahtpYNbiN/Se5gbiGX2ra2xC8dEYH8lVSYfOXlO5I6jVYWRwFWW5XzFvWCM 0wWI1pNgTzvLridkXOH4D4VDWzEObNvUejA3yQdWIJqX1XH95CjWO6uyRnfNguvBoTtT /lpFkzhSCk5bNLzNgL6/hBTXTjPzM4RBz+kdBzISp4Cd2SvQkch2YuxqCtz7ncBjmkeX UHNStSKZIXiFtn0Ph39PofKPS0zOdcNxCJX5g1kZV6LeS5z9UuTrQoljQZKAIe2/KUU6 ruD5Wq4rMI52nCYcsm1DuFiAgffp89rFnFCccaysYNBSte5OYcvGZdQ7Wj4yLTBg7uFH /hdQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LRi6k5Yh; 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 X-Forwarded-Encrypted: i=0; AJvYcCW0QAPhqzRczpxGNHa9q2KBS2pUrVP5bflNqM2gB2wlz08jTc+s0lE2cw8zaSpxlP43e6m7+o3HBRZ6OwcfsjfF Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d18-20020a05621416d200b0068c6f395481si1240688qvz.152.2024.02.01.21.51.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2024 21:51:41 -0800 (PST) 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=LRi6k5Yh; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVmS5-0001BL-Sx; Fri, 02 Feb 2024 00:51:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVmS4-0001Ad-3a for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:51:00 -0500 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVmS2-0001ej-DN for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:50:59 -0500 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-5d7005ea1d0so316617a12.1 for ; Thu, 01 Feb 2024 21:50:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706853057; x=1707457857; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2CLw1/Gtxm8k7/hVT+/nUKJ1+Eret/bnzWs0hJWPqBU=; b=LRi6k5Yhvqbq4I+mjtEtyFUxZSE4uzoPsDSqx3C/vAjhvcfRO+MMhZ/C15u8Ycg+LQ ViF9083iKb+tRqRwmc8/7nwe6YV8Agx12G8k/75nFFKltvlZ5G5cGHcmnUnGQKwMrqdW uPEkrD7Or5qYEuuwG3uWaX1tS1yJOV1WTYdV5av+QMzNfBrkv5bojp4spfaUNHA3ZuaN 4jNikSBmlch61KgXHoC9V49OSrylRYqWDESo/L0G1Cqu+JrXnJ4TVRgsyvG6RFog6pFW 1pvBysSxr8Imc81FHVnDGFvDGt2eonYqms7C7Dw8aQrGLYAP0OmuMJvsEU2RRcKttDeG 5rDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706853057; x=1707457857; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2CLw1/Gtxm8k7/hVT+/nUKJ1+Eret/bnzWs0hJWPqBU=; b=KW2k4Re48Dnt2h1TSj/p2QOyBN+pvLs23S9Qk4jRCGEuK8SDHOJfny0cTYbbfJItb9 yGM9tjU/KqS0e39ohrrxweCmi2ihzmTIcsB1SfzSaJMjsWrUNYIcK834XQb8phRoqvQM Zil6+V4mmgaSVsM38FPoxDqHn3R+86o9/+FecjH4vbjtpn8ThJRJUbsDmpRYypZE7y1u Vldetra7MOsFiW0itucbj8ZBKKjP2haVVFeN/lmCbndkspHwQYBY0Vk622at5wiK862D PaVacvB/70te5Hhvlck0uc6aBNGy14ORnD9Ry/N5hTqdYppBQgoHqrLmAoDR7gPiYmq2 KPcQ== X-Gm-Message-State: AOJu0YyviD/gG5FunjB+psS08rlWGWWjQU3u56XnTg2c5CCRWNpBqK6S zlWhoXjOhAJ7H/2S0vrQvYzLHFQuHkOz1S+T6xKGGJ4mOxP0HhqoOGYu5sbgdAEUrOD3UY9211Z gh0A= X-Received: by 2002:a05:6a20:d905:b0:19e:39cb:b35b with SMTP id jd5-20020a056a20d90500b0019e39cbb35bmr1753012pzb.12.1706853057195; Thu, 01 Feb 2024 21:50:57 -0800 (PST) Received: from stoup.. ([103.210.27.218]) by smtp.gmail.com with ESMTPSA id h2-20020aa79f42000000b006dab0d72cd0sm715111pfr.214.2024.02.01.21.50.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 21:50:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 07/57] target/cris: Cache mem_index in DisasContext Date: Fri, 2 Feb 2024 15:49:46 +1000 Message-Id: <20240202055036.684176-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202055036.684176-1-richard.henderson@linaro.org> References: <20240202055036.684176-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Compute this value once for each translation. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/cris/translate.c | 14 +++++--------- target/cris/translate_v10.c.inc | 6 ++---- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index ee1402a9a3..7acea29a01 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -94,6 +94,7 @@ typedef struct DisasContext { CRISCPU *cpu; target_ulong pc, ppc; + int mem_index; /* Decoder. */ unsigned int (*decoder)(CPUCRISState *env, struct DisasContext *dc); @@ -1008,37 +1009,31 @@ static inline void cris_prepare_jmp (DisasContext *dc, unsigned int type) static void gen_load64(DisasContext *dc, TCGv_i64 dst, TCGv addr) { - int mem_index = cpu_mmu_index(&dc->cpu->env, false); - /* If we get a fault on a delayslot we must keep the jmp state in the cpu-state to be able to re-execute the jmp. */ if (dc->delayed_branch == 1) { cris_store_direct_jmp(dc); } - tcg_gen_qemu_ld_i64(dst, addr, mem_index, MO_TEUQ); + tcg_gen_qemu_ld_i64(dst, addr, dc->mem_index, MO_TEUQ); } static void gen_load(DisasContext *dc, TCGv dst, TCGv addr, unsigned int size, int sign) { - int mem_index = cpu_mmu_index(&dc->cpu->env, false); - /* If we get a fault on a delayslot we must keep the jmp state in the cpu-state to be able to re-execute the jmp. */ if (dc->delayed_branch == 1) { cris_store_direct_jmp(dc); } - tcg_gen_qemu_ld_tl(dst, addr, mem_index, + tcg_gen_qemu_ld_tl(dst, addr, dc->mem_index, MO_TE + ctz32(size) + (sign ? MO_SIGN : 0)); } static void gen_store (DisasContext *dc, TCGv addr, TCGv val, unsigned int size) { - int mem_index = cpu_mmu_index(&dc->cpu->env, false); - /* If we get a fault on a delayslot we must keep the jmp state in the cpu-state to be able to re-execute the jmp. */ if (dc->delayed_branch == 1) { @@ -1055,7 +1050,7 @@ static void gen_store (DisasContext *dc, TCGv addr, TCGv val, return; } - tcg_gen_qemu_st_tl(val, addr, mem_index, MO_TE + ctz32(size)); + tcg_gen_qemu_st_tl(val, addr, dc->mem_index, MO_TE + ctz32(size)); if (dc->flags_x) { cris_evaluate_flags(dc); @@ -2971,6 +2966,7 @@ static void cris_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) dc->cpu = env_archcpu(env); dc->ppc = pc_start; dc->pc = pc_start; + dc->mem_index = cpu_mmu_index(env, false); dc->flags_uptodate = 1; dc->flags_x = tb_flags & X_FLAG; dc->cc_x_uptodate = 0; diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.inc index 6df599fdce..73fc27c15d 100644 --- a/target/cris/translate_v10.c.inc +++ b/target/cris/translate_v10.c.inc @@ -91,8 +91,6 @@ static void gen_store_v10_conditional(DisasContext *dc, TCGv addr, TCGv val, static void gen_store_v10(DisasContext *dc, TCGv addr, TCGv val, unsigned int size) { - int mem_index = cpu_mmu_index(&dc->cpu->env, false); - /* If we get a fault on a delayslot we must keep the jmp state in the cpu-state to be able to re-execute the jmp. */ if (dc->delayed_branch == 1) { @@ -101,11 +99,11 @@ static void gen_store_v10(DisasContext *dc, TCGv addr, TCGv val, /* Conditional writes. */ if (dc->flags_x) { - gen_store_v10_conditional(dc, addr, val, size, mem_index); + gen_store_v10_conditional(dc, addr, val, size, dc->mem_index); return; } - tcg_gen_qemu_st_tl(val, addr, mem_index, ctz32(size) | MO_TE); + tcg_gen_qemu_st_tl(val, addr, dc->mem_index, ctz32(size) | MO_TE); }