From patchwork Wed Apr 24 23:31:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791589 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106512wrq; Wed, 24 Apr 2024 16:33:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXxZ9nCE7K/R30rpO0JE/rjvoJt48E3wLJnVj7f1l85WFVsRsEAi+KUkykhdbEtjBw4z6g2odRdH7L75ymCum3X X-Google-Smtp-Source: AGHT+IHK5lCtBV+G2nd2xJRKwxwNhCnepnk6SKLB/YbgYuv5hLuRjLTjqGRYaF6vkQEPCqLTD2LN X-Received: by 2002:a05:620a:6207:b0:78a:86:529b with SMTP id ou7-20020a05620a620700b0078a0086529bmr3890445qkn.29.1714001618547; Wed, 24 Apr 2024 16:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001618; cv=none; d=google.com; s=arc-20160816; b=FuTIhtS7pYvZXei7EaIUCieEn4+04pCBk6vPoiKkeKQPaKIXue14Xy/UItdSrLF82M BpW4JEVk5VOBp9fq8VsTB3SKZ7OGK61JK9diW2TRj6MdD34yPJgUFAulVg9AwjPcmG9Z jXLfW832I5OX1txA9MqEkoB+xwuht9YhTHxO0QjPk5Mjy3wcF8tAHSecQgUZex8oPg0D 2xPzl9q4LFT5Qd/NzOwcjd8krzxUZ6ti3DZATtpujEhj8hxxQAP0gBN1jJNoj8wFvC80 RgOe7rAa73E29ESH/wroswDgOba11pKt7PzxM8pI3+X0qIY7v9UWDY6magnvv78/93OP mR/Q== 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=nbDbS/T6MeisvdJ/GSFXjV/Cw5l2BXSAyhi6lzDit6Ltb+qYS+5osQIWeMR5vmtLkl +LhjOrE/RAKdu1ZIbpgK4rsNcSHUxOR/uvglO2MCWuDYBjc7c4W2dedmRfo+kDMdHxef NiApxACoQDgHHtfA2ZaYKb1DtwwkTKPG6MjGSCOmBRhgVRFAiJxS0R7BZ5kJcPMLKCOI YI6AgEmwExATv4eTrMb1QfNSLDelKBEOULEqX+HX8JqhnV7n7sfUhwYncXUA1+ImzPFN 6rJTsSvOgDlfN3HWUHcVrV2QEGiI/JlDb3kpVyFSPkHgogtuZsiTM+WYSbBr9F2z3EKn 8JUQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TahMWrxZ; 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 l14-20020a37f50e000000b0078d635c8189si2286269qkk.416.2024.04.24.16.33.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:33:38 -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=TahMWrxZ; 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 1rzm65-0006Do-FR; Wed, 24 Apr 2024 19:32:17 -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 1rzm5o-0005zw-SN for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:00 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5m-0003p8-UM for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:00 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2a68a2b3747so337908a91.3 for ; Wed, 24 Apr 2024 16:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001517; x=1714606317; 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=TahMWrxZTdmUjekvsySttKQZaEzULFih/zlDcN8HZhnKEM9WxKzdACMP9vqDqivFsq dfh920Kg0D/GBF/KsxRkFdsdiJk72kpMc9slN3N5Z4SJDrVBSQFmhki9dNDQxV+wly3O xPd/Tiy08sqo86wevDG15U9xQoNTCefcER4Ziuqb2WxEYabjG6UUtLBEqpcAH/fS69U8 ByJP3lGMC+hVSim6o7k9DWxRBZbWqHaQ7zAEu59dFuCI5Gl64TSk1YNMvcDjWyh5yE5v wP6LywdxA0yzOYs9kdbU1PV8/1sh1O9S61kYBZYixT0HdaoFWp6j+P/AxV5qHYKqGr+Y IM5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001517; x=1714606317; 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=mQEE6gt2KUe+aajAYwsUcTs0GowMHpu71JCrQbQmO1lK8qvf5FHcVEzhs3x1FyNqqG bPo3gkzYoD9VqZqIVvZwORtdB+C9//ejmWdBKPYl+FpBIYcmAiEh2TVJT9nSR6pPZInw qSPaCO/dIY/JjKcU0qzIWhfJ8Gy8eRljtU8VNyqGsiceIsrKdrcV9DjaWwwwh6ZtSteX E8dtZKiql5GjAOYVdltkEmYQOFRoD2L19XOQ2mpwlvTtKcY2RRdhi07lXniMiUFhLCnD rcrvcwNMwHVAEr/5v6C3p5FqP6Ce/CStrsT0JQlPI0ZeYtRV2Duc1nDFt3PLfzbNQ45+ nYug== X-Gm-Message-State: AOJu0Yy7BCMj330dSZiDE03vtdejBXxsJetjUdXQPjAeaiM1ygd8m7Pk UsR+5B7yhv9aCPWMpvn+2BGuBNKXdhszpzNDYpmdJ/Yw0clDOz10hrhRSp9heUHfutmQO9/VTS7 / X-Received: by 2002:a17:90a:778b:b0:2ac:91d9:9fd5 with SMTP id v11-20020a17090a778b00b002ac91d99fd5mr3592005pjk.47.1714001517575; Wed, 24 Apr 2024 16:31:57 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:57 -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: [PATCH v2 28/33] target/cris: Use cris_fetch in translate_v10.c.inc Date: Wed, 24 Apr 2024 16:31:26 -0700 Message-Id: <20240424233131.988727-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424233131.988727-1-richard.henderson@linaro.org> References: <20240424233131.988727-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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.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);