On 2020-06-08, Christian Weisgerber <[email protected]> wrote:

> More archs to come...

Style question:
Since this mostly comes down to embedding a single special instruction
in between normal C operations, I wonder whether I should just do .c
with asm() instead of .S, and leave all the boilerplate to the
compiler?  It would save me from reading up on calling conventions,
more assembly syntax, etc.

E.g.:

int ffs(int x)
{
        x = x & -x;
        __asm volatile("clz %0, %0" : "=r" (x));
        return (32 - x);
}

-- 
Christian "naddy" Weisgerber                          [email protected]

Reply via email to