[PD-cvs] pd/src m_fifo.c,1.1.2.4,1.1.2.5
Tim Blechmann
timblech at users.sourceforge.net
Thu Dec 16 14:30:21 CET 2004
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30195
Modified Files:
Tag: devel_0_38
m_fifo.c
Log Message:
cas/cas2 for ppc
Index: m_fifo.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/m_fifo.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** m_fifo.c 15 Dec 2004 22:05:59 -0000 1.1.2.4
--- m_fifo.c 16 Dec 2004 13:30:19 -0000 1.1.2.5
***************
*** 91,107 ****
}
! #elif defined(__POWERPC__)
! /* gcc on ppc */ \
#define CAS(mem, old, new) \
({ __typeof__(old) tmp; \
int ret = 0; \
__asm__ __volatile__( \
- "1: \n" \
"lwarx %0,0,%2 \n" \
"cmpw %0,%3 \n" \
"bne 1f \n" \
! "stwcx %0,0,%4 \n" \
! "bne 1b \n" \
"li %1,1 \n" \
"1: \n" \
--- 91,107 ----
}
! #elif defined(__POWERPC__)
! /* gcc on ppc */
#define CAS(mem, old, new) \
({ __typeof__(old) tmp; \
int ret = 0; \
__asm__ __volatile__( \
"lwarx %0,0,%2 \n" \
"cmpw %0,%3 \n" \
"bne 1f \n" \
! "sync \n" \
! "stwcx %4,0,%2 \n" \
! "bne 1f \n" \
"li %1,1 \n" \
"1: \n" \
***************
*** 111,115 ****
})
! #error CAS2 hasn't been implemented for ppc, yet
#else
--- 111,138 ----
})
! /* tb: i'm nut sure, if the handling of the two stwcx instructions
! * works correctly and if it's atomic */
! #define CAS2(mem, old1, old2, new1, new2) \
! ({ int ret = 0; \
! __asm__ __volatile__( \
! "lwarx %0,0,%3 \n" \
! "cmpw %0,%5 \n" \
! "bne 1f \n" \
! "lwarx %1,0,%4 \n" \
! "cmpw %1,%6 \n" \
! "bne 1f \n" \
! "sync \n" \
! "stwcx %7,0,%3 \n" \
! "bne 1f \n" \
! "stwcx %8,0,%4 \n" \
! "bne 1f \n" \
! "li %2,1 \n" \
! "1: \n" \
! :"=&r"(tmp1), "=&r"(tmp2), "=r"(ret) : \
! "m" (*mem), "m"(*(mem+(sizeof(__typeof__(old1))), \
! "r" (old1), "r" (old2), \
! "r" (new1), "r"(new2), "0"(ret), ); \
! ret; \
! })
#else
More information about the Pd-cvs
mailing list