From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3E00F3858407; Mon, 6 Sep 2021 14:29:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E00F3858407 From: "tnfchris at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102218] New: 128-bit atomic compare and exchange does not honor memory model on AArch64 and Arm Date: Mon, 06 Sep 2021 14:29:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: tnfchris at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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, 06 Sep 2021 14:29:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102218 Bug ID: 102218 Summary: 128-bit atomic compare and exchange does not honor memory model on AArch64 and Arm Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: tnfchris at gcc dot gnu.org Target Milestone: --- AArch64 and Arm libatomic do no support 128-bit atomics and so use the pthr= eads fallback code on atomic operations. The fallback code for atomic compare and exchange does the following pre_seq_barrier (smodel); magic =3D protect_start (mptr); and for correctness relies on the target implementing pre_seq_barrier. AArch64 and Arm however do not provide an implementation or pre_seq_barrier= and post_seq_barrier and the default implementations are just empty functions: static inline void __attribute__((always_inline, artificial)) pre_seq_barrier(int model) { } However for correctness on __ATOMIC_SEQ_CST a barrier needs to be emitted h= ere which isn't happening on any GCC version.=