public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail•com>
To: Daniel Axtens <dja@axtens•net>,
	Segher Boessenkool <segher@kernel•crashing.org>
Cc: llvmlinux@lists•linuxfoundation.org, linuxppc-dev@lists•ozlabs.org
Subject: Re: [RFC PATCH 4/8] powerpc/ppc_asm: use plain numbers for registers
Date: Fri, 19 Mar 2021 11:39:05 +1000	[thread overview]
Message-ID: <1616117795.mys33l8084.astroid@bobo.none> (raw)
In-Reply-To: <87tupzoffb.fsf@dja-thinkpad.axtens.net>

Excerpts from Daniel Axtens's message of February 26, 2021 10:12 am:
> Segher Boessenkool <segher@kernel•crashing.org> writes:
> 
>> On Thu, Feb 25, 2021 at 02:10:02PM +1100, Daniel Axtens wrote:
>>> This is dumb but makes the llvm integrated assembler happy.
>>> https://github.com/ClangBuiltLinux/linux/issues/764
>>
>>> -#define	r0	%r0
>>
>>> +#define	r0	0
>>
>> This 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.

If you put it under ifdef CONFIG_CC_IS_CLANG in the meantime I think 
that would be okay. Then we get error checking with gcc compiles and
llvm at least builds with its assembler which would be nice.

Thanks,
Nick

  reply	other threads:[~2021-03-19  1:39 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25  3:09 [RFC PATCH 0/8] WIP support for the LLVM integrated assembler Daniel Axtens
2021-02-25  3:09 ` [PATCH 1/8] powerpc/64s/exception: Clean up a missed SRR specifier Daniel Axtens
2021-02-25  3:10 ` [RFC PATCH 2/8] powerpc: check for support for -Wa,-m{power4,any} Daniel Axtens
2021-03-19  1:32   ` [RFC PATCH 2/8] powerpc: check for support for -Wa, -m{power4, any} Nicholas Piggin
2021-03-19 10:53     ` Michael Ellerman
2021-02-25  3:10 ` [RFC PATCH 3/8] powerpc/head-64: do less gas-specific stuff with sections Daniel Axtens
2021-03-19  1:35   ` Nicholas Piggin
2021-02-25  3:10 ` [RFC PATCH 4/8] powerpc/ppc_asm: use plain numbers for registers Daniel Axtens
2021-02-25 15:25   ` Segher Boessenkool
2021-02-26  0:12     ` Daniel Axtens
2021-03-19  1:39       ` Nicholas Piggin [this message]
2021-02-25  3:10 ` [RFC PATCH 5/8] poweprc/lib/quad: Provide macros for lq/stq Daniel Axtens
2021-02-25 15:44   ` Segher Boessenkool
2021-02-26  0:13     ` Daniel Axtens
2021-02-25  3:10 ` [RFC PATCH 6/8] powerpc/mm/book3s64/hash: drop pre 2.06 tlbiel for clang Daniel Axtens
2021-03-19  2:01   ` Nicholas Piggin
2021-03-22 16:49     ` Christophe Leroy
2021-03-22 18:11       ` Nicholas Piggin
2021-03-24 15:51         ` Segher Boessenkool
2021-03-24 21:07           ` Segher Boessenkool
2021-02-25  3:10 ` [RFC PATCH 7/8] powerpc/purgatory: drop .machine specifier Daniel Axtens
2021-02-25 15:58   ` Segher Boessenkool
2021-02-26  0:17     ` Daniel Axtens
2021-03-19  2:05     ` Nicholas Piggin
2021-03-19 10:59       ` Michael Ellerman
2021-02-25  3:10 ` [RFC PATCH 8/8] powerpc/64/asm: don't reassign labels Daniel Axtens
2021-02-25 16:08   ` Segher Boessenkool
2021-02-26  0:28     ` Daniel Axtens
2021-03-19  2:15       ` Nicholas Piggin
2021-03-14 10:01 ` [RFC PATCH 0/8] WIP support for the LLVM integrated assembler Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1616117795.mys33l8084.astroid@bobo.none \
    --to=npiggin@gmail$(echo .)com \
    --cc=dja@axtens$(echo .)net \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=llvmlinux@lists$(echo .)linuxfoundation.org \
    --cc=segher@kernel$(echo .)crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox