<div dir="ltr"><div>Hi, <br></div><div>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: <b>'unknown register name `q0`'</b></div><div>I reproduced the issue with a simple file that only has the following:<br></div><div><br></div><div><b><span style="background-color:rgb(204,204,204)"><span style="font-family:monospace,monospace">int foo(void)<br>{<br> __asm__("ldr q0, [x0]":::"q0");<br> return 0;<br>}</span></span></b><br></div><div><br></div><div>I am compiling it with: <b><span style="font-family:monospace,monospace">clang++ --target=aarch64-none-linux-android -c foo.cc</span></b></div><div><br></div><div>Note that if the same code is in an assembly file (e.g. foo.S) like the following:</div><div><br></div><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><b><span style="background-color:rgb(204,204,204)"><span style="font-family:monospace,monospace">.text<br>.align 5<br>.global foo<br>.type foo, %function<br>foo:<br> ldr q0, [x0]<br> ret</span></span></b></div><div><br></div><div>The above compiles without any issue. <br></div><div><br></div><div>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?<br></div><div><br></div><div>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. <br></div><div><br></div><div>Also note that the same files compile with gcc without any error.</div><div><br></div><div>Any suggestion is appreciated.<br></div><div><br>Regards,<br></div><div><br></div><div>Rakib Hasan<br></div></div></div></div></div></div></div></div>
</div>