Arm64 inline asm utxb

Hi

I’m working on porting Valgrind to FreeBSD arm64. Most of the work is done but there still a few things to do. One issue that I have is with the regression tests. These were developed with GCC, and in a few cases clang doesn’t like the syntax. For most of them I looked at the GCC generated code with objdump and saw that the testcases employed some unused features.

There is one testcase that I still can’t get to compile with clang.

It looks like this

TESTINST3(“add x21,x22,x23,uxtb #0”, NN0, NN1, x21,x22,x23,0);

Here’s a godbolt

and the full source code

Is this a bug/limitation in the clang asm processing? Or is there some other way for clang to infer uxtb rather than uxtx?

A+
Paul

I might have found the answer. According to the arm doc

https://developer.arm.com/documentation/100076/0100/A64-Instruction-Set-Reference/A64-General-Instructions/ADD--extended-register-

According to the table at the end, x registers and only allowed with sxtx (so clang is correct). sxtb/h/w need w registers.

It looks like GCC is being sloppy and quietly converts it into a w register.

Yes, gas does the Xm to Rm conversion.

The aliases, while convenient, could cause confusion (whether there are two encodings for the same functionality?) Since this isn’t wildly used, my personal preference is that LLVM integrated assembler does not implement this alias.

Thanks for the info. I modified the code to use w register names so it should now be ok for both clang and gcc.