On Tue, 7 Oct 2025 at 19:53, Jonathan Wakely <[email protected]> wrote: > > On Tue, 7 Oct 2025 at 18:31, Hans-Peter Nilsson <[email protected]> wrote: > > > > > From: Jonathan Wakely <[email protected]> > > > Date: Tue, 7 Oct 2025 17:32:55 +0100 > > > > > On Tue, 7 Oct 2025 at 17:29, Hans-Peter Nilsson <[email protected]> wrote: > > > > > > > > > From: Jonathan Wakely <[email protected]> > > > > > > > > > This file is no longer used, because we always use the definitions in > > > > > config/cpu/generic/atomicity_builtins/atomicity.h now. > > > > > > > > > > HP confirmed that the code generated by __atomic_fetch_add is fine and > > > > > we don't need the handwritten assembly. > > > > > > > > Right, just please s/i486/CRIS/ in the subject. > > > > > > Doh! I'm also planning to remove config/cpu/i486/atomicity.h which is > > > also unused, and I reused the commit message. > > > > Didn't look like this patch was in a series, so: > > aren't all libstdc++-v3/config/cpu/*/atomicity.h unused? > > Not all of them, but maybe more than just i486 and cris, those are > just the ones I've only confirmed so far. > > The config/cpu/generic/atomic_builtins/atomicity.h file will only be > used if __atomic_fetch_add on _Atomic_word doesn't need to link to > libatomic, which isn't necessarily true for all of these: > > config/cpu/cris/atomicity.h > config/cpu/hppa/atomicity.h > config/cpu/i386/atomicity.h > config/cpu/i486/atomicity.h > config/cpu/m68k/atomicity.h > config/cpu/sh/atomicity.h > config/cpu/sparc/atomicity.h > > I don't think we can remove it for i386 or 32-bit sparc because > changing from the current spinlock based __exchange_and_add to using > __atomic_fetch_add would be an ABI break.
I think we could replace the inline assembly used for 64-bit sparc with calls to __atomic_fetch_add. That would mean keeping the file (because it also contains the 32-bit impl) but simplifying the contents. Or we could keep it, because if it ain't broke ... > It looks like sh needs a libatomic call. I haven't checked the others. m68k and hppa make libatomic calls for __atomic_fetch_add_4, so we need to keep their atomicity.h files. So I think we can only remove cris and i486.
