Bug 1035 - Implement Scalar Power ISA v3.1 (32-bit-only) instructions (no PO1) in ISACaller
Summary: Implement Scalar Power ISA v3.1 (32-bit-only) instructions (no PO1) in ISACaller
Status: RESOLVED FIXED
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: Source Code (show other bugs)
Version: unspecified
Hardware: Other Linux
: --- enhancement
Assignee: Luke Kenneth Casson Leighton
URL:
Depends on: 678 1082 1120 1177
Blocks:
  Show dependency treegraph
 
Reported: 2023-03-17 13:09 GMT by Luke Kenneth Casson Leighton
Modified: 2024-03-10 20:33 GMT (History)
4 users (show)

See Also:
NLnet milestone: NLnet.2022-08-107.ongoing
total budget (EUR) for completion of task and all subtasks: 7000
budget (EUR) for this task, excluding subtasks' budget: 4000
parent task for budget allocation: 961
child tasks for budget allocation: 1120 1147
The table of payments (in EUR) for this task; TOML format:
jacob=1500 ghostmansd={amount=1500, submitted=2024-02-26, paid=2024-03-08} lkcl = {amount=1000, submitted=2024-02-26,paid = 2024-03-08 }


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Kenneth Casson Leighton 2023-03-17 13:09:31 GMT
Power ISA has moved on to v3.1, and if Draft SVP64 is to be accepted in
a future version of Power it must be on the future version (not v3.0).
However PO1 (IBM 64-bit Prefixing) is too complex and is excluded from
the scope. Only the 32-bit SFFS instructions of Power ISA v3.1 are to
be implemented in ISACaller, binutils, and insndb.
Comment 1 Luke Kenneth Casson Leighton 2023-03-17 20:17:33 GMT
instructions

these are all Scalar and they are Vectoriseable:

simulator & unit tests:

* DONE: cntlzdm and trailing (masked)
* DONE: cfuge, pextd, pdepd
* DONE: brh brw brd - these are actually all covered by grevlut
    done in bug #1119
* DONE: setbc, setbcr, setnbc etc.
    done in bug #1123

binutils (whatever steps are necessary for SVP64 support, recent binutils should already support the scalar instructions themselves):

* DONE: cntlzdm and trailing (masked)
* DONE: cfuge, pextd, pdepd
* DONE: brh brw brd - these are actually all covered by grevlut
    done in bug #1119
