I'm using STM32cubeIDE and debugging assembly on a cortex m4. I meet a strange behaviour when trying the instruction SUB. according to documentation,the SUB instruction shouldn't change the XPSR register. But when i use it, it does. Even for a no Carry operation like (9-7) it sets the XPSR carry flag to 1. Does any one understands this behaviour ?
Thx
I googled and read documentation but have no clue about this behaviour
Seems like the thumb16 instructions modify the flags but 32bits instruction when using .syntax unified behave normally (SUB doesn't change the flags while SUBS do). For the carry, the documentation is incomplete. The carry flag is inverted for the subs instruction. more detail on Confusion about ARM documentation on carry flag