atomic functions in asmpart.S because of MIPSPro compiler
authorstefan <none@none>
Fri, 11 Jun 2004 16:28:13 +0000 (16:28 +0000)
committerstefan <none@none>
Fri, 11 Jun 2004 16:28:13 +0000 (16:28 +0000)
jit/mips/asmpart.S
jit/mips/machine-instr.h
src/vm/jit/mips/asmpart.S
src/vm/jit/mips/machine-instr.h

index eec016959da909f26e2f240f152a743821c927c2..48cbbaa4e9bbd52f2bd1cab921a93ae05caa7f7a 100644 (file)
@@ -27,7 +27,7 @@
 
    Authors: Andreas Krall
 
-   $Id: asmpart.S 1119 2004-06-02 11:12:03Z twisti $
+   $Id: asmpart.S 1160 2004-06-11 16:28:13Z stefan $
 
 */
 
        .globl asm_getclassvalues_atomic
        .globl asm_criticalsections
 
+       .globl atomic_swap
+       .globl compare_and_swap
+
 
 /*************************** imported functions *******************************/
 
@@ -1313,6 +1316,28 @@ asm_criticalsections:
     .quad   0
 
 
+       .ent    atomic_swap
+atomic_swap:
+1:
+       lld             v0,0(a0)
+       move    t0,a1
+       scd             t0,0(a0)
+       beqz    t0,1b
+       j               ra
+       .end    atomic_swap
+
+       .ent    compare_and_swap
+compare_and_swap:
+       move    v0,zero
+1:
+       lld             t0,0(a0)
+       bne             t0,a1,2f
+       move    v0,a2
+       scd             v0,0(a0)
+       beqz    v0,1b
+2:
+       j               ra
+       .end    compare_and_swap
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where
index f0ed4561c1db2f84c901db942f0a27bc9b50280b..383d406d01cca4d9ce85110c4135588e8fd0b856 100644 (file)
@@ -1,10 +1,12 @@
-/* If anyone wants to compile with gcc, use this file.
- * It is not usable with the MIPSPro compiler.
- */ 
-
 #ifndef _MACHINE_INSTR_H
 #define _MACHINE_INSTR_H
 
+#if 0
+
+/* If anyone wants to compile with gcc, use this section.
+ * It is not usable with the MIPSPro compiler.
+ */ 
+
 static inline long
 __attribute__ ((unused))
 atomic_swap (volatile long *p, long val)
@@ -28,9 +30,9 @@ atomic_swap (volatile long *p, long val)
 }
 static inline int
 __attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
+compare_and_swap (volatile long *p, long oldval, long newval)
 {
-  long int ret, temp;
+  long ret, temp;
 
   __asm__ __volatile__
     ("1:\n\t"
@@ -51,4 +53,10 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval)
   return ret;
 }
 
+#else
+
+long atomic_swap (long *, long val);
+int compare_and_swap (long *p, long oldval, long newval);
+
+#endif
 #endif
index eec016959da909f26e2f240f152a743821c927c2..48cbbaa4e9bbd52f2bd1cab921a93ae05caa7f7a 100644 (file)
@@ -27,7 +27,7 @@
 
    Authors: Andreas Krall
 
-   $Id: asmpart.S 1119 2004-06-02 11:12:03Z twisti $
+   $Id: asmpart.S 1160 2004-06-11 16:28:13Z stefan $
 
 */
 
        .globl asm_getclassvalues_atomic
        .globl asm_criticalsections
 
+       .globl atomic_swap
+       .globl compare_and_swap
+
 
 /*************************** imported functions *******************************/
 
@@ -1313,6 +1316,28 @@ asm_criticalsections:
     .quad   0
 
 
+       .ent    atomic_swap
+atomic_swap:
+1:
+       lld             v0,0(a0)
+       move    t0,a1
+       scd             t0,0(a0)
+       beqz    t0,1b
+       j               ra
+       .end    atomic_swap
+
+       .ent    compare_and_swap
+compare_and_swap:
+       move    v0,zero
+1:
+       lld             t0,0(a0)
+       bne             t0,a1,2f
+       move    v0,a2
+       scd             v0,0(a0)
+       beqz    v0,1b
+2:
+       j               ra
+       .end    compare_and_swap
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where
index f0ed4561c1db2f84c901db942f0a27bc9b50280b..383d406d01cca4d9ce85110c4135588e8fd0b856 100644 (file)
@@ -1,10 +1,12 @@
-/* If anyone wants to compile with gcc, use this file.
- * It is not usable with the MIPSPro compiler.
- */ 
-
 #ifndef _MACHINE_INSTR_H
 #define _MACHINE_INSTR_H
 
+#if 0
+
+/* If anyone wants to compile with gcc, use this section.
+ * It is not usable with the MIPSPro compiler.
+ */ 
+
 static inline long
 __attribute__ ((unused))
 atomic_swap (volatile long *p, long val)
@@ -28,9 +30,9 @@ atomic_swap (volatile long *p, long val)
 }
 static inline int
 __attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
+compare_and_swap (volatile long *p, long oldval, long newval)
 {
-  long int ret, temp;
+  long ret, temp;
 
   __asm__ __volatile__
     ("1:\n\t"
@@ -51,4 +53,10 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval)
   return ret;
 }
 
+#else
+
+long atomic_swap (long *, long val);
+int compare_and_swap (long *p, long oldval, long newval);
+
+#endif
 #endif