Hi, I note that the Thumb quick reference states that LSLS,LSLR & ASR can shift by a 5-bit field within the register OR by bits 0-7 of a second register. Now forgive my ignorance, but if 31 is the maximum shift value, bits 0-4 would be appropriate. Has anyone else tried placing values >31 into the register holding the shift value as it does appear to return odd values.I'm not sure what is going on but if I find something unexpected, I try to find a way to use it.I discovered it by placing 6 x 5-bit shift values into a single register, shifting right the shift value by 5 bits to select the next shift value. I have a subroutine that needs a lot of shifts and using this trick allows me to pass 2 variables, not 7.
Again, you put your finger on some interesting points.On a CM7, lsls r0,r0,r1 or lsls r0,r1 with r0 = 1 and r1 = 0x40 => 0So you may only store 4 shifts.
View all questions in Cortex-M / M-Profile forum