From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9DF23393BC26; Wed, 23 Feb 2022 03:35:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DF23393BC26 From: "wwwhhhyyy333 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103069] cmpxchg isn't optimized Date: Wed, 23 Feb 2022 03:35:04 +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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wwwhhhyyy333 at gmail dot com 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: 12.0 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: Wed, 23 Feb 2022 03:35:04 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103069 --- Comment #19 from Hongyu Wang --- (In reply to Thiago Macieira from comment #18) > (In reply to Jakub Jelinek from comment #17) > > _Pragma("GCC target \"relax-cmpxchg-loop\"") > > should do that (ditto target("relax-cmpxchg-loop") attribute). >=20 > The attribute is applied to a function. I'm hoping to do it for s block of > code: >=20 > _Pragma("GCC push_options") > _Pragma("GCC target \"relax-cmpxchg-loop\"") > __atomic_compare_exchange_weak(....); > _Pragma("GCC pop_options") I'm not aware of any target __attribute__ or #Pragma can be used to code bl= ock, at this level user can change their code directly, so I don't know why it is needed..=