From patchwork Tue Oct 8 18:51:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833619 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp450638wrv; Tue, 8 Oct 2024 11:54:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXmUAuff3TWCy//B1YHBT/TVlF1gr3SvUeBPwKJ7cOes7G+gh8SZQ561aOnImozMrJAK1mG/Q==@linaro.org X-Google-Smtp-Source: AGHT+IHCEq49wmDXB2Rd1eWzNTJt5wFsMG1NHS67t0ykv4xtV/X2dzkO1BnzOQLifKw1ztQontPD X-Received: by 2002:a05:6214:2c10:b0:6c6:9bb9:b435 with SMTP id 6a1803df08f44-6cb9a4f8f3dmr235501316d6.53.1728413677186; Tue, 08 Oct 2024 11:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728413677; cv=none; d=google.com; s=arc-20240605; b=LZZa56PBWOgiEcNkqOuG3KHpLV34tdJAGQvX5+Pd9j85wbmXQf5yDGR3kU6wzYQV2E AAKrHWO3YD1STD4959u1UMbYZLPVT0zfaGfPGuVHXuzzlwfNQ5uhxT+G/cXMzqz5+lT7 ark8Nz0qgNiGwcrUoCIat6fW2tDjQq4m/DZsZXCLAcFeSc63t/UhV5iRtSQCCj6Zyy6S yJCA1udNv8BksDbWs7rO/tAgcITNLnUj8IUOYXNn8oY78zBUCaBWuCa5fQMxLQx16HMu HDaPbver01AgpBZOT5Bj7VK9Ej4QtzF7ScU3QkXuZe00I2/OlvYW2LSDnzNoi1543G/7 ZVPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=421LbBczhN+7djkIM+80LiuWG1ET4qxsB+bV+/jUDAA=; fh=tTjTfh/QwbpfIJ40uL4jnZOzWTJn3vAziy+Fmyen6KU=; b=fHHr6m8co4gD4t/vOQhkyCgaMZRtyqmbDqTUm/EqPqBNWJWy1AzehHlH6dyhVbqKwZ ts+KEggi+NZ52JOLGdKR6qZ42/aO8D6iaWvu18BueWtK4ormQU270e5XDo0/Wucwfslg lcNhFVuS2q9tXfDR8Ui5/40fbQaeNhyN+azJxqNrObcU4BWhKt6vhFTi7QQs5sQmVYhN S36dqXUq0ONOYfenB1oRCY3guKM0OIayIi6rKIczwJRnabBPUKy5esvmv1XDC7uUFhhf 9Q7mNlol+gjNDQ/ZmK04yoyxr7yFfSgEhhdN1fZ7eiYVihLsZA9Wf1q8EGhl8GmAwCxV mYYQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o80o3xZQ; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6cba46da1e8si92007246d6.89.2024.10.08.11.54.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 11:54:37 -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=o80o3xZQ; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syFJh-0007Y5-NL; Tue, 08 Oct 2024 14:52: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 1syFJS-0007SR-S9 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:02 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syFJP-0002Uc-G9 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 14:52:01 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-71df8585a42so2548693b3a.3 for ; Tue, 08 Oct 2024 11:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728413515; x=1729018315; 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=421LbBczhN+7djkIM+80LiuWG1ET4qxsB+bV+/jUDAA=; b=o80o3xZQf0wmvDB/S97KNbXeaGPVjYVQev31/7sOBubGp77Z5Eg1XHZXHG634I/Awj 1Okoh0mZP0MtVh/BGfwDeDLX2nNIdY7+GWcyxzA37yNj4r10484XAYNoJk6gJSxo9KrM SSEkJclqRT6hZyIJqR6UxKkvQTOqSygedJQvfZoxV2nWLUNKEmS/N9jlGBmBmvtk2ajc Jk+zbPYrdl+tyNDXXew6fIACzQWGpGwCdZRiGxvzOuxgyNojjjUi9KSN4kY/0na4Y5pc 9ofIV5STK7RNCk8t5QG5KPxVk0fZkWJr8oXM8br8OkywKg9DfjXiYIc2M4U2/IwrFGuP /xmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728413515; x=1729018315; 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=421LbBczhN+7djkIM+80LiuWG1ET4qxsB+bV+/jUDAA=; b=pUXmj+S4/NuM69leVuPVCyU2vk4nBrkziaYuS2sRnMlmlqDesFjV9H9Des1XZMYK2Y ewTTwAEBaqSKueM80KuhVFzknAx0OoOoDOtGa90EnpPWJYxQL5qleF6+A4Rh+H/ICfFH P4d8aRv1FHHuJZW2lXUEfyirdhpBoflnt0W2RNzA1HIUqJhNm66laq6pzZfI5kuZR5P8 BFO8ecW3dNzxWT6NGdC1k2MipgAN+R6uCH0b0nzN00M6FWE6eIvhyk7HaghNbkaRp4fh zsby5uW8Yw0PgGExUEHUFWn464hE7GVO3x/SScAbhD5KqsT24zmDJT9ylCTNI+hdtlK+ hJgA== X-Gm-Message-State: AOJu0YzOf/6xuKXJZuSRuznNH6zHqEkbdraN+Se89rRPQXvDP16Osvxo MeBiaAYFtHn6EzarYHDTH0qo2OeU2fEU2L+JDUAR1uWtQTBvPwv/lJHwnQXaLlnpGHXLJWP1IT+ V X-Received: by 2002:a05:6a20:c709:b0:1d2:bbd9:4646 with SMTP id adf61e73a8af0-1d6dfabb7bfmr25353858637.38.1728413515383; Tue, 08 Oct 2024 11:51:55 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6821c32sm7186818a12.33.2024.10.08.11.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:51:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 13/14] target/m68k: Always return a temporary from gen_lea_mode Date: Tue, 8 Oct 2024 11:51:40 -0700 Message-ID: <20241008185141.20057-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008185141.20057-1-richard.henderson@linaro.org> References: <20241008185141.20057-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 Returning a raw areg does not preserve the value if the areg is subsequently modified. Fixes, e.g. "jsr (sp)", where the return address is pushed before the branch. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2483 Signed-off-by: Richard Henderson Message-Id: <20240813000737.228470-1-richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé --- target/m68k/translate.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 445966fb6a..ad3ce34501 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -720,7 +720,9 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s, } /* fallthru */ case 2: /* Indirect register */ - return get_areg(s, reg0); + tmp = tcg_temp_new(); + tcg_gen_mov_i32(tmp, get_areg(s, reg0)); + return tmp; case 4: /* Indirect predecrememnt. */ if (opsize == OS_UNSIZED) { return NULL_QREG; @@ -747,20 +749,23 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s, switch (reg0) { case 0: /* Absolute short. */ offset = (int16_t)read_im16(env, s); - return tcg_constant_i32(offset); + break; case 1: /* Absolute long. */ offset = read_im32(env, s); - return tcg_constant_i32(offset); + break; case 2: /* pc displacement */ offset = s->pc; offset += (int16_t)read_im16(env, s); - return tcg_constant_i32(offset); + break; case 3: /* pc index+displacement. */ return gen_lea_indexed(env, s, NULL_QREG); case 4: /* Immediate. */ default: return NULL_QREG; } + tmp = tcg_temp_new(); + tcg_gen_movi_i32(tmp, offset); + return tmp; } /* Should never happen. */ return NULL_QREG;