8
8
#include <asm/asm.h>
9
9
#include <asm/cmpxchg.h>
10
10
#include <asm/compiler.h>
11
- #include <asm/war .h>
11
+ #include <asm/asm .h>
12
12
13
13
typedef struct
14
14
{
@@ -32,34 +32,18 @@ static __inline__ long local_add_return(long i, local_t * l)
32
32
{
33
33
unsigned long result ;
34
34
35
- if (kernel_uses_llsc && IS_ENABLED (CONFIG_WAR_R10000_LLSC )) {
36
- unsigned long temp ;
37
-
38
- __asm__ __volatile__(
39
- " .set push \n"
40
- " .set arch=r4000 \n"
41
- __SYNC (full , loongson3_war ) " \n"
42
- "1:" __LL "%1, %2 # local_add_return \n"
43
- __stringify (LONG_ADDU ) " %0, %1, %3 \n"
44
- __SC "%0, %2 \n"
45
- " beqzl %0, 1b \n"
46
- " addu %0, %1, %3 \n"
47
- " .set pop \n"
48
- : "=&r" (result ), "=&r" (temp ), "=m" (l -> a .counter )
49
- : "Ir" (i ), "m" (l -> a .counter )
50
- : "memory" );
51
- } else if (kernel_uses_llsc ) {
35
+ if (kernel_uses_llsc ) {
52
36
unsigned long temp ;
53
37
54
38
__asm__ __volatile__(
55
39
" .set push \n"
56
40
" .set " MIPS_ISA_ARCH_LEVEL " \n"
57
- __SYNC (full , loongson3_war ) " \n"
58
- "1:" __LL "%1, %2 # local_add_return \n"
41
+ __SYNC (full , loongson3_war ) " \n"
42
+ "1:" __stringify (LONG_LL ) " %1, %2 \n"
43
+ __stringify (LONG_ADDU ) " %0, %1, %3 \n"
44
+ __stringify (LONG_SC ) " %0, %2 \n"
45
+ __stringify (SC_BEQZ ) " %0, 1b \n"
59
46
__stringify (LONG_ADDU ) " %0, %1, %3 \n"
60
- __SC "%0, %2 \n"
61
- " beqz %0, 1b \n"
62
- " addu %0, %1, %3 \n"
63
47
" .set pop \n"
64
48
: "=&r" (result ), "=&r" (temp ), "=m" (l -> a .counter )
65
49
: "Ir" (i ), "m" (l -> a .counter )
@@ -81,34 +65,19 @@ static __inline__ long local_sub_return(long i, local_t * l)
81
65
{
82
66
unsigned long result ;
83
67
84
- if (kernel_uses_llsc && IS_ENABLED (CONFIG_WAR_R10000_LLSC )) {
85
- unsigned long temp ;
86
-
87
- __asm__ __volatile__(
88
- " .set push \n"
89
- " .set arch=r4000 \n"
90
- __SYNC (full , loongson3_war ) " \n"
91
- "1:" __LL "%1, %2 # local_sub_return \n"
92
- __stringify (LONG_SUBU ) " %0, %1, %3 \n"
93
- __SC "%0, %2 \n"
94
- " beqzl %0, 1b \n"
95
- " subu %0, %1, %3 \n"
96
- " .set pop \n"
97
- : "=&r" (result ), "=&r" (temp ), "=m" (l -> a .counter )
98
- : "Ir" (i ), "m" (l -> a .counter )
99
- : "memory" );
100
- } else if (kernel_uses_llsc ) {
68
+ if (kernel_uses_llsc ) {
101
69
unsigned long temp ;
102
70
103
71
__asm__ __volatile__(
104
72
" .set push \n"
105
73
" .set " MIPS_ISA_ARCH_LEVEL " \n"
106
- __SYNC (full , loongson3_war ) " \n"
107
- "1:" __LL "%1, %2 # local_sub_return \n"
74
+ __SYNC (full , loongson3_war ) " \n"
75
+ "1:" __stringify (LONG_LL ) " %1, %2 \n"
76
+ __stringify (LONG_SUBU ) " %0, %1, %3 \n"
77
+ __stringify (LONG_SUBU ) " %0, %1, %3 \n"
78
+ __stringify (LONG_SC ) " %0, %2 \n"
79
+ __stringify (SC_BEQZ ) " %0, 1b \n"
108
80
__stringify (LONG_SUBU ) " %0, %1, %3 \n"
109
- __SC "%0, %2 \n"
110
- " beqz %0, 1b \n"
111
- " subu %0, %1, %3 \n"
112
81
" .set pop \n"
113
82
: "=&r" (result ), "=&r" (temp ), "=m" (l -> a .counter )
114
83
: "Ir" (i ), "m" (l -> a .counter )
0 commit comments