> > +#define mfdcrx(rn) \
> > +   ({      \
> > +           unsigned long rval; \
> > +           asm volatile("mfdcrx %0,%1" : "=r"(rval) : "g"(rn)); \
> > +           rval; \
> > +   })
> 
> "g" is never correct on PowerPC, you want "r" here.  You can write
> this as a static inline btw, you only need the #define stuff when
> there is an "i" constraint involved.

I think you can still use static inlines even when a
constraint is one that requires a compile time constant.
eg (not ppc, but the "n" become part of the instruction
word):

static __inline__ uint32_t
custom_inic(const uint32_t op, uint32_t a, const uint32_t b)
{
    uint32_t result;

    __asm__ ( "custom\t%1, %0, %2, c%3"
        : "=r" (result) : "n" (op), "r" (a), "n" (b));
    return result;
}

        David


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to