From patchwork Wed May 15 07:52:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796883 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853988wra; Wed, 15 May 2024 00:55:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUeEckv6nAybYRzqZP/4TJXc0/O0+znsbfoBe8YbTDualyxj9gmNBBSgB+cr0zabjAufeec1d50Nvz5kUPSi+WJ X-Google-Smtp-Source: AGHT+IHEI7/9u2+ZrWBazcRr2Jr9KDYg04ecqhebA9dVh/ae81cL/bXw6OUeN4UhxDRVQZesrAhm X-Received: by 2002:a05:620a:7f1:b0:789:ecf2:d777 with SMTP id af79cd13be357-792c7610783mr1428782485a.70.1715759708196; Wed, 15 May 2024 00:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759708; cv=none; d=google.com; s=arc-20160816; b=Dlerp4KisofS7rEfO8w7Go2JvTVoqRifG3KllqaY9dyff0wU4pl5kN++s99Qjk6JHS 6bfkkjPJ10tXwffeH0LP1uOCYL+7BTw0FsrqI6dc0UYsM+Spbk9qophx+QkWAfBC7EST 3lVGSm8Ot6lfhNoX0wwgyUigY0/KEE9TwUbIlN6z/k4ZEL6NweSHHFRU69/ih4ZotpL6 pYS2rl0EO9O03FBxkFG/KQf7zggdbLk+GDF2NHGmux9ImGu8RVWF1KQOZffE0zUehuA3 cFK94XKGhzcTwDCj0ycba1vEy9N7mlvkrWWSXWox988PL/e2YNWpjuNyxhQf9gVzcBuO cokQ== 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=eL11UZGpeVEq4VOMmX63mOyK3p1fvPoFDCh9Izq0OCE=; fh=yIXiVAD5FpZIeFc+c4tpRY/5DBPhgcMqmQf6hSviIlk=; b=jaQdqL2tidXFtUoEXsXs5GCf9i6HAJ6HEesmtusQ8MTIFGJJhKgg2U7KT6QSRZh2e6 l6PmhiR99Hil3X2wHntxnB6LA7i52n95zsE81N0nntjJVe7Tj7rLtyw3/qQ/+gXEiagn 0FELYCnrfd7ZYkvbgu3e8WobFNiPOSTDBJoNGeOYKaGtRY5j2+19/BMnW8SQxjz5rMJh NKy9+1nvAutEHxxGTLF9vdxitY9Ot3ISBjE5B1+g7bRQD6GbjgvkrUn7sJ01vGGBS8mh tvycpHg2TLrIeIaDjKkPgmMI8mKvTAlaIvC0sFEuE0opf89xVIJ5kAxhfQePJjYdRbP6 yVHA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YqW1ne0w; 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 af79cd13be357-792bf336b59si1327466385a.439.2024.05.15.00.55.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:55:08 -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=YqW1ne0w; 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 1s79SH-0005EV-Be; Wed, 15 May 2024 03:53:41 -0400 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 1s79S9-0004zk-02 for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:33 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rq-0001dX-3N for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:29 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-41ffad2426eso48855545e9.3 for ; Wed, 15 May 2024 00:53:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759587; x=1716364387; 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=eL11UZGpeVEq4VOMmX63mOyK3p1fvPoFDCh9Izq0OCE=; b=YqW1ne0wbfEmTAQ6YGipyOh40h3jYChNGgRhu+GhMQRvEpTVQDW2mxy/8hxYmmZNKf 11ysBKHCwSLo3rkiuEN1/gh8jhOZSlCUM+OLtbck4Fpasoi2d+OqQlLwUPB2PPmyU6fK 1jWrr8G5WtIuyWiZ3GvaLZq+e1BUOnfyOIF8+dAlqgOTLgBrYFRn4D4KUM7HSu3I1t1t p7isAXYXhtU2rpULsw1hhoi5bRWZQnjkN01OUwKOeiMifqZZqM/xSuQk44kXpH7DlfI6 aW1KDhpnbDNVtf560UXXl+ivVuNLOIXaf1Tw1i1I9i86MgdN220dlSvGR7ZCgUCiLTk6 AATA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759587; x=1716364387; 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=eL11UZGpeVEq4VOMmX63mOyK3p1fvPoFDCh9Izq0OCE=; b=D02rpOmMD86Pp6pnvmlil87dWm/9tNVFRFeSAYwbDArYdx/8R1VSVcOVBUiahQnQG6 N6zoOVdhNx5+3b+JiKC/a3gL0uFd/UVfzgr2atH/8rIjbx2F30vHi98LILBbOVfq3TLP SZhooZYwLK9yMrtagByO8glmPnaJBAIID8e3QYJoQPaClc2oWKzRwZ/U5V6HHN6gb0UO D/NXGePrI6b4gFZXI+foHRarwFxKcJs0ScVsgkorpJE/2t1IEsV7kg4MlBph/aNV1bo5 7gRlKZqkDI1qW2WAucUaomFCA0DuIX9bfqJ0UaPTidtt6tvH6K3gieof4ig55hfnagth L1rQ== X-Gm-Message-State: AOJu0Yzh8QEPJNxrli1+F+J7OyDXWwQvKiKZAZwK3GKRdVqL2vznRAMJ tniluRRKtP1gNkW+XJ7MJXHp23mwsmk1Pvk6i3Ic990u/pAc1+StYTpj88fvj5EPJWwmRAnaaeg 3abI= X-Received: by 2002:a7b:cbc2:0:b0:41a:225f:becc with SMTP id 5b1f17b1804b1-41feaa44406mr139063775e9.21.1715759587325; Wed, 15 May 2024 00:53:07 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 28/34] target/cris: Use cris_fetch in translate_v10.c.inc Date: Wed, 15 May 2024 09:52:41 +0200 Message-Id: <20240515075247.68024-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.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, 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.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 Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/cris/translate.c | 1 - target/cris/translate_v10.c.inc | 30 +++++++++--------------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index bb2d6612ba..a30c67eb07 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -29,7 +29,6 @@ #include "tcg/tcg-op.h" #include "exec/helper-proto.h" #include "mmu.h" -#include "exec/cpu_ldst.h" #include "exec/translator.h" #include "crisv32-decode.h" #include "qemu/qemu-print.h" diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.inc index 73fc27c15d..c15ff47505 100644 --- a/target/cris/translate_v10.c.inc +++ b/target/cris/translate_v10.c.inc @@ -165,20 +165,7 @@ static int dec10_prep_move_m(CPUCRISState *env, DisasContext *dc, /* Load [$rs] onto T1. */ if (is_imm) { - if (memsize != 4) { - if (s_ext) { - if (memsize == 1) - imm = cpu_ldsb_code(env, dc->pc + 2); - else - imm = cpu_ldsw_code(env, dc->pc + 2); - } else { - if (memsize == 1) - imm = cpu_ldub_code(env, dc->pc + 2); - else - imm = cpu_lduw_code(env, dc->pc + 2); - } - } else - imm = cpu_ldl_code(env, dc->pc + 2); + imm = cris_fetch(env, dc, dc->pc + 2, memsize, s_ext); tcg_gen_movi_tl(dst, imm); @@ -929,10 +916,11 @@ static int dec10_dip(CPUCRISState *env, DisasContext *dc) LOG_DIS("dip pc=%x opcode=%d r%d r%d\n", dc->pc, dc->opcode, dc->src, dc->dst); if (dc->src == 15) { - imm = cpu_ldl_code(env, dc->pc + 2); + imm = cris_fetch(env, dc, dc->pc + 2, 4, 0); tcg_gen_movi_tl(cpu_PR[PR_PREFIX], imm); - if (dc->postinc) + if (dc->postinc) { insn_len += 4; + } tcg_gen_addi_tl(cpu_R[15], cpu_R[15], insn_len - 2); } else { gen_load(dc, cpu_PR[PR_PREFIX], cpu_R[dc->src], 4, 0); @@ -1095,10 +1083,10 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc) if (dc->src == 15) { LOG_DIS("jump.%d %d r%d r%d direct\n", size, dc->opcode, dc->src, dc->dst); - imm = cpu_ldl_code(env, dc->pc + 2); - if (dc->mode == CRISV10_MODE_AUTOINC) + imm = cris_fetch(env, dc, dc->pc + 2, size, 0); + if (dc->mode == CRISV10_MODE_AUTOINC) { insn_len += size; - + } c = tcg_constant_tl(dc->pc + insn_len); t_gen_mov_preg_TN(dc, dc->dst, c); dc->jmp_pc = imm; @@ -1164,7 +1152,7 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc) case CRISV10_IND_BCC_M: cris_cc_mask(dc, 0); - simm = cpu_ldsw_code(env, dc->pc + 2); + simm = cris_fetch(env, dc, dc->pc + 2, 2, 1); simm += 4; LOG_DIS("bcc_m: b%s %x\n", cc_name(dc->cond), dc->pc + simm); @@ -1185,7 +1173,7 @@ static unsigned int crisv10_decoder(CPUCRISState *env, DisasContext *dc) unsigned int insn_len = 2; /* Load a halfword onto the instruction register. */ - dc->ir = cpu_lduw_code(env, dc->pc); + dc->ir = cris_fetch(env, dc, dc->pc, 2, 0); /* Now decode it. */ dc->opcode = EXTRACT_FIELD(dc->ir, 6, 9);