Re: [RFC PATCH 4/8] powerpc/ppc_asm: use plain numbers for registers
flat view
From: Daniel Axtens <hidden>
Date: 2021-02-26 00:13:01
Segher Boessenkool [off-list ref] writes:
On Thu, Feb 25, 2021 at 02:10:02PM +1100, Daniel Axtens wrote:quoted
This is dumb but makes the llvm integrated assembler happy. https://github.com/ClangBuiltLinux/linux/issues/764quoted
-#define r0 %r0quoted
+#define r0 0This is a big step back (compare 9a13a524ba37). If you use a new enough GAS, you can use the -mregnames option and just say "r0" directly (so not define it at all, or define it to itself). === addi 3,3,3 addi r3,r3,3 addi %r3,%r3,3 addi 3,3,3 addi r3,r3,r3 addi %r3,%r3,%r3 === $ as t.s -o t.o -mregnames t.s: Assembler messages: t.s:6: Warning: invalid register expression t.s:7: Warning: invalid register expression Many people do not like bare numbers. It is a bit like not wearing seatbelts (but so is all assembler code really: you just have to pay attention). A better argument is that it is harder to read for people not used to assembler code like this. We used to have "#define r0 0" etc., and that was quite problematic. Like that "addi r3,r3,r3" example, but also, people wrote "r0" where only a plain 0 is allowed (like in "lwzx r3,0,r3": "r0" would be misleading there!)
So an overarching comment on all of these patches is that they're not intended to be ready to merge, nor are they necessarily what I think is the best solution. I'm just swinging a big hammer to see how far towards LLVM_IAS=1 I can get on powerpc, and I accept I'm going to have to come back and clean things up. Anyway, noted, I'll push harder on trying to get llvm to accept %rN: there was a patch that went in after llvm-11 that should help. Kind regards, Daniel
Segher