I'm doing a little project using the Android NDK, and I must insert some asm code for ARM architecture.
Everything apart from the asm works just fine, but the asm code tells me that
Operand 1 should be an integer register
when conpiling simple code like
asm("mov r0, r0");
So, what is the problem? Is my computer trying to compile for x86_64 instead of ARM? If so, how should I change that?
Also, I've tried the x86_64 equivalent arm("mov rax, rax"); but the error is the same.
mov x0, x0. If it doesn't give an error then your problem is that you're using 32-bit ARM assembly language with the 64-bit ARM toolchain. You either need to switch to 32-bit tools or 64-bit assembly language. By the way, you should investigate whether you really need to use inline assembly. It's hard to get right. See if you can't use intrinsics to do what you want instead. - Ross Ridgeasm("mov %rax, %rax");should work as a no-op. Usegcc -Sto generate an asm output file. Look for#APP/#NO_APParound your code, and see if it looks like the surrounding compiler-generated asm. e.g. godbolt.org/g/h8JIEy - Peter Cordesmov x0, x0it says too many memory references for `mov' - Garmekain