From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D4896385843A; Fri, 3 Feb 2023 21:22:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D4896385843A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675459328; bh=1BgKq1EqmvaIbIQzLjYTC2NxEpF5X9bC3X3BsHVPWhI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Zza8d6dugFiGI/93DA2LQA1AzxsSX6GA7jGAr8bjvP3jKODFYWLKLf2bFZD4bLYn6 HyKsJxmiyYnBHwN6xmHjmjBqC6Slt8UrXu7ms6twMD16wqNwHKFyqk9/hxAiczp2mr HOr1G6EOF+T2ArD6jXG4fH8ZWGx3NNz30jNGA6Pk= From: "s_gccbugzilla at nedprod dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/108659] Suboptimal 128 bit atomics codegen on AArch64 and x64 Date: Fri, 03 Feb 2023 21:22:08 +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: X-Bugzilla-Severity: normal X-Bugzilla-Who: s_gccbugzilla at nedprod dot com 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: 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=3D108659 --- Comment #7 from Niall Douglas --- (In reply to Andrew Pinski from comment #4) > (In reply to Niall Douglas from comment #3)=20 > > You may be interested in reading https://reviews.llvm.org/D110069. It w= anted > > to have LLVM generate a 128 bit AArch64 CAS for atomics. LLVM merged th= at > > change, it'll be in the next release. >=20 > Using CAS for atomic load is not valid thing to do ... > Because atomic load from constant rodata needs to work. > LLVM breaks this case as they don't care about it. GCC does though. I've heard that argument before, and I've always wondered why _Atomic128 ty= pes couldn't have an attribute which applies attribute section to their static const variable incarnations to force them into r/w memory. That would also solve the LLVM issue. Said attribute is not unuseful in general actually, it would help avoid having to mess with mprotect to apply copy on write perms = on regions in .rodata when you need to modify static const variable values. I don't think that the standard *guarantees* that static const variables go into read only memory, and besides, before C23 128 bit integers weren't supported anyway so one could argue as a proprietary extension (__int128) y= ou get proprietary special casing. Niall=