[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <74a06e8e7d0bab88892321dbdb891762487b6f6b.camel@xry111.site>
Date: Wed, 28 Jun 2023 18:40:20 +0800
From: Xi Ruoyao <xry111@...111.site>
To: WANG Xuerui <kernel@...0n.name>, bibo mao <maobibo@...ngson.cn>,
zhaotianrui <zhaotianrui@...ngson.cn>,
Jinyang He <hejinyang@...ngson.cn>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Huacai Chen <chenhuacai@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
loongarch@...ts.linux.dev, Jens Axboe <axboe@...nel.dk>,
Mark Brown <broonie@...nel.org>,
Alex Deucher <alexander.deucher@....com>,
Oliver Upton <oliver.upton@...ux.dev>, tangyouling@...ngson.cn
Subject: Re: [PATCH v15 27/30] LoongArch: KVM: Implement vcpu world switch
On Wed, 2023-06-28 at 18:22 +0800, WANG Xuerui wrote:
> > is "ori t0, zero, CSR_PRMD_PIE" hard to understand? It is basic
> > arithmetic instr and easy to understand also. To be frank I do not
> > see the advantage of using li.w, also there is no document that
> > pseudo-instruction should be used with high priority.
> It depends on the reader. Sure the semantics are the same, but with "ori
> xx, zero, xx" someone's always going to wonder "why do 'x = 0 |
> something' when you can simply li.w", because even if it's easy to
> understand it's still an extra level of indirection.
>
> And I've given the historical and general software engineering
> perspective too; it's not something set in stone, but I'd expect general
> software development best practices and minimizing any *possible* reader
> confusion to be acceptable.
The pseudo *should* be the high priority in general. If we don't
consider the pseudos high priority, people will start to load immediates
with "their own way", like writing "addi.w $t0, $zero, 42" or even "xori
$t0, $zero, 42" for "42". These may puzzle the uarch, causing a
performance worse than "ori $t0, $zero, 42". So the only rationale
things are either:
1. Telling people always use pseudos if possible.
or
2. Telling people "remember to use ori for loading small immediates, not
other instructions".
1 is obviously easier.
--
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists