Skip to content

Commit 609e32b

Browse files
committed
Add spinlock support for Itanium processor with Intel compiler.
Vikram Kalsi
1 parent 164adc4 commit 609e32b

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/include/storage/s_lock.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
6767
* Portions Copyright (c) 1994, Regents of the University of California
6868
*
69-
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.133 2004/12/31 22:03:42 pgsql Exp $
69+
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.134 2005/03/10 21:41:01 momjian Exp $
7070
*
7171
*-------------------------------------------------------------------------
7272
*/
@@ -168,14 +168,16 @@ spin_delay(void)
168168
#endif /* __i386__ || __x86_64__ */
169169

170170

171-
#if defined(__ia64__) || defined(__ia64) /* __ia64 used by ICC compiler? */
171+
#if defined(__ia64__) || defined(__ia64)
172172
/* Intel Itanium */
173173
#define HAS_TEST_AND_SET
174174

175175
typedef unsigned int slock_t;
176176

177177
#define TAS(lock) tas(lock)
178178

179+
#ifndef __INTEL_COMPILER
180+
179181
static __inline__ int
180182
tas(volatile slock_t *lock)
181183
{
@@ -189,6 +191,19 @@ tas(volatile slock_t *lock)
189191
return (int) ret;
190192
}
191193

194+
#else
195+
196+
static __inline__ int
197+
tas(volatile slock_t *lock)
198+
{
199+
int ret;
200+
201+
ret = _InterlockedExchange(lock,1); /* this is a xchg asm macro */
202+
203+
return ret;
204+
}
205+
206+
#endif
192207
#endif /* __ia64__ || __ia64 */
193208

194209

0 commit comments

Comments
 (0)