From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 857983858004; Mon, 24 Jan 2022 23:52:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 857983858004 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103069] cmpxchg isn't optimized Date: Mon, 24 Jan 2022 23:52: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: hjl.tools at gmail dot com X-Bugzilla-Status: REOPENED 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: Mon, 24 Jan 2022 23:52:04 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103069 --- Comment #7 from H.J. Lu --- nptl/pthread_mutex_unlock.c in glibc has: do=20=20 {=20 newval =3D oldval & PTHREAD_MUTEX_PRIO_CEILING_MASK; } while (!atomic_compare_exchange_weak_release (&mutex->__data.__lock, &oldval, newval)); GCC 12 generates: 90a81: 41 89 c0 mov %eax,%r8d 90a84: 41 81 e0 00 00 f8 ff and $0xfff80000,%r8d 90a8b: f0 44 0f b1 07 lock cmpxchg %r8d,(%rdi)=20=20=20= =20=20=20=20 90a90: 75 ef jne 90a81 <__pthread_mutex_unlock_ful l+0x81>=