From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 476A338582BF; Mon, 8 Aug 2022 13:38:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 476A338582BF From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102218] 128-bit atomic compare and exchange does not honor memory model on AArch64 and Arm Date: Mon, 08 Aug 2022 13:38:29 +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: 9.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: tnfchris 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2022 13:38:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102218 --- Comment #1 from CVS Commits --- The master branch has been updated by Tamar Christina : https://gcc.gnu.org/g:e6a8ae900b4141bbce1451da8f173d441662782d commit r13-1988-ge6a8ae900b4141bbce1451da8f173d441662782d Author: Tamar Christina Date: Mon Aug 8 14:37:00 2022 +0100 AArch64: Fix 128-bit sequential consistency atomic operations. The AArch64 implementation of 128-bit atomics is broken. For 128-bit atomics we rely on pthread barriers to correct guard the address in the pointer to get correct memory ordering. However for 128-bit ato= mics the address under the lock is different from the original pointer. This means that one of the values under the atomic operation is not protected properly and so we fail during when the user has requested sequential consistency as there's no barrier to enforce this requirement. As such users have resorted to adding an #ifdef GCC #endif around the use of these atomics. This corrects the issue by issuing a barrier only when __ATOMIC_SEQ_CST= was requested. To remedy this performance hit I think we should revisit us= ing a similar approach to out-line-atomics for the 128-bit atomics. Note that I believe I need the empty file due to the include_next chain= but I am not entirely sure. I have hand verified that the barriers are inserted for atomic seq cst. libatomic/ChangeLog: PR target/102218 * config/aarch64/aarch64-config.h: New file. * config/aarch64/host-config.h: New file.=