I am trying to use clang to compile newlib for aarch64 on X86_64. I have succesfully compiled clang and llvm-tools for AArch64 target.
Now when I try to compile newlib it fails for:
…/…/…/newlib-cygwin/newlib/libc/machine/aarch64/memchr.S:113:10: error: invalid operand for instruction
mov x6, v6.2d[0]
^
…/…/…/newlib-cygwin/newlib/libc/machine/aarch64/memchr.S:133:10: error: invalid operand for instruction
mov x6, v6.2d[0]
^
…/…/…/newlib-cygwin/newlib/libc/machine/aarch64/memchr.S:143:10: error: invalid operand for instruction
mov x6, v6.2d[0]
It complains on the second operand of the instruction. But I’ve checked with ARM manual it looks like it’s a valid neon instruction.
Why is my clang cannot compile this file? I’ve tried compiling it with gcc, and it working in gcc
binutils regards mov x6, v6.d[0] as the canonical form for that, and LLVM only accepts that form. Reading the Arm ARM, MOV takes a size specifier (i.e. B/H/S/D) not an arrangement specifier (count plus size specifier), so it seems dodgy that binutils accepts the alternative form, and newlib shouldn’t be using something non-standard like that; looks like it needs to update to a newer version of the code it vendors (see string: Use .d rather than .2d for element mov instructions · ARM-software/optimized-routines@4f4e530 · GitHub).