mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 06:32:08 +00:00
[MIPS] Improve branch prediction in ll/sc atomic operations.
Now that finally all supported versions of binutils have functioning support for .subsection use .subsection to tweak the branch prediction I did not modify the R10000 errata variants because it seems unclear if this will invalidate the workaround which actually relies on the cheesy prediction of branch likely to cause a misspredict if the sc was successful. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
509cb37e17
commit
f65e4fa8e0
4 changed files with 128 additions and 33 deletions
|
@ -110,7 +110,10 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
|
|||
" move %2, %z4 \n"
|
||||
" .set mips3 \n"
|
||||
" sc %2, %1 \n"
|
||||
" beqz %2, 1b \n"
|
||||
" beqz %2, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (retval), "=m" (*m), "=&r" (dummy)
|
||||
: "R" (*m), "Jr" (val)
|
||||
|
@ -155,7 +158,10 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
|
|||
"1: lld %0, %3 # xchg_u64 \n"
|
||||
" move %2, %z4 \n"
|
||||
" scd %2, %1 \n"
|
||||
" beqz %2, 1b \n"
|
||||
" beqz %2, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (retval), "=m" (*m), "=&r" (dummy)
|
||||
: "R" (*m), "Jr" (val)
|
||||
|
@ -232,8 +238,11 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
|
|||
" move $1, %z4 \n"
|
||||
" .set mips3 \n"
|
||||
" sc $1, %1 \n"
|
||||
" beqz $1, 1b \n"
|
||||
" beqz $1, 3f \n"
|
||||
"2: \n"
|
||||
" .subsection 2 \n"
|
||||
"3: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set pop \n"
|
||||
: "=&r" (retval), "=R" (*m)
|
||||
: "R" (*m), "Jr" (old), "Jr" (new)
|
||||
|
@ -283,8 +292,11 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
|
|||
" bne %0, %z3, 2f \n"
|
||||
" move $1, %z4 \n"
|
||||
" scd $1, %1 \n"
|
||||
" beqz $1, 1b \n"
|
||||
" beqz $1, 3f \n"
|
||||
"2: \n"
|
||||
" .subsection 2 \n"
|
||||
"3: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set pop \n"
|
||||
: "=&r" (retval), "=R" (*m)
|
||||
: "R" (*m), "Jr" (old), "Jr" (new)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue