STM r0!, {}
I have looked at Thumb2 instruction set web but I can't find the behaviour of STM command if the reglist is empty.
Thanks in advance.
Hi hector.bravo,
it is not valid and any compiler probably cannot deal with the instruction. As Mr. daith says, STMDB/LDMDB register list requires more than one register. However, a compiler can deal with the register list which has one register. In the case, STM would be replaced with STR.
stmdb r0!,{r1} => str.w r1, [r0, #-4]!
I guess some disassembler might show "stm r0!,{}" for the code "0xc000".
Best regards,Yasuhiko Koumoto.
Just noticed you are talking about the M0 which has the ARMv6-M instruction set not ARMv7-M. It excludes most of the 32 bit Thumb-2 instructions including the T2 form of LDMIA.
Looking at the spec it says for encoding T2
if n == 15 || BitCount(registers) < 2 then UNPREDICTABLE;
So the effect if you have even only one register in the list never mind zero is not defined. I must admit to be a bit surprised when I saw this, for ARM it is undefined only for zero registers, same for encoding T1.
View all questions in Cortex-M / M-Profile forum