1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-21 02:52:47 +03:00

Allow icc to use the same atomics infrastructure as gcc.

The atomics headers were written under the impression that icc doesn't
handle gcc-style asm blocks, but this is demonstrably false on x86_[64],
because s_lock.h has done it that way for more than a decade.  (The jury is
still out on whether this also works on ia64, so I'm leaving ia64-related
code alone for the moment.)  Treat gcc and icc the same in these headers.
This is less code and it should improve the results for icc, because we
hadn't gotten around to providing icc-specific implementations for most
of the atomics.
This commit is contained in:
Tom Lane
2015-08-31 16:30:12 -04:00
parent f333204bbc
commit cf25b2a2f9
2 changed files with 16 additions and 30 deletions

View File

@@ -25,14 +25,9 @@
#endif
/*
* icc provides all the same intrinsics but doesn't understand gcc's inline asm
* An empty asm block should be a sufficient compiler barrier.
*/
#if defined(__INTEL_COMPILER)
/* NB: Yes, __memory_barrier() is actually just a compiler barrier */
#define pg_compiler_barrier_impl() __memory_barrier()
#else
#define pg_compiler_barrier_impl() __asm__ __volatile__("" ::: "memory")
#endif
/*
* If we're on GCC 4.1.0 or higher, we should be able to get a memory barrier