You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.
The current implementation of neo430_bswap seems to be buggy. In my case, the compiler selected a totally unrelated register to call swpb on (not the one containing a), which obviously caused the rest of the program to fail.
I'm also confused why swpb is called with two operands, since the instruction seems to have only one...
Note, that I also dropped the volatile qualifier because the ASM code is "pure" (i.e. the outputs depend only on inputs). I would also recommend to move the function to the header and mark it as inline.
The text was updated successfully, but these errors were encountered:
The current implementation of neo430_bswap seems to be buggy. In my case, the compiler selected a totally unrelated register to call swpb on (not the one containing a), which obviously caused the rest of the program to fail.
Lately, I have been playing a lot with inline assembly / intrinsics and maybe asm ("some instruction with some registers"): seems to be bad practice in some cases as it leaves too much freedom to the compiler to "optimize" in the wrong direction ("constant propagation" seems to be a certain issue). I am experimenting with a more sophisticated approach (-> example). I think this might be a cleaner (still hacky, somehow) and clearer way - or maybe not. I am still trying to figure it out.
I'm also confused why swpb is called with two operands, since the instruction seems to have only one...
Good point. I cannot remember why I have used two operands...
This code seems to work: ...
Note, that I also dropped the volatile qualifier because the ASM code is "pure" (i.e. the outputs depend only on inputs). I would also recommend to move the function to the header and mark it as inline.
Thanks for the modification. I will check it out.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The current implementation of
neo430_bswap
seems to be buggy. In my case, the compiler selected a totally unrelated register to callswpb
on (not the one containinga
), which obviously caused the rest of the program to fail.I'm also confused why
swpb
is called with two operands, since the instruction seems to have only one...This code seems to work:
Note, that I also dropped the
volatile
qualifier because the ASM code is "pure" (i.e. the outputs depend only on inputs). I would also recommend to move the function to the header and mark it asinline
.The text was updated successfully, but these errors were encountered: