pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

Convert all assembly including inline to `.syntax unified`

Open kilograham opened this issue 3 years ago • 0 comments

The majority of our .S files use unified syntax, however very little inline assembler does.

This can lead to bugs, e.g. this

__force_inline static int32_t __mul_instruction(int32_t a, int32_t b) {
    asm ("mul %0, %1" : "+l" (a) : "l" (b) : );
    return a;
}

which is actually a muls instruction, and sets the flags, so the condition codes need to be added to the clobbers.

We can't/shouldn't change the default inline assembly syntax to unified since this is really the purview of the user. instead we should just explicitly set it on all inline assembly.

kilograham avatar Sep 23 '22 14:09 kilograham