Avoid atomic for guard acquire when that is expensive
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Tue, 1 Dec 2020 17:54:48 +0000 (18:54 +0100)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Tue, 8 Dec 2020 20:07:02 +0000 (21:07 +0100)
commit447f99b3b8baabbfb33b29123113637e54c5e652
tree59eb5f7abb8bd21cd8d2eed6f71c55cc657070ba
parentf7251a2c103bc48775cb9726a4bebeaebde96684
Avoid atomic for guard acquire when that is expensive

When the atomic access involves a call to __sync_synchronize
it is better to call __cxa_guard_acquire unconditionally,
since it handles the atomics too, or is a non-threaded
implementation when there is no gthread support for this target.

This fixes also a bug for the ARM EABI big-endian target,
that is, previously the wrong bit was checked.

2020-12-08  Bernd Edlinger  <bernd.edlinger@hotmail.de>

* decl2.c: (is_atomic_expensive_p): New helper function.
(build_atomic_load_byte): Rename to...
(build_atomic_load_type): ... and add new parameter type.
(get_guard_cond): Skip the atomic here if that is expensive.
Use the correct type for the atomic load on certain targets.
gcc/cp/decl2.c