From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3AD243858D37; Tue, 23 May 2023 23:58:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AD243858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684886297; bh=MeLetQVwrqk1dtbVw7vxjvRD6eNpRW4s7fk6ZIM4cn0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=k8izwpPySc2/Wv7tjTd2gZny6LHvqdBTiPhucOuv2VlmoMEG1Xl8TeKmT4qqlpCxA lfobcoGF93yvomEeeg/knfWCX7AzIxycBLqL/RFnGWDyQF82ImZCg1q967PKy4ZM6H hA0VROVTE6TqN1qO6TpnP46lPEszswTGSpCZLmog= From: "palmer at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109933] __atomic_test_and_set is broken for BIG ENDIAN riscv targets Date: Tue, 23 May 2023 23:58:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: palmer at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109933 palmer at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |palmer at gcc dot gnu.org --- Comment #7 from palmer at gcc dot gnu.org --- (In reply to Rory Bolt from comment #6) > Ah... that code makes so much sense now... >=20 > So my original comment about simply using a different constant was too > simplistic; what is being attempted is to shift the constant 1 into the > correct byte position since the flag is only a single byte but the atomic > store is done on a word... so the shift logic will need to be rewritten f= or > big endian targets. This also explains the masking of the low order addre= ss > bits... >=20 > Interesting! That seems likely to be the culprit. Do you have time to send a patch? We should probably also poke through the other sub-word patterns and make s= ure nothing else got dropped for BE.=