All pastes #519088 Raw Edit

Someone

public text v1 · immutable
#519088 ·published 2007-05-29 15:13 UTC
rendered paste body
  /* FIXME: We should get gcc to allocate one of the condition  */
  /* registers.  I always got "impossible constraint" when I    */
  /* tried the "y" constraint.                                  */

/* you cannot assign a condition register to any C variable,
   you can use the "x" and "y" constrints internally to GCC only.  */

  __asm__ __volatile__ (
    "lwz%U1%X1 %0,%1\n"
    "cmpw cr7,%0,%0\n"
    "bne- cr7,1f\n"
    "1: isync\n"
    : "=r" (result)
    : "m"(*addr) : "memory", "cc"); //  i don't think you need the "memory" clobber here
                                         // maybe you want it to prevent reordering but it's not good
                                    // enough for that
  return result;