Subject: Re: [PATCH 1/2] powerpc: add BookS wait opcode macro

From: Segher Boessenkool <[email-masked]>
Date: Wed, 20 Jul 2022 16:19:11 -0500

On Wed, Jul 20, 2022 at 07:54:54PM +1000, Nicholas Piggin wrote:
> Excerpts from Segher Boessenkool's message of July 13, 2022 2:29 am:
> > The embedded extensions are no longer part of the PowerPC architecture,
> > so wouldn't it be a better way forward to rename the existing one,
> > instead?  A bit more work now, but less in the future :-)
> 
> And I actually misremembered this too, was off digging and asking
> about it, but the change isn't strictly BookE vs BookS, but rather
> the wait opcode was changed in ISA v3.0, which is a bit of an
> unfortunate landmine.

The current wait opcode is *new* in 3.0, but it has the same mnemonic
as the old one, more formally.

> It seems apparently POWER8 implemented a non-architected instruction
> 'waitasec' that uses this opcode, then I suppose it was decided to
> continue with that opcode in v3.0 when BookE was dropped, for reasons.

The (newer) wait instruction is 0/30 while the old one is 1/30
(secondary opcodes 30 resp. 62), although 0/30 stayed open; maybe there
is more history there already?  Curious.

> In any case, I will rename it. Precedent is divided. We have
> PPC_RAW_TLBIEL_v205 for older tlbiel, and PPC_ISA_3_0_INVALIDATE_ERAT
> for a new ERAT invalidation instruction. I guess making the older
> instruction the exceptional case ends up being better in the long
> term.

Yeah exactly, it's better if the simpler name is the one that newer
code should use: more readable, more writable, and importantly less
room for mistakes :-)

Thanks,

Segher