Index: postgresql-11-11.2/src/include/storage/s_lock.h
===================================================================
--- postgresql-11-11.2.orig/src/include/storage/s_lock.h
+++ postgresql-11-11.2/src/include/storage/s_lock.h
@@ -606,6 +606,13 @@ typedef unsigned int slock_t;
 
 #define TAS(lock) tas(lock)
 
+
+#if __mips_isa_rev >= 6
+# define MIPS_SET_VER "			\n"
+#else
+# define MIPS_SET_VER ".set mips2	\n"
+#endif
+
 static __inline__ int
 tas(volatile slock_t *lock)
 {
@@ -615,7 +622,7 @@ tas(volatile slock_t *lock)
 
 	__asm__ __volatile__(
 		"       .set push           \n"
-		"       .set mips2          \n"
+		MIPS_SET_VER
 		"       .set noreorder      \n"
 		"       .set nomacro        \n"
 		"       ll      %0, %2      \n"
@@ -637,7 +644,7 @@ do \
 { \
 	__asm__ __volatile__( \
 		"       .set push           \n" \
-		"       .set mips2          \n" \
+		MIPS_SET_VER			\
 		"       .set noreorder      \n" \
 		"       .set nomacro        \n" \
 		"       sync                \n" \
