mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
1. Learn sparc asm 2. Realize the level of bogosity of the existing asm 3. Fix it 4. Profit!
Original commit message from CVS: 1. Learn sparc asm 2. Realize the level of bogosity of the existing asm 3. Fix it 4. Profit!
This commit is contained in:
parent
3770896368
commit
e3ce6294e6
1 changed files with 22 additions and 18 deletions
|
@ -249,32 +249,34 @@ GST_INLINE_FUNC void
|
|||
gst_atomic_int_add (GstAtomicInt *aint, gint val)
|
||||
{
|
||||
volatile int increment, *ptr;
|
||||
char lock;
|
||||
int lock = 1;
|
||||
int ignore = 0;
|
||||
|
||||
ptr = &(aint->counter);
|
||||
|
||||
#if __GNUC__ > 3 || (__GNUC__ >=3 && __GNUC_MINOR__ >= 2)
|
||||
__asm__ __volatile__("1: ldstub [%[ptr] + 3], %[lock]\n"
|
||||
"\torcc %[lock], 0, %%g0\n"
|
||||
"\torcc %[lock], 0, %[ignore]\n"
|
||||
"\tbne 1b\n" /* go back until we have the lock */
|
||||
"\tld [%[ptr]], %[inc]\n"
|
||||
"\tsra %[inc], 8, %[inc]\n"
|
||||
"\tadd %[inc], %[val], %[inc]\n"
|
||||
"\tsll %[inc], 8, %[lock]\n"
|
||||
"\tst %[lock],[%[ptr]]\n" /* Release the lock */
|
||||
: [inc] "=&r" (increment), [lock] "=r" (lock)
|
||||
: [inc] "=&r" (increment), [lock] "=r" (lock),
|
||||
[ignore] "=&r" (ignore)
|
||||
: "0" (increment), [ptr] "r" (ptr), [val] "r" (val)
|
||||
);
|
||||
#else
|
||||
__asm__ __volatile__("1: ldstub [%3 + 3], %1\n"
|
||||
"\torcc %1, 0, %%g0\n"
|
||||
__asm__ __volatile__("1: ldstub [%4 + 3], %1\n"
|
||||
"\torcc %1, 0, %2\n"
|
||||
"\tbne 1b\n" /* go back until we have the lock */
|
||||
"\tld [%3], %0\n"
|
||||
"\tld [%4], %0\n"
|
||||
"\tsra %0, 8, %0\n"
|
||||
"\tadd %0, %4, %0\n"
|
||||
"\tadd %0, %5, %0\n"
|
||||
"\tsll %0, 8, %1\n"
|
||||
"\tst %1,[%3]\n" /* Release the lock */
|
||||
: "=&r" (increment), "=r" (lock)
|
||||
"\tst %1,[%4]\n" /* Release the lock */
|
||||
: "=&r" (increment), "=r" (lock), "=&r" (ignore)
|
||||
: "0" (increment), "r" (ptr), "r" (val)
|
||||
);
|
||||
#endif
|
||||
|
@ -290,32 +292,34 @@ GST_INLINE_FUNC gboolean
|
|||
gst_atomic_int_dec_and_test (GstAtomicInt *aint)
|
||||
{
|
||||
volatile int increment, *ptr;
|
||||
char lock;
|
||||
int lock = 1;
|
||||
int ignore = 0;
|
||||
|
||||
ptr = &aint->counter;
|
||||
|
||||
#if __GNUC__ > 3 || (__GNUC__ >=3 && __GNUC_MINOR__ >= 2)
|
||||
#if 0 __GNUC__ > 3 || (__GNUC__ >=3 && __GNUC_MINOR__ >= 2)
|
||||
__asm__ __volatile__("1: ldstub [%[ptr] + 3], %[lock]\n"
|
||||
"\torcc %[lock], 0, %%g0\n"
|
||||
"\torcc %[lock], 0, %[ignore]\n"
|
||||
"\tbne 1b\n" /* go back until we have the lock */
|
||||
"\tld [%[ptr]], %[inc]\n"
|
||||
"\tsra %[inc], 8, %[inc]\n"
|
||||
"\tsub %[inc], 1, %[inc]\n"
|
||||
"\tsll %[inc], 8, %[lock]\n"
|
||||
"\tst %[lock],[%[ptr]]\n" /* Release the lock */
|
||||
: [inc] "=&r" (increment), [lock] "=r" (lock)
|
||||
: [inc] "=&r" (increment), [lock] "=r" (lock),
|
||||
[ignore] "=&r" (ignore)
|
||||
: "0" (increment), [ptr] "r" (ptr)
|
||||
);
|
||||
#else
|
||||
__asm__ __volatile__("1: ldstub [%3 + 3], %1\n"
|
||||
"\torcc %1, 0, %%g0\n"
|
||||
__asm__ __volatile__("1: ldstub [%4 + 3], %1\n"
|
||||
"\torcc %1, 0, %2\n"
|
||||
"\tbne 1b\n" /* go back until we have the lock */
|
||||
"\tld [%3], %0\n"
|
||||
"\tld [%4], %0\n"
|
||||
"\tsra %0, 8, %0\n"
|
||||
"\tsub %0, 1, %0\n"
|
||||
"\tsll %0, 8, %1\n"
|
||||
"\tst %1,[%3]\n" /* Release the lock */
|
||||
: "=&r" (increment), "=r" (lock)
|
||||
"\tst %1,[%4]\n" /* Release the lock */
|
||||
: "=&r" (increment), "=r" (lock), "=&r" (ignore)
|
||||
: "0" (increment), "r" (ptr)
|
||||
);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue