Shift instructions such LSR, ASR, etc.
David Williams (2619) 103 posts |
I’ve been using Matt Godbolt’s wonderful Compiler Explorer (godbolt.org) with ARM GCC 8.2 to compile short C programs/routines, and copying & pasting the (instantly updating!) assembler code into either the appropriate BBCSDL* IDE, or a !Zap BASIC window in RISC OS. It’s good fun, and it beats writing reams of assembly language (life’s too short, etc.). However, the compiler (or perhaps a separate, custom disassembler?) likes to generate shift instructions such as LSR, LSRS, ASR, ASRS, etc. which I’m sure is nice, but neither BBCSDL nor (AFAIK) ARM BASIC V’s assembler supports these instructions, which are just synonyms for MOV[S] Rd,Rn, Perhaps I’ve missed something obvious. I know it only takes a few seconds to replace a shift instruction with its MOV equivalent, but I’m just trying to save myself some time. |
Jeffrey Lee (213) 6048 posts |
Are you specifying -marm to force ARM output? (i.e not Thumb). I found I ran into problems if I didn’t do that. If that doesn’t work, it may be that newer versions of GCC have embraced UAL syntax too much and are incapable of producing the original mnemonics. |
nemo (145) 2552 posts |
Yeah, sounds like Thumb. Mind you, this has got me thinking about Basic Assembler Dialects again, which could easily deal with this kind of thing. |
Jeffrey Lee (213) 6048 posts |
Nope – it’s UAL. There’s no obvious mention of it in the release notes, but GCC seems to have embraced UAL syntax/mnemonics for assembly output starting around GCC 6. |
nemo (145) 2552 posts |
Naturally. add r10, r0, lr, lsl #2 lsl fp, r3, #2 sighs |