From nobody Sat Nov 23 23:25:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728166605; cv=none; d=zohomail.com; s=zohoarc; b=M7rHro8PYpWR/2Cm09pVXfTCd5yGEoSRFatsLEPLF84E1jCXik10Oy2iG/pFlIJ9FU0o81irJtfj+Q0DyO5yLwaBax8Hp+P7qkbz+8dyGwPkl02qT9KdxaM4TVNJPCvdh6RWLv91+1G8/xtCgo/95q1SdZR4pEmPohw5b6C3VAc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728166605; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uUuy8elcXKD4Ev+p0aNnxP0u8ZBZ/r7M+GG9/Xwm2Sw=; b=VzYdMApT56BZ9wOhOjoP9xCzWy9ik4i62zN/OQSUV8SxduJ9ZsvftPTdNNxe8d+NvCyZ5ND8TBH6CJz84ZbncFlFhk1zy+1TV/rx23jbBrZPMVO3aO0ARSS8RpiMiT33qf8Yu41avxdmwb+yfqBo98HxCR//+gIfLB5JZB6hwAU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 172816660575939.814305487501656; Sat, 5 Oct 2024 15:16:45 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IEbsa7lHlzM+1jzQlCJqKmWd8yxk+yz64viibsZwUZ/O936SabXCAbyjX83JHNVYmdzDBRrKA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728166606774116600 Content-Type: text/plain; charset="utf-8" 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, =20 if (TCG_TARGET_REG_BITS =3D=3D 64 && addr_type =3D=3D TCG_TYPE_I32) { /* Zero-extend the guest address for use in the host address. */ - tcg_out_ext32u(s, TCG_REG_R0, addrlo); - h->index =3D TCG_REG_R0; + tcg_out_ext32u(s, TCG_REG_TMP2, addrlo); + h->index =3D TCG_REG_TMP2; } else { h->index =3D addrlo; } @@ -2704,9 +2704,9 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg dat= alo, TCGReg datahi, uint32_t insn =3D qemu_stx_opc[opc & (MO_BSWAP | MO_SIZE)]; if (!have_isa_2_06 && insn =3D=3D 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)); } --=20 2.43.0