[PATCH] D136436: [Clang][LoongArch] Add register alias handling without `$` prefix
WÁNG Xuěruì via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 27 23:43:25 PDT 2022
xen0n added a comment.
In D136436#3890737 <https://reviews.llvm.org/D136436#3890737>, @SixWeining wrote:
> In D136436#3881382 <https://reviews.llvm.org/D136436#3881382>, @MaskRay wrote:
>
>> In D136436#3876684 <https://reviews.llvm.org/D136436#3876684>, @SixWeining wrote:
>>
>>> In D136436#3873987 <https://reviews.llvm.org/D136436#3873987>, @xen0n wrote:
>>>
>>>> In D136436#3873949 <https://reviews.llvm.org/D136436#3873949>, @SixWeining wrote:
>>>>
>>>>> How about the asm code in `.s`? Do we need to support `addi.d a0, a1, a2`?
>>>>
>>>> For the assembler part of this support, I think we need to coordinate with the GNU toolchain maintainers of LoongArch port (Chenghua, Zhensong and Lulu I think). Maybe raising an issue on the LoongArch documentation repo <https://github.com/loongson/LoongArch-Documentation> would help.
>>>>
>>>> For the GCC part, consistency is of course welcomed, and I think the Loongson maintainers or @xry111 could just submit the respective support.
>>>
>>> Well. To be honest, I'd like to keep only one form but not both. Seems other archs only support one form? If we support both, will it make people confused? Is mixed form allowed (`fmadd.d fa0, $fa0, f0, $fcc0`) ?
>>
>> Having just one form will be nice.
>
> @tangyouling Considering that `$` is well supported by both gcc and llvm, we should adandon this patch?
I'm afraid no, the prefix-less form is AFAIK likely inspired by RISC-V assembly (which doesn't have any prefix for registers whatsoever), but the `$`-prefixed form is clearly a MIPS style, and frankly speaking we (the community) had no choice at the time of binutils upstreaming because of the insistence of Chenghua et al., and loads of code using the prefixed form already appearing. The important point is that there's already code making use of prefix-less register names in inline asm, so we must follow suit for keeping source compatibility across gcc and clang.
While having just one form to support is indeed nice, that ship has sailed long ago, and I think the next best thing is to allow both styles but disallow mixing of styles in one insn, i.e. no things like `add $a0, a1, $a2`, if it's impossible to only allow prefix-less register names in Clang inline asm but not at LLVM level.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136436/new/
https://reviews.llvm.org/D136436
More information about the cfe-commits
mailing list