From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 401B0385800F; Sat, 6 Nov 2021 16:31:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 401B0385800F From: "thiago at kde dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103066] __sync_val_compare_and_swap/__sync_bool_compare_and_swap aren't optimized Date: Sat, 06 Nov 2021 16:31:39 +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: thiago at kde dot org 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: --- 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: Sat, 06 Nov 2021 16:31:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103066 --- Comment #10 from Thiago Macieira --- You're right that emitting more penalises those who have done their job and written proper code. The problem we're seeing is that such code appears to be the minority. Or, maybe put differently, the bad code is showing up a lot in our benchmarks, especially on very big multi-core and multi-socket systems. "Fixing" the compiler would make a broad update to the industry -- so long as the code is recompiled with new compilers. Fixing the actual code would make it better = even if used with old ones. Does anyone have a suggestion on how to get best "bang for buck"? (Biggest benefit for smallest effort) This is a sincere question. I'm not trying to = be ironic or sarcastic. How can we help the most, the quickest, for the limited amount of resources we can marshal? Also, and I've been hitting this key for a few years, how can we do better = at teaching people how to use the tools at their disposal at the proper way? A very good counter-example is C++11's std::atomic_flag: you MUST NEVER use it (at least until C++20, where it got a test() member).=