You copied the Doc URL to your clipboard.

Inline assembler register restrictions in C and C++ code

Registers such as r0-r3, sp, lr, and the NZCV flags in the CPSR must be used with caution. If C or C++ expressions are used, these might be used as temporary registers and NZCV flags might be corrupted by the compiler when evaluating the expression.

The pc, lr, and sp registers cannot be explicitly read or modified using inline assembly code because there is no direct access to any physical registers. However, the intrinsics __current_pc, __current_sp, and __return_address can be used to read these registers.