diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h
new file mode 100644
index ac434fa..dabbed4
*** a/src/include/pg_config_manual.h
--- b/src/include/pg_config_manual.h
***************
*** 170,175 ****
--- 170,179 ----
  #define PG_PRINTF_ATTRIBUTE printf
  #endif
  
+ #if defined(__ppc64__) || defined(__powerpc64__)
+ #define USE_PPC_LWARX_MUTEX_HINT
+ #endif
+ 
  /*
   *------------------------------------------------------------------------
   * The following symbols are for enabling debugging code, not for
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
new file mode 100644
index dcbca81..e40e203
*** a/src/include/storage/s_lock.h
--- b/src/include/storage/s_lock.h
*************** typedef unsigned int slock_t;
*** 361,366 ****
--- 361,376 ----
  #endif
  
  #define TAS(lock) tas(lock)
+ #define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock))
+ 
+ #ifdef USE_PPC_LWARX_MUTEX_HINT
+ #define PPC_MUTEX_HINT_ACQ ",1"
+ #define PPC_MUTEX_HINT_REL ",0"
+ #else
+ #define PPC_MUTEX_HINT_ACQ
+ #define PPC_MUTEX_HINT_REL
+ #endif /* HAVE_PPC_MUTEX_HINT */
+ 
  /*
   * NOTE: per the Enhanced PowerPC Architecture manual, v1.0 dated 7-May-2002,
   * an isync is a sufficient synchronization barrier after a lwarx/stwcx loop.
*************** tas(volatile slock_t *lock)
*** 372,378 ****
  	int _res;
  
  	__asm__ __volatile__(
! "	lwarx   %0,0,%3		\n"
  "	cmpwi   %0,0		\n"
  "	bne     1f			\n"
  "	addi    %0,%0,1		\n"
--- 382,388 ----
  	int _res;
  
  	__asm__ __volatile__(
! "	lwarx   %0,0,%3" PPC_MUTEX_HINT_ACQ	"	\n"
  "	cmpwi   %0,0		\n"
  "	bne     1f			\n"
  "	addi    %0,%0,1		\n"
