[cfe-users] AArch64 Register not recognized for Inline Assmebly

Rakib Hasan via cfe-users cfe-users at lists.llvm.org
Wed May 16 13:38:22 PDT 2018


Hi,
I am trying to compile a .cc file using clang 5.0 for ARM 64-bit that has
some inline assembly. The inline assembly loads some value to 'q0'. I am
getting the error: *'unknown register name `q0`'*
I reproduced the issue with a simple file that only has the following:





*int foo(void){   __asm__("ldr q0, [x0]":::"q0");   return 0;}*

I am compiling it with: *clang++ --target=aarch64-none-linux-android -c
foo.cc*

Note that if the same code is in an assembly file (e.g. foo.S) like the
following:







*.text.align 5.global foo.type foo, %functionfoo:   ldr q0, [x0]   ret*

The above compiles without any issue.

My question is: Is this a bug or is there any other flag that I need to
specify to compile such C++ files with inline assembly?

I know that using v0 instead of q0 fixes the issue here. But that requires
a lot of change in my project and according to the ARM Architecture
Reference Manual the v0-v31 registers can also be accessed by q0-q31.

Also note that the same files compile with gcc without any error.

Any suggestion is appreciated.

Regards,

Rakib Hasan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20180516/cacaef12/attachment.html>


More information about the cfe-users mailing list