From patchwork Sat Oct 5 22:15:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833014 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1364076wra; Sat, 5 Oct 2024 15:16:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUwQjrdW601u2NnDOuhcDTNniuhhohac5AXzUhAqH/DyJKaq48XG0nkXR9uBZuSVXqJ/lBVUA==@linaro.org X-Google-Smtp-Source: AGHT+IEvtV7nL3ySgpz/Mi65rI6UbN9yENEFFgcroEAvepQId6N59diLAZclK6bTY+TuBjgyDwL7 X-Received: by 2002:ac8:5f85:0:b0:458:611b:ac34 with SMTP id d75a77b69052e-45d9ba4ceb1mr103229021cf.12.1728166604639; Sat, 05 Oct 2024 15:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728166604; cv=none; d=google.com; s=arc-20240605; b=b1hIm6Rh/wD1LTV+WvrAZ2KN+AfQw+fyJlTEcqgPqyxuQ1qCFBlzY/PIkjtc868KWM ImbdcI3BSH6g6SkwGttxNC8W/uKG/JalcLO5fgypr7TzRcGw9ymx8QCLFbgK20LinEcc X+jGNEJRG8dcJaF4nIrun0Ew8/PkrePhqCvH6VtEe/6tm0BzwGFIRQ+WHx0QlOY0PIWe FFm2r1u0c7zdXlf6Hd3PLKFfQ1ThCS/OqATBY2KAkxJGZmrS814upp2T2xBgwVRYoX+n bG5nkG30AIyISfQCZNe//+TPaX8FzjnlvcMvVHvXH8K7zqtTk5W5whjsTQ/8ZGW9/Ny0 cCaA== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=uUuy8elcXKD4Ev+p0aNnxP0u8ZBZ/r7M+GG9/Xwm2Sw=; fh=xsy+IYpDysuYwRiEGHtZS+ytVQlJJO4jvtHp2Z5YndQ=; b=VQ77zJdobsmZqei3xe7AzOZmQwD4AuUO2la22T119b7I2nlr5Dj5lBKdNsYqWJNTln YcMu6BmaUokRyAeW9Ph6nOoDUoC6QGFJ5EjW3wU96MMIoOI6TgenyXAqHLi8DGEbXvlr 9mc4vqNo5Su7VbvKVlm7OKVF4zVw5BkXxzyM7VNrBA51kmj2oSgABOOqGdC5QmVtWfXe bKyHTmg+199p7wdg0wUK/YL8IYIdnG9vTcSJUXSmagsIDXzb60CsGfp8eJyv3A7Jnhir s9m338FF7gGH4pT/p5imwCLKyUqNil4SuQjGV65UGK3/jzodr95KYLxjX4WkSPak62Aj 4rQQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T5gZHPML; 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-45da76fae36si27951771cf.790.2024.10.05.15.16.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 15:16:44 -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=T5gZHPML; 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 1sxD48-0006yv-PS; Sat, 05 Oct 2024 18:15:56 -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 1sxD3y-0006xf-UP for qemu-devel@nongnu.org; Sat, 05 Oct 2024 18:15:49 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sxD3x-0005tV-8e for qemu-devel@nongnu.org; Sat, 05 Oct 2024 18:15:46 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-71dfccba177so161424b3a.0 for ; Sat, 05 Oct 2024 15:15:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728166542; x=1728771342; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=uUuy8elcXKD4Ev+p0aNnxP0u8ZBZ/r7M+GG9/Xwm2Sw=; b=T5gZHPMLE0FsYe21vAYp6DMTn1wbmrt1qLTM1LueCuy3pHp4s308km+sH4dOaSOV9B U+q5Vpcio8ar3JxrBr0szf3iMM4zhpe/Nbi/weYY6G4C7ckPetz3Yn4pTomPhsOLvZ8A f3LLKDM+LxMskz1e2J+EN9OjiqTWqWmG+K63/tt/kK9j9VrW7ryU+S0Esc/QCzGdOLlI LUIYLfLnB6OZNWkz0p4CUW1biRX889tZYGfckEIvkXkbcf7IUh/5jjlFK48B4Okwg33Z VGsuNDM1xhhJAn+HEhXPdTzWGcX81+lBS3Gk97WrW8xehwmP2yoHEukIK3E0THjMwgD0 HJuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728166542; x=1728771342; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uUuy8elcXKD4Ev+p0aNnxP0u8ZBZ/r7M+GG9/Xwm2Sw=; b=khbCZozntt4lLWp65uY11bDFUHHlWFO3lsTIyFDs6c3DrdeZSG2QG0KxNWFMaNGfyg EsmYpihO7kJzU+d2R8pQ1kYflsdAnqkckhFge/ntNIEqxMlANPMBnBNkqvIPwG657KCL eLdAlKqwFXN1cJZnBV9ZwNSh3SUCmVCGBK7VxVysR/sWMEVJNn4xkT6I1sKHOOLH1s+u KbsgZaCR2uLD9GGHP3Gk9angKUxlthd6DXw7gOXWnngx8JQVhReX9o1krL/V1C6jlkjC LJtvp6xkkfn6O2yagi+FeXz97QUEj4/mFb7lG+jfcC7Ylzr0PN3C21qOYcDTcYHUb7AD EiCQ== X-Gm-Message-State: AOJu0YyEZXkl0DsEe9vmwpJNRYa+PeOgWX5MsHzs37IaKwq3NnUdZSTG p9ep5r8JJf9ZBOUlgB4Bzk17p8ZkvbHlwUb+eUxpOo8gSTPwTEtWpdIx39vwL+TqoZqs+Z7pvSc T X-Received: by 2002:a05:6a21:3983:b0:1d6:97f2:4c12 with SMTP id adf61e73a8af0-1d6e02b14e3mr11918140637.1.1728166542412; Sat, 05 Oct 2024 15:15:42 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f680c2d6sm2216860a12.5.2024.10.05.15.15.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 15:15:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mjt@tls.msk.ru Subject: [PATCH] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr Date: Sat, 5 Oct 2024 15:15:41 -0700 Message-ID: <20241005221541.495844-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 In tcg_out_qemu_ldst_i128, we need a non-zero index register, which we then use as a base register in several address modes. Since we always have TCG_REG_TMP2 available, use that. In tcg_out_qemu_st, in the fallback when STDBRX is not available, avoid clobbering TCG_REG_TMP1, which might be h.base, which is still in use. Use TCG_REG_TMP2 instead. Since the final use of h.index is that ADDI, there is no conflict with the above. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2597 Signed-off-by: Richard Henderson Tested-By: Michael Tokarev --- tcg/ppc/tcg-target.c.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 3f413ce3c1..223f079524 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2617,8 +2617,8 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, if (TCG_TARGET_REG_BITS == 64 && addr_type == TCG_TYPE_I32) { /* Zero-extend the guest address for use in the host address. */ - tcg_out_ext32u(s, TCG_REG_R0, addrlo); - h->index = TCG_REG_R0; + tcg_out_ext32u(s, TCG_REG_TMP2, addrlo); + h->index = TCG_REG_TMP2; } else { h->index = addrlo; } @@ -2704,9 +2704,9 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg datalo, TCGReg datahi, uint32_t insn = qemu_stx_opc[opc & (MO_BSWAP | MO_SIZE)]; if (!have_isa_2_06 && insn == STDBRX) { tcg_out32(s, STWBRX | SAB(datalo, h.base, h.index)); - tcg_out32(s, ADDI | TAI(TCG_REG_TMP1, h.index, 4)); + tcg_out32(s, ADDI | TAI(TCG_REG_TMP2, h.index, 4)); tcg_out_shri64(s, TCG_REG_R0, datalo, 32); - tcg_out32(s, STWBRX | SAB(TCG_REG_R0, h.base, TCG_REG_TMP1)); + tcg_out32(s, STWBRX | SAB(TCG_REG_R0, h.base, TCG_REG_TMP2)); } else { tcg_out32(s, insn | SAB(datalo, h.base, h.index)); }