Re: Fences/Barriers when mixing C++ atomics and non-atomics

2022-10-13 Thread Hans Boehm via Gcc
On Thu, Oct 13, 2022 at 2:11 PM Vineet Gupta wrote: > Hi Hans, > > On 10/13/22 13:54, Hans Boehm wrote: > > The generated code here is correct in both cases. In the RISC--V case, I > believe it is conservative, at a minimum, in that atomics should not imply > IO ordering. We had an earlier discus

Re: Fences/Barriers when mixing C++ atomics and non-atomics

2022-10-13 Thread Uros Bizjak via Gcc
On Thu, Oct 13, 2022 at 11:14 PM Vineet Gupta wrote: > > > > On 10/13/22 13:30, Uros Bizjak wrote: > > OTOH, for x86 (same default toggles) there's no barriers at all. > > _Z10bar_seqcstiPi: > endbr64 > movlg(%rip), %eax > movl%eax, (%rsi) > movl

Re: Fences/Barriers when mixing C++ atomics and non-atomics

2022-10-13 Thread Vineet Gupta
On 10/13/22 13:30, Uros Bizjak wrote: OTOH, for x86 (same default toggles) there's no barriers at all. _Z10bar_seqcstiPi: endbr64 movlg(%rip), %eax movl%eax, (%rsi) movla(%rip), %eax addl%edi, %eax ret Regardin

Re: Fences/Barriers when mixing C++ atomics and non-atomics

2022-10-13 Thread Vineet Gupta
Hi Hans, On 10/13/22 13:54, Hans Boehm wrote: The generated code here is correct in both cases. In the RISC--V case, I believe it is conservative, at a minimum, in that atomics should not imply IO ordering. We had an earlier discussion, which seemed to have consensus in favor of that opinion.

Re: Fences/Barriers when mixing C++ atomics and non-atomics

2022-10-13 Thread Hans Boehm via Gcc
The generated code here is correct in both cases. In the RISC--V case, I believe it is conservative, at a minimum, in that atomics should not imply IO ordering. We had an earlier discussion, which seemed to have consensus in favor of that opinion. I believe clang does not enforce IO ordering. You

Re: Fences/Barriers when mixing C++ atomics and non-atomics

2022-10-13 Thread Uros Bizjak via Gcc
On Thu, Oct 13, 2022 at 9:31 PM Vineet Gupta wrote: > > Hi, > > I have a testcase (from real workloads) involving C++ atomics and trying > to understand the codegen (gcc 12) for RVWMO and x86. > It does mix atomics with non-atomics so not obvious what the behavior is > intended to be hence some ex

Re: Fences/Barriers when mixing C++ atomics and non-atomics

2022-10-13 Thread Jonathan Wakely via Gcc
On Thu, 13 Oct 2022 at 20:31, Vineet Gupta wrote: > > Hi, > > I have a testcase (from real workloads) involving C++ atomics and trying > to understand the codegen (gcc 12) for RVWMO and x86. > It does mix atomics with non-atomics so not obvious what the behavior is > intended to be hence some expli

Fences/Barriers when mixing C++ atomics and non-atomics

2022-10-13 Thread Vineet Gupta
Hi, I have a testcase (from real workloads) involving C++ atomics and trying to understand the codegen (gcc 12) for RVWMO and x86. It does mix atomics with non-atomics so not obvious what the behavior is intended to be hence some explicit CC of subject matter experts (apologies for that in adv