ESP32 S3 PIE inline assembly

supor88
Posts: 1
Joined: Sun Apr 13, 2025 1:09 am

ESP32 S3 PIE inline assembly

Postby supor88 » Sun Apr 13, 2025 1:15 am

I am using ESP IDF in VS Code. How can I get the compiler to recognize the extended instruction set for inline assembly. Regular assembly instructions it can compile, but not the extended instruction set. I also have no problem with compiling assembly code in .S files, but I do not want to call those functions, since they create some overhead.

#define LOAD16_STORE128_MACRO(dest, source) \
__asm__ __volatile__( \
"EE.VLDBC.16 q0, %1 \n" \
"ST.QR q0, %0, 0 \n" \
: /* No outputs */ \
: "r" (dest), "r" (source) \
: "q0" \
)

If I could get this to compile, I would be quite happy.
Is there a compiler flag I need to set, some other compiler I need to use, something I need to configure in the esp idf? Any help would be appreciated, thanks!

Here is also the compiler error I get:
error: unknown register name 'q0' in 'asm'

MicroController
Posts: 2705
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: ESP32 S3 PIE inline assembly

Postby MicroController » Sun Apr 13, 2025 3:57 pm

The compiler does not know about the PIE registers (q registers, ACCX, QACC, ...). For that reason, you cannot declare any of those registers as input, output, or clobbers of the inline assembly.

Note that this also implies that the compiler will do nothing to preserve any PIE register's contents e.g. across a function call.

Btw, I suggest to use proper (static) C-functions instead of macros to encapsulate inline asm snippets. gcc will inline them unless you compile for debugging (-Og).

Who is online

Users browsing this forum: No registered users and 1 guest