I am trying to write part of my code in inline assembly, but I have not figured out how to get a component of the code to work. (This is for the Due if it makes a difference).
In my original C code that I am trying to convert to assembly, I had the following code:
I have tried doing it without the pointer as well, but that results in a similar issue and the value stored in the register is not what I want.
Also, I use the pointer because at least for the C code, it saved me 1-2 lookups per call and I need as much speed as possible for the project I'm currently working on.
Thanks for posting the link to the tutorial on getting the assembly dump. I have tried that, and the code looks to be the same, but it is not working when written inline.
This should work, except you omitted, in the clobbers list, to say that r1 is killed after the instruction.
This may lead the remaining code generated by gcc to crash. If the compiler does not know what registers an instruction kills, it won't guess.
Remember that gcc does not read at all the instruction! Hence, for it, maybe be before your instruction it does something with r1 or may after your instruction it relies on a value (propagated) stored in r1 from the calling routine... and you, you kill r1.
Your instruction should look like: