[Bug c++/109362] codegen adds unnecessary extra add when reading atomic member

2023-03-31 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109362 --- Comment #4 from Barry Revzin --- Awesome!

[Bug c++/109362] codegen adds unnecessary extra add when reading atomic member

2023-03-31 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109362 --- Comment #3 from Jakub Jelinek --- Reduced C testcase would be struct S { long a, b; }; int foo (struct S *v) { while (1) { __atomic_load_n (&v->a, __ATOMIC_ACQUIRE); if (__atomic_load_n (&v->b, __ATOMIC_ACQUIRE)) r

[Bug c++/109362] codegen adds unnecessary extra add when reading atomic member

2023-03-31 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109362 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c++/109362] codegen adds unnecessary extra add when reading atomic member

2023-03-31 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109362 --- Comment #1 from Barry Revzin --- Sorry, in this reduced example, it doesn't actually consume an extra register - only rdi is used. In this slightly less reduced example: #include struct S { std::atomic size; std::atomic read_ptr