+2001-10-05 Phil Edwards <pme@gcc.gnu.org>
+
+ * config/cpu/alpha/bits/atomicity.h (__compare_and_swap): Remove
+ unused function.
+ * config/cpu/arm/bits/atomicity.h: Likewise.
+ * config/cpu/generic/bits/atomicity.h: Likewise.
+ * config/cpu/i486/bits/atomicity.h: Likewise.
+ * config/cpu/ia64/bits/atomicity.h: Likewise.
+ * config/cpu/mips/bits/atomicity.h: Likewise.
+ * config/cpu/powerpc/bits/atomicity.h: Likewise.
+ * config/cpu/sparc/sparc32/bits/atomicity.h: Likewise.
+ * config/cpu/sparc/sparc64/bits/atomicity.h: Likewise.
+
2001-10-04 Phil Edwards <pme@gcc.gnu.org>
* docs/html/faq/index.html: Describe DR #22, and a workaround.
: "m" (*__mem), "r"(__val));
}
-static inline int
-__attribute__ ((__unused__))
-__compare_and_swap (volatile long *__p, long __oldval, long __newval)
-{
- int __ret;
-
- __asm__ __volatile__ (
- "\n$Lcas_%=:\n\t"
- "ldq_l %0,%4\n\t"
- "cmpeq %0,%2,%0\n\t"
- "beq %0,3f\n\t"
- "mov %3,%0\n\t"
- "stq_c %0,%1\n\t"
- "beq %0,$Lcas_%=\n\t"
- "mb"
- : "=&r"(__ret), "=m"(*__p)
- : "r"(__oldval), "r"(__newval), "m"(*__p));
-
- return __ret;
-}
-
#endif /* atomicity.h */
#endif
}
-static inline int
-__attribute__ ((__unused__))
-__compare_and_swap (volatile long *__p, long __oldval, long __newval)
-{
- int __result;
- long __tmp;
-#ifdef __thumb__
- /* Since this function is inlined, we can't be sure of the alignment. */
- __asm__ __volatile__ (
- "ldr %0, 4f \n\t"
- "bx %0 \n\t"
- ".align 0 \n"
- "4:\t"
- ".word 0f \n\t"
- ".code 32 \n"
- "0:\t"
- "ldr %1, [%2] \n\t"
- "mov %0, #0 \n\t"
- "cmp %1, %4 \n\t"
- "bne 1f \n\t"
- "swp %0, %3, [%2] \n\t"
- "cmp %1, %0 \n\t"
- "swpne %1, %0, [%2] \n\t"
- "bne 0b \n\t"
- "mov %0, #1 \n"
- "1:\t"
- "ldr %1, 2f \n\t"
- "bx %1 \n"
- "2:\t"
- ".word 3f \n\t"
- ".code 16\n"
- "3:\n"
- : "=&l"(__result), "=&r"(__tmp)
- : "r" (__p), "r" (__newval), "r" (__oldval)
- : "cc", "memory");
-#else
- __asm__ __volatile__ (
- "\n"
- "0:\t"
- "ldr %1, [%2] \n\t"
- "mov %0, #0 \n\t"
- "cmp %1, %4 \n\t"
- "bne 1f \n\t"
- "swp %0, %3, [%2] \n\t"
- "cmp %1, %0 \n\t"
- "swpne %1, %0, [%2] \n\t"
- "bne 0b \n\t"
- "mov %0, #1 \n"
- "1:\n\t"
- ""
- : "=&r"(__result), "=&r"(__tmp)
- : "r" (__p), "r" (__newval), "r" (__oldval)
- : "cc", "memory");
-#endif
- return __result;
-}
-
static inline long
__attribute__ ((__unused__))
__always_swap (volatile long *__p, long __newval)
*__mem += __val;
}
-static inline int
-__attribute__ ((__unused__))
-__compare_and_swap (long *__p, long __oldval, long __newval)
-{
- if (*__p != __oldval)
- return 0;
-
- *__p = __newval;
- return 1;
-}
-
#endif /* atomicity.h */
: : "ir" (__val), "m" (*__mem) : "memory");
}
-static inline char
-__attribute__ ((__unused__))
-__compare_and_swap (volatile long* __p, long __oldval, long __newval)
-{
- char __ret;
- long __readval;
-
- __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
- : "=q" (__ret), "=m" (*__p), "=a" (__readval)
- : "r" (__newval), "m" (*__p), "a" (__oldval));
- return __ret;
-}
-
#endif /* atomicity.h */
__sync_fetch_and_add (__mem, __val);
}
-static inline int
-__attribute__ ((__unused__))
-__compare_and_swap (volatile long *__p, long __oldval, long __newval)
-{
- return __sync_bool_compare_and_swap (__p, __oldval, __newval);
-}
-
#endif /* atomicity.h */
: "memory");
}
-static inline int
-__attribute__ ((unused))
-__compare_and_swap (volatile long int *__p, long int __oldval,
- long int __newval)
-{
- long int __ret;
-
- __asm__ __volatile__
- ("/* Inline compare & swap */\n\t"
- "1:\n\t"
- "ll %0,%4\n\t"
- ".set push\n"
- ".set noreorder\n\t"
- "bne %0,%2,2f\n\t"
- "move %0,%3\n\t"
- ".set pop\n\t"
- "sc %0,%1\n\t"
- "beqz %0,1b\n"
- "2:\n\t"
- "/* End compare & swap */"
- : "=&r" (__ret), "=m" (*__p)
- : "r" (__oldval), "r" (__newval), "m" (*__p)
- : "memory");
-
- return __ret;
-}
-
#endif /* atomicity.h */
: "cr0", "memory");
}
-static inline int
-__attribute__ ((__unused__))
-__compare_and_swap (volatile long *__p, long int __oldval, long int __newval)
-{
- int __res;
- __asm__ __volatile__ (
- "/* Inline compare & swap */\n"
- "0:\t"
- "lwarx %0,0,%1 \n\t"
- "sub%I2c. %0,%0,%2 \n\t"
- "cntlzw %0,%0 \n\t"
- "bne- 1f \n\t"
- "stwcx. %3,0,%1 \n\t"
- "bne- 0b \n"
- "1:\n\t"
- "/* End compare & swap */"
- : "=&b"(__res)
- : "r"(__p), "Ir"(__oldval), "r"(__newval)
- : "cr0", "memory");
- return __res >> 5;
-}
-
static inline long
__attribute__ ((__unused__))
__always_swap (volatile long *__p, long int __newval)
: "memory");
}
-static int
-__attribute__ ((__unused__))
-__compare_and_swap (volatile long *__p, long __oldval, long __newval)
-{
- static unsigned char __lock;
- long __ret, __tmp;
-
- __asm__ __volatile__("1: ldstub [%1], %0\n\t"
- " cmp %0, 0\n\t"
- " bne 1b\n\t"
- " nop"
- : "=&r" (__tmp)
- : "r" (&__lock)
- : "memory");
- if (*__p != __oldval)
- __ret = 0;
- else
- {
- *__p = __newval;
- __ret = 1;
- }
- __asm__ __volatile__("stb %%g0, [%0]"
- : /* no outputs */
- : "r" (&__lock)
- : "memory");
-
- return __ret;
-}
-
#endif /* atomicity.h */
: "memory");
}
-static inline int
-__attribute__ ((__unused__))
-__compare_and_swap (volatile long *__p, long __oldval, long __newval)
-{
- register int __tmp;
- register long __tmp2;
-
- __asm__ __volatile__("1: ldx [%4], %0\n\t"
- " mov %2, %1\n\t"
- " cmp %0, %3\n\t"
- " bne,a,pn %%xcc, 2f\n\t"
- " mov 0, %0\n\t"
- " casx [%4], %0, %1\n\t"
- " sub %0, %1, %0\n\t"
- " brnz,pn %0, 1b\n\t"
- " mov 1, %0\n\t"
- "2:"
- : "=&r" (__tmp), "=&r" (__tmp2)
- : "r" (__newval), "r" (__oldval), "r" (__p)
- : "memory");
- return __tmp;
-}
-
#endif /* atomicity.h */