From patchwork Wed Apr 24 23:31:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791595 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106749wrq; Wed, 24 Apr 2024 16:34:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXaN/cUNfVj8SQC8PnIFu99lVeaNg6jZG2YuvZ/YvwuTMUtjF8vv9O3LttSKjXqhqtLIz7FJNHdFJ6RBT3ag5p9 X-Google-Smtp-Source: AGHT+IHyx0uXuanRY4GXTopdYkuu05dbIoysXFQUtxGrBPOXZg4+bVEWtZ3aK1eBZaAMJwQUhmPM X-Received: by 2002:a05:6808:6146:b0:3c8:4303:9a7 with SMTP id dl6-20020a056808614600b003c8430309a7mr3468984oib.10.1714001656274; Wed, 24 Apr 2024 16:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001656; cv=none; d=google.com; s=arc-20160816; b=bn0vvTef6myX6pm3uaeX4fenect53pEJotMhZQ/HuOtdAN7eve/DBjPsmMvtqAK5/V 2UphoqWGXFVg1ly4f3fPKhIBhm/JfLI5F7ZlfD1ZDIGFmrEvPnb6IJf6mT3WwB+EbvU2 iDFnrxBYaW/5hoh9QYy63myr3st8bv/NoQqjzK+kIDwpkH10/6mNasxVDbQWPnczWcea WuS6BldwSCXmYRXTb3ePfOJJoR3ZtxSfXkcVx549caCXlNGZjcC4r6XitjYXDAiXEOW+ 3B6N6v/td1gLonAn3sk/NAYo7SSEj8MUSoN0RQF1Xx9cP82r11J2bymWfdS0lyOH4RDu /SYA== 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=LFwVHeO0xdQZE4q/p0sWN9ZrSqg0kbbJP7VPGYxlODk=; fh=yIXiVAD5FpZIeFc+c4tpRY/5DBPhgcMqmQf6hSviIlk=; b=oWlo3xDNUf/OL+5sakO0hzDc1KmgHTv0+NzdkFzfRImVksAyzxfcEGqqHfO3B2Rf3e GtIgZyyGcww8qecvsVoUvKw18Di1XofiD9iR5AOAhGp3P1TaZNA58uDXNHone8IyEuJD GIFuC/6sONMARDeIGBKKZWN7W/I56rI/odL2KVEXmloyhcSDhd2XiiELnUg/mHyAnv5J EA2QKlirNlJe70xlRiXK2nBlpCifrlDa9345xj0HB02FXvprr4rnoGy9JFcYEssgPgUk 4+a2FL9N1rJKw6rsX0yzW44FKjK+0Yhb7doykSHrZdDy/AjAUTiFIix77/8Gkt+aSZCG Pruw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="aKN/BtH7"; 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 b14-20020a05620a0cce00b0078ec3e9ea8csi15356108qkj.513.2024.04.24.16.34.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:34:16 -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="aKN/BtH7"; 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 1rzm5v-00062I-Em; Wed, 24 Apr 2024 19:32:09 -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-0005zG-4Y for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:00 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5m-0003kw-3Z for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:59 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5f80aa2d4a3so374670a12.0 for ; Wed, 24 Apr 2024 16:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001516; x=1714606316; 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=LFwVHeO0xdQZE4q/p0sWN9ZrSqg0kbbJP7VPGYxlODk=; b=aKN/BtH7f0SwgqWPEu9bNYSFZ5duD4NI1gtb8SudsqpXHgT95y3IT73UdrcwLtVZd3 vLs/FHsGP5gu6eaZRPAgoHi+hgju/e2bU3/lcg/GbfgxkKljmkngcnmvsllHB9G5O7QK iEKT0iKu3qenQPZv9wEKGZxblxG03XiNRLjrelfJ6U9hBdP3q66TF7X0GU87/8rj9F/V XmjZN7CqHoHSYy6QNlp3kOGjhBN0+iDPvuQQFlXsINqq6hJQvlKz90GbhjeJHMa2U4of M9davGxNgSHmY3MQDT7I/tTFa1AwfGP6JSlXy8++cTfDVHh5e9tpELvQfC6sDZzFLIVH POAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001516; x=1714606316; 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=LFwVHeO0xdQZE4q/p0sWN9ZrSqg0kbbJP7VPGYxlODk=; b=thqBm6cbKEepfo3EGdKOrWFwVJ0gsKSmICYJ8aiDv7sUWPTozLMhqaeu/dnDZ+MjYb FUE7F2ij4UsaGJvZKQLY2v0PSCPE4G0msDjxFkx7CfujTfksFN9NK3PJMO4IwanBBMmz 44N+mr73xtp+e2LKIcn/kL4ZRv7ML9BV/CapGMsUtQIeHSBarhfdHFrbWn4jLEA1d3bv 4gk8pw4kdoPwAGNEtmGxlC3j3hSQIXE0lv5lGWGEHFCHzjENoHlc+LyIctsvq/ug0Co2 hEwIfEyPT5PZGk0kPCenmHWVoMoxYIE/H37Vdc2B7JE8ONZnlRv28ypk4AaAQzcmkHhA 5xZQ== X-Gm-Message-State: AOJu0Yzqu5b+isNA3XjOJ8HsRzhPRHIiQjqdKvnwSsPSB4fRCNqKQxOX a/k3/Pib/XHEffYPBNVYOHmhHuiwwyDcQgaB7WvsMuHNbuVkMdJLL2B63MOmPielQAz8sEvKdkz g X-Received: by 2002:a05:6a21:880a:b0:1a3:65af:9baa with SMTP id ta10-20020a056a21880a00b001a365af9baamr3714878pzc.62.1714001516676; Wed, 24 Apr 2024 16:31:56 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:56 -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 27/33] target/cris: Use translator_ld* in cris_fetch Date: Wed, 24 Apr 2024 16:31:25 -0700 Message-Id: <20240424233131.988727-28-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::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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 | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index b5410189d4..bb2d6612ba 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -222,37 +222,28 @@ static int sign_extend(unsigned int val, unsigned int width) } static int cris_fetch(CPUCRISState *env, DisasContext *dc, uint32_t addr, - unsigned int size, unsigned int sign) + unsigned int size, bool sign) { int r; switch (size) { case 4: - { - r = cpu_ldl_code(env, addr); + r = translator_ldl(env, &dc->base, addr); break; - } case 2: - { + r = translator_lduw(env, &dc->base, addr); if (sign) { - r = cpu_ldsw_code(env, addr); - } else { - r = cpu_lduw_code(env, addr); + r = (int16_t)r; } break; - } case 1: - { + r = translator_ldub(env, &dc->base, addr); if (sign) { - r = cpu_ldsb_code(env, addr); - } else { - r = cpu_ldub_code(env, addr); + r = (int8_t)r; } break; - } default: - cpu_abort(CPU(dc->cpu), "Invalid fetch size %d\n", size); - break; + g_assert_not_reached(); } return r; } @@ -2868,7 +2859,7 @@ static unsigned int crisv32_decoder(CPUCRISState *env, DisasContext *dc) int i; /* Load a halfword onto the instruction register. */ - dc->ir = cris_fetch(env, dc, dc->pc, 2, 0); + dc->ir = cris_fetch(env, dc, dc->pc, 2, 0); /* Now decode it. */ dc->opcode = EXTRACT_FIELD(dc->ir, 4, 11);