-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Milestone
Description
When trying to compile a program using LLVM (clang) for the RISC-V mode of RP2350, an error is thrown at /src/rp2350/pico_platform/include/pico/platform.h:249:31:
error: invalid output constraint '+l' in asm
247 | __force_inline static int32_t __mul_instruction(int32_t a, int32_t b) {
248 | #ifdef __riscv
249 | __asm ("mul %0, %0, %1" : "+l" (a) : "l" (b) : );
| `- error: invalid output constraint '+l' in asm
250 | #else
251 | pico_default_asm ("muls %0, %1" : "+l" (a) : "l" (b) : "cc");Looking at GCC's machine constraints for RISC-V, there isn't any l constraint specific to RISC-V, and there's no general l constraint. This also goes for LLVM.
This leads me to believe this was a mistake, since l is valid on ARM and was previously used for the ARM compilation mode. I'm not sure why / how this compilation succeeds on GCC, even though l is an invalid constraint for RISC-V.
One option is to replace the l constraint for RISC-V with r like this:
247 | __force_inline static int32_t __mul_instruction(int32_t a, int32_t b) {
248 | #ifdef __riscv
249 | __asm ("mul %0, %0, %1" : "+r" (a) : "r" (b) : );
250 | #else
251 | pico_default_asm ("muls %0, %1" : "+l" (a) : "l" (b) : "cc");Metadata
Metadata
Assignees
Labels
No labels