Fix mysterious unremovable file part 2 ?
[cacao.git] / src / vm / jit / mips / machine-instr.h
1 #ifndef _MACHINE_INSTR_H
2 #define _MACHINE_INSTR_H
3
4 #if 0
5
6 /* If anyone wants to compile with gcc, use this section.
7  * It is not usable with the MIPSPro compiler.
8  *
9  * It is outdated, too.
10  */ 
11
12 static inline int
13 __attribute__ ((unused))
14 compare_and_swap (volatile long *p, long oldval, long newval)
15 {
16   long ret, temp;
17
18   __asm__ __volatile__
19     ("1:\n\t"
20      ".set  push\n\t"
21      ".set  mips2\n\t"
22      "lld   %1,%5\n\t"
23      "move  %0,$0\n\t"
24      "bne   %1,%3,2f\n\t"
25      "move  %0,%4\n\t"
26      "scd   %0,%2\n\t"
27      ".set  pop\n\t"
28      "beqz  %0,1b\n"
29      "2:\n\t"
30      : "=&r" (ret), "=&r" (temp), "=m" (*p)
31      : "r" (oldval), "r" (newval), "m" (*p)
32      : "memory");
33
34   return ret;
35 }
36
37 #else
38
39 long compare_and_swap (long *p, long oldval, long newval);
40
41 #define STORE_ORDER_BARRIER()
42 #define MEMORY_BARRIER_AFTER_ATOMIC()
43 #define MEMORY_BARRIER()
44
45 #endif
46 #endif