From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 528E83858D20; Wed, 12 Jul 2023 14:58:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 528E83858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689173888; bh=l/iGRnPg3ia+x9c6eoM8yYFTd9h+OAkyIr7Q6AvF0xo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fWtnfjp+8tZFnh3ga8XTQYy7h79reQEuUtPv7dnYwRVdCkcZFbA0TNgq2bu/p53U+ 7sv1VK827SgEukHlKTkK9Kbx5oRGf7VFwkG8FXiKdhhyCr716g/MNSXcbuRYnGhdJS OktsYavWvWymg+WAh+QeYsZO46qYzCVDXCOsPFxw= From: "koachan+gccbugs at protonmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/110592] [SPARC] GCC should default to TSO memory model when compiling for sparc32 Date: Wed, 12 Jul 2023 14:58:06 +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: koachan+gccbugs at protonmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: attachments.created 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=3D110592 --- Comment #8 from Koakuma --- Created attachment 55529 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D55529&action=3Dedit Proposed patch for relaxing the guards of barrier emission Hello, sorry that I only got to reply now. And yeah, I first noticed it when I was trying out some C++ concurrency tutorials. A bit weird, I admit... That being said, > Sorry, no, NetBSD/sparc is too obscure a platform to justify changing the= default for the entire compiler. Understood. So the memory model default should not change, that is okay. (And I believe the NetBSD folks also agree with me on this?) However... > But you can do like Linux & Solaris and add sparc/tso.h to the tm_file li= st of sparc-*-netbsdelf*) in config.gcc. As Campbell has said, the thing is that this (and -mmemory-model=3Dtso) cur= rently does not work when targeting v7 because all the barrier emitters are gated = with TARGET_V8 || TARGET_V9. (By the way, `-mcpu=3Dv7 -mmemory-model=3Dtso` is broken on Linux too, for = the same reason) Attached is a patch to relax the barrier requirements such that it is possi= ble to emit the ldstub barriers even when targeting v7. This does not change any defaults, but, crucially, it does allow -mmemory-model=3Dtso to be used wit= h v7 target. There is probably some better way to do it - I am unfamiliar with GCC inter= nals - but so far it has been working fine to me. What do you think? Would it be okay if it is only changed in this way?=