scummvm random work
[patches.git] / bfin-pthreads-gcc-constraints.patch
1 Index: uClibc/libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h
2 ===================================================================
3 --- uClibc/libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h (revision 1807)
4 +++ uClibc/libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h (working copy)
5 @@ -22,7 +22,7 @@
6 #define _PT_MACHINE_H 1
7
8 #ifndef PT_EI
9 -# define PT_EI extern inline
10 +# define PT_EI extern inline __attribute__((always_inline))
11 #endif
12
13 extern long int testandset (int *spinlock);
14 @@ -41,11 +41,11 @@ testandset (int *spinlock)
15 {
16 long int res;
17
18 - asm volatile ("R1 = 1; P0 = %2; CALL (%4); %0 = R0;"
19 - : "=d" (res), "=m" (*spinlock)
20 - : "da" (spinlock), "m" (*spinlock),
21 - "a" (ATOMIC_XCHG32)
22 - :"R0", "R1", "P0", "RETS", "cc", "memory");
23 + __asm__ __volatile__ (
24 + "CALL (%4);"
25 + : "=q0" (res), "=m" (*spinlock)
26 + : "qA" (spinlock), "m" (*spinlock), "a" (ATOMIC_XCHG32), "q1" (1)
27 + : "RETS", "cc", "memory");
28
29 return res;
30 }
31 @@ -55,18 +55,15 @@ PT_EI int
32 __compare_and_swap (long int *p, long int oldval, long int newval)
33 {
34 long int readval;
35 - asm volatile ("P0 = %2;\n\t"
36 - "R1 = %3;\n\t"
37 - "R2 = %4;\n\t"
38 - "CALL (%5);\n\t"
39 - "%0 = R0;\n\t"
40 - : "=da" (readval), "=m" (*p)
41 - : "da" (p),
42 - "da" (oldval),
43 - "da" (newval),
44 + __asm__ __volatile__ (
45 + "CALL (%5);"
46 + : "=q0" (readval), "=m" (*p)
47 + : "qA" (p),
48 + "q1" (oldval),
49 + "q2" (newval),
50 "a" (ATOMIC_CAS32),
51 "m" (*p)
52 - : "P0", "R0", "R1", "R2", "RETS", "memory", "cc");
53 + : "RETS", "memory", "cc");
54 return readval == oldval;
55 }
56