From patchwork Wed May 28 08:13:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 892954 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e53:0:b0:3a3:61c9:c5d4 with SMTP id j19csp2081796wrz; Wed, 28 May 2025 01:23:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXNvfjq7d1j0RbpXDf6ys3IqOTVLLVk4mOfLo7IbBHxx6vkgmNz/l34dpzjIOTTj+lh/7MdfA==@linaro.org X-Google-Smtp-Source: AGHT+IESquA4UtfDyLsGLyZyfrsBbMhKs2xG01Gy+0r9KDesDGLWvMCXNG2rorvOmFO1CmqvSza9 X-Received: by 2002:a05:622a:4186:b0:48a:1f89:f933 with SMTP id d75a77b69052e-49f4655a670mr259653751cf.8.1748420552709; Wed, 28 May 2025 01:22:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1748420552; cv=none; d=google.com; s=arc-20240605; b=RZdrbaM6oSIJeyydZ7okZLtxPpuCbM1NlnqFUXx8SesWpGktgFcD8/K3IasfXIsyVz Z9mclsAVJaQF9QjKV+jnAiS4CF4LmQq/qcVMT7TaZvh6kErNB2Wr8bmAbWltumScTnQa hMnnXdVpe9yOzv0fa1qXJBkQdEUpn4HEoC/jFnJzk4rycDql0q0c6++it9S0RUtU5lxQ O1Nc1ItGUMyP3lAI7Y3O8Mb5W+xJoLSs0ajBdUZWQoH+ncOyh/R9q6O/sdTqXaqNUafV yCBWwohTAKoo3Fdln2+0oKM96dHfPSJvAtXSCTJrIUKIhMG6JTQjjqAlQ0aEioLfc1OI lyuw== 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=24Z9qZttVNWxMs/+PWywvUHFCg2sjBAovcSVb5esy8U=; fh=KhOg7HwptXKZ/G1kuebhEeqbpzNh38X/9OzLcK4Z+pc=; b=dho3ipN8uojLAV3YmmW6ALa7ENiTRntVLXt1ZVlMrqln8HxuAa9g8xbxOK02/uJvS0 HgCkIIZl3Uik0ISi0ndhVuXltTzql/f69e7H2aNnScXJXxzFrZz8fuCDumnp1F/ffR4f zno5BHfUc5WBKp/eLtoXBgc+CC9M2Q40JTI/pe5UeUxy/++zbI2seg0Z46qJyxsq1X+a Y5tNtQnFSH4h3VSaFR3bUCH8cP15+U3rmtzzDl0wNvBwADrRHJggjf5lygYN6KNIvaCO CpMqKLpOEveRoG49YL8RoNK8fWsO0h40jlTrUC4reRvv0g/qsztvX0az5g51wh0Zi8JS 7crw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R36klxvD; 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 d75a77b69052e-4a3d01024c1si7665501cf.632.2025.05.28.01.22.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 May 2025 01:22:32 -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=R36klxvD; 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 1uKBy7-00023U-Q6; Wed, 28 May 2025 04:17:01 -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 1uKBvn-0007wj-E3 for qemu-devel@nongnu.org; Wed, 28 May 2025 04:14:36 -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 1uKBvk-0005Fx-Df for qemu-devel@nongnu.org; Wed, 28 May 2025 04:14:33 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43cfebc343dso32661645e9.2 for ; Wed, 28 May 2025 01:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748420071; x=1749024871; 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=24Z9qZttVNWxMs/+PWywvUHFCg2sjBAovcSVb5esy8U=; b=R36klxvD2FkOwrAc0N6f0F53E8zPZqSwkw4CeVIoQF37Cz0zbMFMpm3GwsQt0kJ6AW NCR7auWyKsXo3ulbYSZm61ySBdnYvAJLRNj1HlBKm1P9yJ0wQJlRMZLxOrH5qr48S1Q5 DYW+6wtgq94OxlfBsq9HSssbin4Vr8HX/EkvE6WFaANF8gcqVeZe2nUrA+wzoRiCgF/e Ypai9vwl+6Bdm0cWcOG6adVvsle8swkSeVl4i9Y5H1okSd45/qu3AhRs4OwxQXsqJAEj u4bOUNgUiELlrKYr23LxGxOUurFuzpKilhfZhzQxN4aprPuYDbhAYxw81/3ZT6KiFEBt cRjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748420071; x=1749024871; 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=24Z9qZttVNWxMs/+PWywvUHFCg2sjBAovcSVb5esy8U=; b=bXrGq/BgHONhRgw8t/nA2CFpHShCkCjhN6F88Mrd1y0qi/h4wQoLiyx4V7lPF8pdXi UV+rlG/MMWFkicor2iq8Fl+nqK+sx1LbIjbJIgOJQnVQBvRproY8n+g/3JDjS5tDExVB UVgLZNVd/Ull2JYeq31Gz12gl4QqkDPTCsknX7AVEukLOUQQ38aEOGNwnpwrwB1ltDv7 OvHAdrMPkoRKYKZceROc1kCG0HXhLfkscFZCnc7AoQ1wSzZCc0ZEjuVoSExeaIA5Fu80 8foA3UYzE9V2ogouWULrhQCE9Qa5Vfl2wax12PafN4eQrIeJHOhbqSqGwT0faZqSY98e LDgg== X-Gm-Message-State: AOJu0Yz3fgxRsKiOMcVmbBE/2Ed26BVGlTBGztw362O3GvZVHCGmxgY9 Qi6oRYkc1+hA+K9qMFQL7anyYXpnUoGmfVFwUlwd/+yxsSFDWApwrGHWCXrIdxnwg529L9LE+MC aF3tMOb/1uw== X-Gm-Gg: ASbGncsezQDy5on3ZhTpamwJB3fkJRSHGK9bTypfdAJhTAmxPUP12QgugTaC9yz5sPs IgZAtNfAUIllc0wIMzYRna8PDwPo3NfVYnllZfs7NpvlEYvYErwQ/nLPkeC4DaBML5MTjxCaTP1 HN/4UjWPiacVNxmLO3nEqwIa88Sjt6l0K0VUyNzviW9oOWV8g0ELw2jADG6V//kK8X2WgvkFV1F EFVwrhFBbBK24dHLzIwk/vZ4oUFK2CWjmO/+7XqpRIlM6pKOLC8pFPPL/y4OL7i+UBakMEalw/7 LpdyaIvkm4T5z3szUwfGUXK9hecg8S+CZOcy2HpJUBQVSxU9u1NLIAkd/syVTs+gq5M= X-Received: by 2002:a05:600c:1d15:b0:43c:fe90:1282 with SMTP id 5b1f17b1804b1-450725458d3mr8625225e9.7.1748420070554; Wed, 28 May 2025 01:14:30 -0700 (PDT) Received: from stoup.. ([195.53.115.74]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4500e1d85b5sm13178645e9.32.2025.05.28.01.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 May 2025 01:14:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" Subject: [PULL 13/28] target/microblaze: Simplify compute_ldst_addr_type{a,b} Date: Wed, 28 May 2025 09:13:55 +0100 Message-ID: <20250528081410.157251-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250528081410.157251-1-richard.henderson@linaro.org> References: <20250528081410.157251-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: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) 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=unavailable 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 Require TCGv_i32 and TCGv be identical, so drop the extensions. Return constants when possible instead of a mov into a temporary. Return register inputs unchanged when possible. Reviewed-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/microblaze/translate.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 047d97e2c5..5098a1db4d 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -606,19 +606,18 @@ DO_TYPEBI(xori, false, tcg_gen_xori_i32) static TCGv compute_ldst_addr_typea(DisasContext *dc, int ra, int rb) { - TCGv ret = tcg_temp_new(); + TCGv ret; /* If any of the regs is r0, set t to the value of the other reg. */ if (ra && rb) { - TCGv_i32 tmp = tcg_temp_new_i32(); - tcg_gen_add_i32(tmp, cpu_R[ra], cpu_R[rb]); - tcg_gen_extu_i32_tl(ret, tmp); + ret = tcg_temp_new_i32(); + tcg_gen_add_i32(ret, cpu_R[ra], cpu_R[rb]); } else if (ra) { - tcg_gen_extu_i32_tl(ret, cpu_R[ra]); + ret = cpu_R[ra]; } else if (rb) { - tcg_gen_extu_i32_tl(ret, cpu_R[rb]); + ret = cpu_R[rb]; } else { - tcg_gen_movi_tl(ret, 0); + ret = tcg_constant_i32(0); } if ((ra == 1 || rb == 1) && dc->cfg->stackprot) { @@ -629,15 +628,16 @@ static TCGv compute_ldst_addr_typea(DisasContext *dc, int ra, int rb) static TCGv compute_ldst_addr_typeb(DisasContext *dc, int ra, int imm) { - TCGv ret = tcg_temp_new(); + TCGv ret; /* If any of the regs is r0, set t to the value of the other reg. */ - if (ra) { - TCGv_i32 tmp = tcg_temp_new_i32(); - tcg_gen_addi_i32(tmp, cpu_R[ra], imm); - tcg_gen_extu_i32_tl(ret, tmp); + if (ra && imm) { + ret = tcg_temp_new_i32(); + tcg_gen_addi_i32(ret, cpu_R[ra], imm); + } else if (ra) { + ret = cpu_R[ra]; } else { - tcg_gen_movi_tl(ret, (uint32_t)imm); + ret = tcg_constant_i32(imm); } if (ra == 1 && dc->cfg->stackprot) {