From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GXHzMqqOn2qVLTYAWB0awg (envelope-from ) for ; Tue, 08 Sep 2026 00:27:22 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=XgoUPacb; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id CBC4C1E091; Tue, 08 Sep 2026 00:27:22 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 641D91E091 for ; Tue, 08 Sep 2026 00:27:21 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DFA424BA901C for ; Tue, 8 Sep 2026 04:27:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DFA424BA901C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=XgoUPacb Received: from mail-pj2-x08.google.com (mail-pj2-x08.google.com [IPv6:2607:f8b0:4864:39::8]) by sourceware.org (Postfix) with ESMTPS id 1E72B4BA7985 for ; Tue, 8 Sep 2026 04:26:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1E72B4BA7985 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1E72B4BA7985 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:39::8 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788841609; cv=none; b=a2yAGCeyN/fjzUClGIZzKyTN3mZ73M1mEZ6+ORyU/c+SDRDX2JWI20Brp8Tl3kt9hUyqbk4Dr2EDgHLibhwpDCVwH45H0yaUoU87nHSFl6g5lUWGowneaQ1k61VMpWRZddNLrNUTNWOVm6ebBbLh4+mAOvTsRbMCqJ8EDzKQwTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788841609; c=relaxed/simple; bh=XOq76FO9qv9nIeq/vfxqxLe38W/+23QkxP2HM49aBjk=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=Xgd6a7iLIbO30BtoUueFXShiNaay/RfQ7jOGZgwat53c6hxZEuA8LP0EfaaKxQ6mP6gcOkMg18DN6exAQO5UaSAf+3BwqE2wQJdBVOEe+rc+CN74D+hsMq3ZPAEIy2Be8lRncCVB6Tby4i4d4INCyPIi8iYX9cn1853DfkLcRDI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=XgoUPacb DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E72B4BA7985 Received: by mail-pj2-x08.google.com with SMTP id d9443c01a7336-2d313798bf8so19454735ad.0 for ; Mon, 07 Sep 2026 21:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788841608; x=1789446408; darn=sourceware.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:to:from:subject:message-id:from:to:cc :subject:date:message-id:reply-to:content-type; bh=GuVtoMRbp44fLShEGULbM+UVe2RUGXmVsniQcSOqtkI=; b=XgoUPacbV1c0+loP5B5rgQeWJ4U1ZEgvtiAFu8ITot0p1SeXWw14CNitOqtd8ykd6z 9TydEDCiY04WVNrA4NkkCFZPBd6UrRdtiEvaBYxLHzqa/uunL6w7SLKPLINmtc/AW4I0 CpQQuH+T1QqDyMhbe3nl8OlekX5vKl65pkSDSaJrs+0moI/z6rDmECAt2oe3SL3GRZXp fo2ljqMVFGTrBCtTS0yPwO191QxC+nCRYtxBxoWKrw4dcHLRlf7qzNGvNcRK3Ioes1uG +YhWVdsS1TLbMiUcOmZEOOMeIev+1w5y/5fcBQ/bmSlTbaQIcOdHn6yxoLwKDXG+C++u LKDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788841608; x=1789446408; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=GuVtoMRbp44fLShEGULbM+UVe2RUGXmVsniQcSOqtkI=; b=cAAkdbZ4H7eUNWW36bbtGdJuhHwJe4mldqjaoz1lJUSusIj27olKI7IPnjd8Spnnfn KiPhGu8jPX6DJhzzQPlXPLCmDZqGEuGQBsIjblNKSDfhyjphcc+Oz1MVLrV44qhPSnDI 1UgnjSeu0WtiCJ4bm1R/jKcsS4ZYlDoh/OSdJzkD0lk9524aNGyARsR0f9jiESy6GG+K d7hQ08/fXQ1GrvVFy9TrmrS8660WevnqnCgkreqMijfjcc0+KmwU+Aa7NY2oHmZckN9f LGRVSOvDNv3jejMRL6gMqmuXmQmpgHH0OivLkn7RTp4xnTzhh86yM+FjGHTIOUdhayvS c7gg== X-Forwarded-Encrypted: i=1; AKwUvBxdcJ01mMHRzUCo3MQ6hIuOLG8+14Mkpa4VTqvA3g5SWgHH0GjGSrFnLNe1NcLTIKQLi/hqR5H0rjf6hQ==@sourceware.org X-Gm-Message-State: AFuF++nHqHZjf2LxLNcAsGNwGXSRxMMfLItebFsMwAOveLx2szncCL9n AzS+q1hn7C2zSaWCIDwvgjrHwmPZYcZ6OqbQxdG+fHEPBnyyrQikXWEm X-Gm-Gg: AYBFou1PLxaErdgTXbgcXgvFup1541jCHTPqI83cK5avslWMD02Layfqf6+fGTUh57t W74vln5AmjywZ9CRThq68Ia0AxdJprL50Ehr9ijmnHoU826EU9rglxdfr3lA3L9VHUISg0MZSdv 3KbB7U46YMFk1r9EPZArgoLLghCcr+8w+cEihaEwDC2sZmc438KxFPLJKEYfPYwW1harxEB92Sf U9th9W40sSfgJiNnNTuUgThF8knWyBPpdXdLw3HhrD9emdtB+3nHheqZzU7I0W2B8aNP+L2es3t fJmDeoVNVgHqJACm1MsGPZeKYq2blR+0HSIK7DGZXE90L0MuUjtdEQ0lPQfmMFt3KCn5xDo7bN/ i4whd3cQyz+O483UmeFp9Zru+SkscewUAX1vK8a2KkMwYUn3HQo2eb9A8M0AUd/riCR9TDoY/5j nJQZnmOXOQLAikv3gZN8alrtQ5lqFZzfKQGpm9+h6hhi0fHz12Iuxq+QOVKzntvuA60qQTtPnap p5DkVBc X-Received: by 2002:a17:902:f690:b0:2d8:d4ce:7e3d with SMTP id d9443c01a7336-2db126326f4mr350142035ad.18.1788841608012; Mon, 07 Sep 2026 21:26:48 -0700 (PDT) Received: from localhost.localdomain ([2407:c800:3620:e800:7910:9280:8105:5a2]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2db1483de0asm51248325ad.11.2026.09.07.21.26.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 21:26:47 -0700 (PDT) Message-ID: <16fd4917c4f7151eca4032d82091103238aff05e.camel@gmail.com> Subject: Ping^1 Re: [SH] Fix mac.w insn simulation for SH2 and above From: Oleg Endo To: Andrew Burgess , gdb-patches@sourceware.org Date: Tue, 08 Sep 2026 13:26:46 +0900 In-Reply-To: <415e88e0340cf7552d30d6fb0cb4886a7a5e5faa.camel@gmail.com> References: <871pbnvhx0.fsf@redhat.com> <415e88e0340cf7552d30d6fb0cb4886a7a5e5faa.camel@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-2.fc41) MIME-Version: 1.0 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Ping On Tue, 2026-08-25 at 09:55 +0900, Oleg Endo wrote: > On Mon, 2026-08-24 at 13:09 +0100, Andrew Burgess wrote: > > Oleg Endo writes: > >=20 > > > Hi, > > >=20 > > > The simulator currently implements only the SH1 version of the mac.w > > > instruction. On SH1 the MACH:MACL accumulator register is only 42-bi= t. It > > > was extended to 64-bit on SH2 and every variant that followed after. > > >=20 > > > The issue probably never showed up because GCC hasn't been able to em= it the > > > SH integer mac instructions. I ran into this because I was trying to= do > > > exactly that and while running some tests on sh-sim. > > >=20 > > > The attached patch uses the bfd_mach field to distinguish between SH1= and > > > not-SH1 in the simulation of the mac.w instruction, in a similar way = as it's > > > already been done for some SH2A instructions. > > >=20 > > >=20 > > > OK to commit & push? > > >=20 > > > Best regards, > > > Oleg Endo > > > From 6b07e3daa73acac1d1800c94cdfae0b83509f2d1 Mon Sep 17 00:00:00 200= 1 > > > From: Oleg Endo > > > Date: Sun, 2 Aug 2026 19:37:21 +0900 > > > Subject: [PATCH] sim/sh: fix mac.w insn for SH2+ > > >=20 > > > On SH1 the MACH:MACL accumulator is only 42 bits wide. On SH2 and ab= ove it's 64 > > > bits wide. Emulate the corresponding behavior based on the bfd_mach = field. > > > --- > > > sim/sh/interp.c | 7 +++++-- > > > 1 file changed, 5 insertions(+), 2 deletions(-) > > >=20 > > > diff --git a/sim/sh/interp.c b/sim/sh/interp.c > > > index c8c2a74..cc4ae2c 100644 > > > --- a/sim/sh/interp.c > > > +++ b/sim/sh/interp.c > > > @@ -1197,8 +1197,11 @@ macw (int *regs, unsigned char *memory, int n,= int m, int endianw) > > > long mach; > > > /* Add to MACH the sign extended product, and carry from low s= um. */ > > > mach =3D MACH + (-(prod < 0)) + ((unsigned long) sum < prod); > > > - /* Sign extend at 10:th bit in MACH. */ > > > - MACH =3D (mach & 0x1ff) | -(mach & 0x200); > > > + /* SH1: MACH:MACL is 42 bits wide, sign extend at the 10:th b= it in MACH. > >=20 > > Could you fix '10:th' to '10th' please. > >=20 > > > + SH2+: MACH:MACL is 64 bits wide. */ > >=20 > > This line should be indented with TAB. > >=20 > > > + if (saved_state.asregs.bfd_mach =3D=3D bfd_mach_sh) > > > + mach =3D (mach & 0x1ff) | -(mach & 0x200); > > > + MACH =3D mach; > > > } > >=20 > > Is it possible to write a test for this change? I know simulator > > testing is very patchy, but if we add tests for things that are fixed > > we'll slowly start to build up some decent test coverage. > >=20 >=20 > Added test case and adjusted the other hunks. > Updated patch attached. >=20 > One of my previous sh-sim changes caused a fallout. I've posted a separa= te > patch for that, awaiting feedback. > https://marc.info/?l=3Dgdb-patches&m=3D178567807485933&w=3D2 >=20 > Best regards, > Oleg Endo >=20