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 78
 	asm volatile(
79 79
 		" btsl $0, %1 \n\t"
80 80
 		" adcl $0, %0 \n\t"
81
-		: "=q" (val), "=m" (*lock) : "0"(val) : "memory", "cc" /* "cc" */
81
+		: "=q" (val), "=m" (*lock) : "0"(val) : "memory", "cc"
82 82
 	);
83 83
 #else
84 84
 	val=1;
... ...
@@ -121,7 +123,6 @@ inline static int tsl(fl_lock_t* lock)
121 121
         );
122 122
 #elif defined __CPU_mips2
123 123
 	long tmp;
124
-	tmp=1; /* just to kill a gcc 2.95 warning */
125 124
 	
126 125
 	asm volatile(
127 126
 		".set noreorder\n\t"
... ...
@@ -130,10 +131,13 @@ inline static int tsl(fl_lock_t* lock)
130 130
 		"    sc %0, %2  \n\t"
131 131
 		"    beqz %0, 1b \n\t"
132 132
 		"    nop \n\t"
133
+#ifndef NOSMP
134
+		"    sync \n\t"
135
+#endif
133 136
 		".set reorder\n\t"
134 137
 		: "=&r" (tmp), "=&r" (val), "=m" (*lock) 
135
-		: "0" (tmp), "2" (*lock) 
136
-		: "cc"
138
+		: "m" (*lock) 
139
+		: "memory"
137 140
 	);
138 141
 #elif defined __CPU_alpha
139 142
 	long tmp;
... ...
@@ -184,10 +188,8 @@ inline static void get_lock(fl_lock_t* lock)
184 184
 inline static void release_lock(fl_lock_t* lock)
185 185
 {
186 186
 #if defined(__CPU_i386) || defined(__CPU_x86_64)
187
-	char val;
188
-	val=0;
189 187
 	asm volatile(
190
-		" movb $0, (%0)" : /*no output*/ : "r"(lock): "memory"
188
+		" movb $0, %0" : "=m"(*lock) : : "memory"
191 189
 		/*" xchg %b0, %1" : "=q" (val), "=m" (*lock) : "0" (val) : "memory"*/
192 190
 	); 
193 191
 #elif defined(__CPU_sparc64) || defined(__CPU_sparc)
... ...
@@ -219,14 +221,15 @@ inline static void release_lock(fl_lock_t* lock)
219 219
 			: "r"(0), "b" (lock)
220 220
 			: "memory"
221 221
 	);
222
-	*lock = 0;
223 222
 #elif defined __CPU_mips2
224 223
 	asm volatile(
225 224
 		".set noreorder \n\t"
225
+#ifndef NOSMP
226 226
 		"    sync \n\t"
227
+#endif
227 228
 		"    sw $0, %0 \n\t"
228 229
 		".set reorder \n\t"
229
-		: /*no output*/  : "m" (*lock) : "memory"
230
+		: "=m" (*lock)  : /* no input */ : "memory"
230 231
 	);
231 232
 #elif defined __CPU_alpha
232 233
 	asm volatile(