I know in arm assembly we can use shifter operands like bellow:
mov r0, r1, lsl #2
I use gcc to compile, therefore I have to adapt syntax.
I already tried this:
mov w0, w1, lsl 2
It didn't work: unexpected characters following instruction at operand 2
. To me it says it can't handle the third operand.
Is there any alternative syntax that does the same job in gnu?
I know in arm assembly we can use shifter operands like bellow:
mov r0, r1, lsl #2
I use gcc to compile, therefore I have to adapt syntax.
I already tried this:
mov w0, w1, lsl 2
It didn't work: unexpected characters following instruction at operand 2
. To me it says it can't handle the third operand.
Is there any alternative syntax that does the same job in gnu?
Share Improve this question asked Nov 19, 2024 at 16:39 imahmadrezasimahmadrezas 33 bronze badges 1 |1 Answer
Reset to default 1mov r0, r1, lsl #2
works fine for me in gnu as.
I have GNU assembler (2.35.2-2+14+b2) 2.35.2
Probably you didn't specify the correct command line flags or options in the file.
Try adding to the top of your file something like:
.syntax unified
.cpu cortex-m4
mov r0, r1, lsl #2
works fine with gnu assembler for ARM. It does not assemble for aarch64. Decide if you want 32 or 64 bit. If 32 bit, use 32 bit ARM binutils. If 64 bit, rewrite the code (e.g.lsl w0, w1, 2
) – Jester Commented Nov 19, 2024 at 17:29