On Tue, Jul 21, 2026 at 2:07 PM Richard Biener <[email protected]> wrote: > > On Tue, Jul 21, 2026 at 12:45 AM H.J. Lu <[email protected]> wrote: > > > > With the silicon vendor guarantees from Intel, AMD, Hygon and Zhaoxin in: > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104688 > > > > many software developers would happily use inline 128-bit atomic loads > > and stores in their programs because they only target compatible CPUs. > > Add -m128bit-atomic to generate 128-bit atomic loads and stores to avoid > > the overhead of calling into libatomic. Enable -m128bit-atomic by default > > if supported by the targeting processor, which is one of x86-64-v3 capable > > processors as well as AVX capable processors from Intel, AMD, Hygon and > > Zhaoxin, with SEE2 and CMPXCHG16B enabled. > > Does this correctly inter-operate with -mgeneral-regs-only? What do we do > there for 128bit atomics? Dispatch to libatomic which will then still
No changes from before. For the same reason, codes compiled with -mgeneral-regs-only may use SSE if it calls libc functions. > use SSE2 + CMPXCHG16B? Or do we diagnose 128bit atomic use? This is orthogonal to -m128bit-atomic. > > > > gcc/ > > > > PR target/94649 > > PR target/126293 > > * common/config/i386/i386-cpuinfo.h (ix86_decode_cpu_info): New > > function. > > * config/i386/i386-options.cc (ix86_function_specific_save): Save > > x_ix86_128bit_atomic. > > (ix86_function_specific_restore): Restore x_ix86_128bit_atomic. > > (ix86_option_override_internal): Turn off -m128bit-atomic when > > CMPXCHG16B is disabled and turn on CMPXCHG16B when -m128bit-atomic > > is enabled. Enable -m128bit-atomic by default if supported by > > the targeting processor with SEE2 and CMPXCHG16B enabled. > > * config/i386/i386.opt (x_ix86_128bit_atomic): New TargetSave. > > (m128bit-atomic): New option. > > * config/i386/i386.opt.urls: Regenerated. > > * config/i386/sync.md (atomic_loadti): New pattern. > > (atomic_loadti_sse): Likewise. > > (atomic_storeti): Likewise. > > (atomic_storeti_sse): Likewise. > > * doc/invoke.texi: Document -m128bit-atomic. > > > > gcc/testsuite/ > > > > PR target/94649 > > PR target/126293 > > * g++.target/i386/pr94649-1.C: New test. > > * gcc.target/i386/pr126293-1a.c: Likewise. > > * gcc.target/i386/pr126293-1b.c: Likewise. > > * gcc.target/i386/pr126293-1c.c: Likewise. > > * gcc.target/i386/pr126293-2a.c: Likewise. > > * gcc.target/i386/pr126293-2b.c: Likewise. > > * gcc.target/i386/pr126293-3a.c: Likewise. > > * gcc.target/i386/pr126293-3b.c: Likewise. > > * gcc.target/i386/pr126293-4a.c: Likewise. > > * gcc.target/i386/pr126293-4b.c: Likewise. > > * gcc.target/i386/pr126293-4c.c: Likewise. > > * gcc.target/i386/pr126293-4d.c: Likewise. > > * gcc.target/i386/pr126293-4e.c: Likewise. > > * gcc.target/i386/pr126293-4f.c: Likewise. > > * gcc.target/i386/pr126293-4g.c: Likewise. > > * gcc.target/i386/pr126293-4h.c: Likewise. > > * gcc.target/i386/pr126293-4i.c: Likewise. > > * gcc.target/i386/pr126293-4j.c: Likewise. > > * gcc.target/i386/pr126293-4k.c: Likewise. > > * gcc.target/i386/pr126293-4l.c: Likewise. > > * gcc.target/i386/pr126293-4m.c: Likewise. > > * gcc.target/i386/pr126293-4n.c: Likewise. > > * gcc.target/i386/pr126293-4o.c: Likewise. > > * gcc.target/i386/pr126293-4p.c: Likewise. > > * gcc.target/i386/pr126293-4q.c: Likewise. > > * gcc.target/i386/pr126293-5.c: Likewise. > > * gcc.target/i386/pr126293-6.c: Likewise. > > * gcc.target/i386/pr126293-7.c: Likewise. > > * gcc.target/i386/pr126293-8.c: Likewise. > > * gcc.target/i386/pr126293-9.c: Likewise. > > * gcc.target/i386/pr126293-10.c: Likewise. > > * gcc.target/i386/pr126293-11.c: Likewise. > > * gcc.target/i386/pr126293-12.c: Likewise. > > * gcc.target/i386/pr126293-13.c: Likewise. > > * gcc.target/i386/pr126293-14.c: Likewise. > > * gcc.target/i386/pr126293-15.c: Likewise. > > > > > > -- > > H.J. -- H.J.
