Re: [PATCH] LoongArch: Fix atomic_exchange make comparison and may jump out

2022-11-16 Thread Xi Ruoyao via Gcc-patches
On Thu, 2022-11-17 at 11:46 +0800, Jinyang He wrote: > > So we do need an additional dbar for compare-and-exchange, but do > > not > > need it for a bare atomic exchange? > Yes. Ok, I just noticed we also don't use dbar in atomic_add etc. I've adjusted the patch a little (in attachment): rewritte

Re: [PATCH] LoongArch: Fix atomic_exchange make comparison and may jump out

2022-11-16 Thread Jinyang He
On 2022/11/17 上午11:38, Xi Ruoyao wrote: On Thu, 2022-11-17 at 10:55 +0800, Jinyang He wrote: On 2022/11/17 上午9:39, Jinyang He wrote: On 2022/11/16 下午7:46, Xi Ruoyao wrote: On Wed, 2022-11-16 at 10:11 +0800, Jinyang He wrote: +  return "%G6\\n\\t" +    "1:\\n\\t" +    "ll.\\t%0,%1\

Re: [PATCH] LoongArch: Fix atomic_exchange make comparison and may jump out

2022-11-16 Thread Xi Ruoyao via Gcc-patches
On Thu, 2022-11-17 at 10:55 +0800, Jinyang He wrote: > On 2022/11/17 上午9:39, Jinyang He wrote: > > > On 2022/11/16 下午7:46, Xi Ruoyao wrote: > > > > > On Wed, 2022-11-16 at 10:11 +0800, Jinyang He wrote: > > > > > > > > > +  return "%G6\\n\\t" > > > > > > +    "1:\\n\\t" > > > > > > +   

Re: [PATCH] LoongArch: Fix atomic_exchange make comparison and may jump out

2022-11-16 Thread Jinyang He
On 2022/11/17 上午9:39, Jinyang He wrote: On 2022/11/16 下午7:46, Xi Ruoyao wrote: On Wed, 2022-11-16 at 10:11 +0800, Jinyang He wrote: +  return "%G6\\n\\t" +    "1:\\n\\t" +    "ll.\\t%0,%1\\n\\t" +    "and\\t%7,%0,%z3\\n\\t" +    "or%i5\\t%7,%7,%5\\n\\t" +    "sc.\\t%7,%1\

Re: [PATCH] LoongArch: Fix atomic_exchange make comparison and may jump out

2022-11-16 Thread Jinyang He
On 2022/11/16 下午7:46, Xi Ruoyao wrote: On Wed, 2022-11-16 at 10:11 +0800, Jinyang He wrote: +  return "%G6\\n\\t" +    "1:\\n\\t" +    "ll.\\t%0,%1\\n\\t" +    "and\\t%7,%0,%z3\\n\\t" +    "or%i5\\t%7,%7,%5\\n\\t" +    "sc.\\t%7,%1\\n\\t" +    "beqz\\t%7,1b\\n\\t"; Do

Re: [PATCH] LoongArch: Fix atomic_exchange make comparison and may jump out

2022-11-16 Thread Xi Ruoyao via Gcc-patches
On Wed, 2022-11-16 at 10:11 +0800, Jinyang He wrote: > > > +  return "%G6\\n\\t" > > > +    "1:\\n\\t" > > > +    "ll.\\t%0,%1\\n\\t" > > > +    "and\\t%7,%0,%z3\\n\\t" > > > +    "or%i5\\t%7,%7,%5\\n\\t" > > > +    "sc.\\t%7,%1\\n\\t" > > > +    "beqz\\t%7,1b\\n\\t"; > > D

Re: [PATCH] LoongArch: Fix atomic_exchange make comparison and may jump out

2022-11-15 Thread Jinyang He
On 2022/11/15 下午10:21, Xi Ruoyao wrote: On Tue, 2022-11-15 at 21:03 +0800, Jinyang He wrote: gcc/ChangeLog: * config/loongarch/sync.md: Add atomic_cas_value_exchange_and_7 and fix atomic_exchange. nit: * config/loongarch/sync.md (atomic_cas_value_exchange_and_7): New define_i

Re: [PATCH] LoongArch: Fix atomic_exchange make comparison and may jump out

2022-11-15 Thread Xi Ruoyao via Gcc-patches
On Tue, 2022-11-15 at 21:03 +0800, Jinyang He wrote: > gcc/ChangeLog: > > * config/loongarch/sync.md: > Add atomic_cas_value_exchange_and_7 and fix atomic_exchange. nit: * config/loongarch/sync.md (atomic_cas_value_exchange_and_7):  New define_insn. (atomic_exchange): Use

[PATCH] LoongArch: Fix atomic_exchange make comparison and may jump out

2022-11-15 Thread Jinyang He
gcc/ChangeLog: * config/loongarch/sync.md: Add atomic_cas_value_exchange_and_7 and fix atomic_exchange. gcc/testsuite/ChangeLog: * gcc.target/loongarch/sync-1.c: New test. --- gcc/config/loongarch/sync.md| 27 - gcc/testsuite/gcc.target/loongarch/sync-1.c | 104