[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 --- Comment #12 from Jonathan Wakely --- I suppose we can do this then: --- a/libstdc++-v3/testsuite/lib/dg-options.exp +++ b/libstdc++-v3/testsuite/lib/dg-options.exp @@ -296,7 +296,6 @@ proc add_options_for_libatomic { flags } { if { [istarget hppa*-*-hpux*] || ([istarget powerpc*-*-*] && [check_effective_target_ilp32]) || [istarget riscv*-*-*] -|| ([istarget sparc*-*-linux-gnu] && [check_effective_target_ilp32]) } { global TOOL_OPTIONS
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 --- Comment #11 from John Paul Adrian Glaubitz --- (In reply to Eric Botcazou from comment #10) > Applied on the mainline only since not appropriate for release branches. OK, thanks! I will ask Matthias for including the patch in gcc-11 on Debian.
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 Eric Botcazou changed: What|Removed |Added Resolution|--- |FIXED Target Milestone|--- |12.0 Status|ASSIGNED|RESOLVED --- Comment #10 from Eric Botcazou --- Applied on the mainline only since not appropriate for release branches.
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 --- Comment #9 from CVS Commits --- The master branch has been updated by Eric Botcazou : https://gcc.gnu.org/g:23987912ddb4207de0714d81237f93f613557d1f commit r12-6938-g23987912ddb4207de0714d81237f93f613557d1f Author: Eric Botcazou Date: Mon Jan 31 09:21:48 2022 +0100 Use V8+ default in 32-bit mode on SPARC64/Linux This is what has been done for ages on SPARC/Solaris and makes it possible to use 64-bit atomic instructions even in 32-bit mode. gcc/ PR target/104189 * config/sparc/linux64.h (TARGET_DEFAULT): Add MASK_V8PLUS.
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 --- Comment #8 from John Paul Adrian Glaubitz --- Any updates on this?
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 --- Comment #7 from John Paul Adrian Glaubitz --- FWIW, I also asked David Miller regarding the register preservation and here is his answer: > The full 64-bit registers of the out and global registers are saved at trap > time. > But only 32-bits of the register window registers will be saved. I'm pretty > sure > this is what Solaris does too. > We have a mechanism for doing 64-bit register saves for 32-bit tasks. We > needed > this for some crypto assembler. The process has to request 64-bit saves and > allocate a suitable stack frame (64-bit aligned and biased like 64-bit). He also agrees that defaulting to V8+ in this case should be fine. So, I guess we can go ahead and make this change!
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 Eric Botcazou changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |ebotcazou at gcc dot gnu.org
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 --- Comment #6 from John Paul Adrian Glaubitz --- (In reply to Eric Botcazou from comment #5) > > The function init_sparc64_elf_hwcap(void) [1] unconditionally enables it > > with: > > > > cap |= (AV_SPARC_MUL32 | AV_SPARC_DIV32 | AV_SPARC_V8PLUS); > > > > So, I think it should be safe and enable V8+ on sparc64 for 32-bit targets > > the same way it is done on Solaris. > > OK, thanks, running the testsuite of the modified compiler with -m32 does > not exhibit anything suspicious either, so I'm going to make the change on > mainline. Awesome, thanks! Can we get a backport for gcc-11 as well?
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 --- Comment #5 from Eric Botcazou --- > The function init_sparc64_elf_hwcap(void) [1] unconditionally enables it > with: > > cap |= (AV_SPARC_MUL32 | AV_SPARC_DIV32 | AV_SPARC_V8PLUS); > > So, I think it should be safe and enable V8+ on sparc64 for 32-bit targets > the same way it is done on Solaris. OK, thanks, running the testsuite of the modified compiler with -m32 does not exhibit anything suspicious either, so I'm going to make the change on mainline.
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 --- Comment #4 from John Paul Adrian Glaubitz --- (In reply to John Paul Adrian Glaubitz from comment #3) > I think that should be the case given that the 32-bit SPARC port in Debian > has been based on the SPARCV8+ baseline since 2007 [1]. > > Is there any way to verify this? Looking at the kernel setup code for sparc64, support for V8+ seems to be a standard capability that is available on all 64-bit SPARC targets. The function init_sparc64_elf_hwcap(void) [1] unconditionally enables it with: cap |= (AV_SPARC_MUL32 | AV_SPARC_DIV32 | AV_SPARC_V8PLUS); So, I think it should be safe and enable V8+ on sparc64 for 32-bit targets the same way it is done on Solaris. > [1] > https://github.com/torvalds/linux/blob/5bfc75d92efd494db37f5c4c173d3639d4772966/arch/sparc/kernel/setup_64.c#L531
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 Richard Biener changed: What|Removed |Added Target Milestone|12.0|---
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 --- Comment #3 from John Paul Adrian Glaubitz --- (In reply to Eric Botcazou from comment #2) > Created attachment 52272 [details] > Tentative fix Thanks a lot for the quick fix. > This requires that the kernel preserves the full 64-bit registers even in > 32-bit mode, like on Solaris. I think that should be the case given that the 32-bit SPARC port in Debian has been based on the SPARCV8+ baseline since 2007 [1]. Is there any way to verify this? > [1] https://lists.debian.org/debian-devel-announce/2007/07/msg6.html
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 --- Comment #2 from Eric Botcazou --- Created attachment 52272 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52272=edit Tentative fix This requires that the kernel preserves the full 64-bit registers even in 32-bit mode, like on Solaris.
[Bug target/104189] enable 64-bit compare-and-swap on SPARC/Linux with V9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104189 Eric Botcazou changed: What|Removed |Added Target Milestone|--- |12.0 Ever confirmed|0 |1 Summary|[sparc] Inconsistent|enable 64-bit |behavior for -mcpu=v9 -m32 |compare-and-swap on |on Linux and Solaris|SPARC/Linux with V9 Last reconfirmed||2022-01-23 Status|UNCONFIRMED |NEW Severity|normal |enhancement Target|sparc-*-*-* |sparc*-*-linux --- Comment #1 from Eric Botcazou --- > Unless there is a specific reason, it would nice if the behavior was > consistent for both Linux and Solaris such that code that wants to use > 64-bit atomics would behave the same on the two platforms. We"re not going to penalize Solaris because of Linux though, so Linux will need to be changed if anything, which very likely means defaulting to TARGET_V8PLUS like Solaris for SPARC/Linux if V9.