Browse code

- mips inline asm gcc 3.x warnings fixed - mips2 NOSMP mode (skip sync) - minor x86 & mips optimizations

Andrei Pelinescu-Onciul authored on 08/03/2006 16:50:19
Showing 1 changed files
... ...
@@ -42,6 +42,8 @@
42 42
  *  2005-05-25  PPC locking code enabled for PPC64; added a lwsync to
43 43
  *               the tsl part and replaced the sync with a lwsync for the
44 44
  *               unlock part (andrei)
45
+ *  2006-03-08  mips2 NOSMP (skip sync), optimized x86 & mips clobbers and
46
+ *               input/output constraints (andrei)
45 47
  *
46 48
  */
47 49
 
... ...
@@ -78,7 +80,7 @@ inline static int tsl(fl_lock_t* lock)
78 80
 	asm volatile(
79 81
 		" btsl $0, %1 \n\t"
80 82
 		" adcl $0, %0 \n\t"
81
-		: "=q" (val), "=m" (*lock) : "0"(val) : "memory", "cc" /* "cc" */
83
+		: "=q" (val), "=m" (*lock) : "0"(val) : "memory", "cc"
82 84
 	);
83 85
 #else
84 86
 	val=1;
... ...
@@ -121,7 +123,6 @@ inline static int tsl(fl_lock_t* lock)
121 123
         );
122 124
 #elif defined __CPU_mips2
123 125
 	long tmp;
124
-	tmp=1; /* just to kill a gcc 2.95 warning */
125 126
 	
126 127
 	asm volatile(
127 128
 		".set noreorder\n\t"
... ...
@@ -130,10 +131,13 @@ inline static int tsl(fl_lock_t* lock)
130 131
 		"    sc %0, %2  \n\t"
131 132
 		"    beqz %0, 1b \n\t"
132 133
 		"    nop \n\t"
134
+#ifndef NOSMP
135
+		"    sync \n\t"
136
+#endif
133 137
 		".set reorder\n\t"
134 138
 		: "=&r" (tmp), "=&r" (val), "=m" (*lock) 
135
-		: "0" (tmp), "2" (*lock) 
136
-		: "cc"
139
+		: "m" (*lock) 
140
+		: "memory"
137 141
 	);
138 142
 #elif defined __CPU_alpha
139 143
 	long tmp;
... ...
@@ -184,10 +188,8 @@ inline static void get_lock(fl_lock_t* lock)
184 188
 inline static void release_lock(fl_lock_t* lock)
185 189
 {
186 190
 #if defined(__CPU_i386) || defined(__CPU_x86_64)
187
-	char val;
188
-	val=0;
189 191
 	asm volatile(
190
-		" movb $0, (%0)" : /*no output*/ : "r"(lock): "memory"
192
+		" movb $0, %0" : "=m"(*lock) : : "memory"
191 193
 		/*" xchg %b0, %1" : "=q" (val), "=m" (*lock) : "0" (val) : "memory"*/
192 194
 	); 
193 195
 #elif defined(__CPU_sparc64) || defined(__CPU_sparc)
... ...
@@ -219,14 +221,15 @@ inline static void release_lock(fl_lock_t* lock)
219 221
 			: "r"(0), "b" (lock)
220 222
 			: "memory"
221 223
 	);
222
-	*lock = 0;
223 224
 #elif defined __CPU_mips2
224 225
 	asm volatile(
225 226
 		".set noreorder \n\t"
227
+#ifndef NOSMP
226 228
 		"    sync \n\t"
229
+#endif
227 230
 		"    sw $0, %0 \n\t"
228 231
 		".set reorder \n\t"
229
-		: /*no output*/  : "m" (*lock) : "memory"
232
+		: "=m" (*lock)  : /* no input */ : "memory"
230 233
 	);
231 234
 #elif defined __CPU_alpha
232 235
 	asm volatile(