loop through register

Hi to all,
how can I loop through each rgister from r0 to r7?
I have some data in the registers r0:r7 and i want to compare them with a constant; i need to put 8 line of sub and cmp or is there any solution with branches in order make the solution more clever like a "branch for registers".
I googled but the only i can find is how to manage this king of loop when i have data in memory and not in registers.

The pseudocode i want to achive is the one below

for 0 to 7
  cmp r(i), #3

Any suggestion?
Thanks for any advice

No Data
  • Put 8 lines of sub and cmp is probably the most efficient way.
    if efficiency is not at the first place and you like some way looks less verbose you can refer the following code.

    stmdb r10!,{r0-r7} ;batch store r0-r7
    mov    r11, #8    ;counter
    ldrb r12,[r10],#4
    cmp r12, #3
    SUBS r11, r11, #1 ; Decrement the counter
    BNE loopcmp
No Data