* DONE: setbc, setbcr, setnbc etc.
Comment 2 Dmitry Selyutin 2023-04-26 13:10:59 BST
I assume binutils are affected too?
Comment 3 Jacob Lifshay 2023-05-09 21:08:16 BST
(In reply to Luke Kenneth Casson Leighton from comment #1)
> instructions (note, these are all Scalar and they are UnVectoriseable)
> 
> * cfuge, pextd, pdepd
> * brh brw brd - these are actually all covered by grevlut
> * setbc, setbcr, setnbc etc.

these are vectorizable
Comment 4 Luke Kenneth Casson Leighton 2023-05-17 17:34:35 BST
(In reply to Dmitry Selyutin from comment #2)
> I assume binutils are affected too?

yes. we should take the opportunity to reorganise SVP64.RM Field
and implement PO9 at (roughly) the same time.
https://libre-soc.org/openpower/sv/po9_encoding/
Comment 5 Luke Kenneth Casson Leighton 2023-05-18 07:11:27 BST
(In reply to Jacob Lifshay from comment #3)
> (In reply to Luke Kenneth Casson Leighton from comment #1)

> > * cfuge, pextd, pdepd
> > * brh brw brd - these are actually all covered by grevlut
> > * setbc, setbcr, setnbc etc.
> 
> these are vectorizable

missed that, good catch, edited comment #1 to match.
reg profiles:

* p105 cntlzdm cnttzdm cfuged pextd pdepd RA,RS,RB X-Form
* p119 brh brw brd RA,RS X-Form
* p129 setbc setbcr setnbc setnbcr RT,BI X-Form

these are:

* GPR 2R GPR 1W
* GPR 1R GPR 1W
* CR  1R GPR 1W

none of these 3 groups alter anything else, no XER or PC or SPRs.
Comment 6 Luke Kenneth Casson Leighton 2023-05-18 14:44:54 BST
(In reply to Luke Kenneth Casson Leighton from comment #1)
> instructions (note, these are all Scalar and they are UnVectoriseable)
> 
> * prefixed ld/store immediate byte thru quad
>    plbz plhz plha plwz plwa pld plq
>    pstb psth pstw pstd pstq
>    plfs plfd pstfs pstfd
> * paddi
> * pnop - prefixed nop
> * prefixed FP load/store immediate

all of these according to Public v3.1 p23 Section 1.6.3-4 Book I
are strictly Immediate-only operands.  the only reg operands
are MSK and those are unused by the above instructions.

therefore - and this is the important bit - the above instructions
do *not* have or require different register profiles from their
unprefixed counterparts.

all they need is extra immediate fields, and immediates are *not*
part of *register* profiles.
Comment 7 Jacob Lifshay 2023-07-20 02:16:43 BST
I started working on implementing some of these instructions, since there are quite a lot, I made a sub-bug for what I've completed so far, as well as adjusting comment 1 to have a to-do list.
Comment 8 Luke Kenneth Casson Leighton 2023-07-20 23:48:28 BST
(In reply to Jacob Lifshay from comment #7)
> I started working on implementing some of these instructions, since there
> are quite a lot, I made a sub-bug for what I've completed so far, as well as
> adjusting comment 1 to have a to-do list.

good idea. skip EXT1xx entirely please. i have a better way to do paddi
(TBD: sv.b)
Comment 9 Jacob Lifshay 2023-07-22 00:16:16 BST
I'm going through the list of new instructions after v3.0, some instructions you missed that we might be required to implement:
* hashst[p]/hashchk[p]
* mffsc*/mffsl
* slbiag

ultravisor instructions:
* msgclru/msgsndu
* urfid
Comment 10 Luke Kenneth Casson Leighton 2023-07-22 00:46:06 BST
(In reply to Jacob Lifshay from comment #9)
> I'm going through the list of new instructions after v3.0, some instructions
> you missed that we might be required to implement:
> * hashst[p]/hashchk[p]

can't find it.

> * mffsc*/mffsl

part of v3.0 so goes in the FP set

> * slbiag

no. not implemented by microwatt ==> "out".
 
> ultravisor instructions:
> * msgclru/msgsndu
> * urfid

again: not implemented by microwatt ==> "out".

it took 18 months to get the MMU and caches working.
if IBM Research implement hypervisor in microwatt then
we stand a reasonable chance of also implementing it.
Comment 11 Jacob Lifshay 2023-07-22 00:51:52 BST
(In reply to Luke Kenneth Casson Leighton from comment #10)
> (In reply to Jacob Lifshay from comment #9)
> > I'm going through the list of new instructions after v3.0, some instructions
> > you missed that we might be required to implement:
> > * hashst[p]/hashchk[p]
> 
> can't find it.

it's in v3.1B, which is the pdf you should be using by default...
section 3.3.17.2 page 121 (147)

> 
> > * mffsc*/mffsl
> 
> part of v3.0 so goes in the FP set

ahh, copied too far when building my sorted list of new insns.
> 
> > * slbiag
> 
> no. not implemented by microwatt ==> "out".

well, afaict it's in the base instruction set...so we may be stuck.
Comment 12 Luke Kenneth Casson Leighton 2023-07-22 07:23:01 BST
(In reply to Jacob Lifshay from comment #11)

> it's in v3.1B, which is the pdf you should be using by default...
> section 3.3.17.2 page 121 (147)

drat, i have a beta copy (v3.1 not v3.1B).
there is no section 3.3.17.2.
 
> ahh, copied too far when building my sorted list of new insns.

they should be added instead to the "list of FPR" instructions
(in the separate bugreport covering "implement FP operations"
you'll have to look it up)

> well, afaict it's in the base instruction set...so we may be stuck.

not doing it. it'll be about 2 years extra work whereas it'll take
IBM Research Engineers a couple of months max.
Comment 13 Jacob Lifshay 2024-02-26 17:30:16 GMT
my part (ISACaller simulator and unit tests) of this is done (updated comment #1 to reflect the current state), binutils support is Dmitry's part. so, Luke, can I submit an RFP for my part of this?
Comment 14 Luke Kenneth Casson Leighton 2024-02-26 22:09:40 GMT
(In reply to Jacob Lifshay from comment #13)

> so, Luke, can I submit an RFP for my part of this?

yes we're all done here shold have been changed to FIXED months ago, doh