gcc.s_lock.h
text/x-chdr
Index: src/include/storage/s_lock.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/storage/s_lock.h,v
retrieving revision 1.75
diff -u -r1.75 s_lock.h
--- src/include/storage/s_lock.h 2000/12/03 14:41:42 1.75
+++ src/include/storage/s_lock.h 2000/12/24 20:04:59
@@ -79,6 +79,48 @@
* All the gcc inlines
*/
+#if defined(__alpha)
+#define __HAVE_ALPHA_TAS__
+/* avoid the __alpha && __osf__ stuff below */
+
+/*
+ ow... that hurt. perl hackers should not muck with assembly. I believe this
+ is correct. for more info on Alpha assembly, or to prove that this monkey
+ hacked some Scr3WeDuP assembly, er, I mean clean up the mess below, see
+ http://tru64unix.compaq.com/faqs/publications/base_doc/DOCUMENTATION/V40D_HTML/APS31DTE/TITLE.HTM
+ (or for an unauthorized copy/mirror)
+ http://rcfile.org/alpha/asm/
+*/
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+ slock_t _res;
+ slock_t temp;
+
+ __asm__
+ __volatile__
+ (
+ "1: ldq_l %0, %1 \n"
+ " and %0, 1, %2 \n"
+ " bne %2, 4f \n"
+ " xor %0, 1, %0 \n"
+ " stq_c %0, %1 \n"
+ " beq %0, 3f \n"
+ " mb \n"
+ " br 4f \n"
+ "3: br 1b \n"
+ "4: cmpeq %2, 0, %2 \n"
+ " xor %2, 1, %2 \n"
+ : "=&r" (temp),
+ "=m" (*lock),
+ "=&r" (_res)
+ : "m" (*lock)
+ );
+ return (int) _res;
+}
+
+#endif /* __alpha */
#if defined(__i386__)
#define TAS(lock) tas(lock)
@@ -283,6 +325,7 @@
* These are the platforms that have common code for gcc and non-gcc
*/
+#if !defined(__HAVE_ALPHA_TAS__)
#if defined(__alpha)
@@ -333,6 +376,7 @@
#endif /* __alpha */
+#endif /* __HAVE_ALPHA_TAS__ */
#if defined(__hpux)
/*