From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7F6CA3857C69; Thu, 30 Nov 2023 16:45:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F6CA3857C69 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701362702; bh=1wrQF5n3HZmBOCVxvgeRR09iVZkEIMXyUN6Fx3gd1RE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bdgdFTQsP662oAGFSAro2Yv8pNR8pq3XUl74WbXLRE7tnvlszn8rG/ksBKKz7ETQD nrjUvLhdaWSGcJn3OUmPfszBcnCrO3+sT//bDw23ZNxtfEXMhxbFb9kAs/4kBdfbdN 17L9lz/4mm942oU+/UJPU25m/SB7wULrOvvyk5o0= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111404] [AArch64] 128-bit __sync_val_compare_and_swap is not atomic Date: Thu, 30 Nov 2023 16:45:01 +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: 8.5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: wilco at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D111404 --- Comment #2 from GCC Commits --- The master branch has been updated by Wilco Dijkstra : https://gcc.gnu.org/g:df8958e6bc5d050dab8bdc5954c1632fb0e98d18 commit r14-6021-gdf8958e6bc5d050dab8bdc5954c1632fb0e98d18 Author: Wilco Dijkstra Date: Thu Nov 30 16:14:35 2023 +0000 AArch64: Fix __sync_val_compare_and_swap [PR111404] __sync_val_compare_and_swap may be used on 128-bit types and either cal= ls the outline atomic code or uses an inline loop. On AArch64 LDXP is only at= omic if the value is stored successfully using STXP, but the current implementations do not perform the store if the comparison fails. In this case the val= ue returned is not read atomically. gcc/ChangeLog: PR target/111404 * config/aarch64/aarch64.cc (aarch64_split_compare_and_swap): For 128-bit store the loaded value and loop if needed. libgcc/ChangeLog: PR target/111404 * config/aarch64/lse.S (__aarch64_cas16_acq_rel): Execute STLXP using either new value or loaded value.=