Bug 1147 - support Scalar Power ISA v3.1 (32-bit-only) instructions (no PO1) in binutils
Summary: support Scalar Power ISA v3.1 (32-bit-only) instructions (no PO1) in binutils
Status: RESOLVED FIXED
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: Source Code (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- enhancement
Assignee: Dmitry Selyutin
URL:
Depends on:
Blocks:
 
Reported: 2023-08-30 15:52 BST by Dmitry Selyutin
Modified: 2024-03-09 11:14 GMT (History)
4 users (show)

See Also:
NLnet milestone: NLnet.2022-08-107.ongoing
total budget (EUR) for completion of task and all subtasks: 1000
budget (EUR) for this task, excluding subtasks' budget: 1000
parent task for budget allocation: 1035
child tasks for budget allocation:
The table of payments (in EUR) for this task; TOML format:
ghostmansd={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 Dmitry Selyutin 2023-08-30 15:52:39 BST
This task is intended to cover binutils support for the scalar instructions including for byte reverse instructions.

Full list:
cntlzdm
cnttzdm
cfuged
pextd
pdepd
brh
brw
brd
setbc
setbcr
setnbc
setnbcr
Comment 1 Dmitry Selyutin 2023-08-30 16:05:45 BST
I've checked binutils and can confirm that instructions cntlzdm, cfugeD, pextd, pdepd, brh, brw, brd, setbc, setbcr, setnbc are all present as vanilla binutils instructions.
All of them are missing in SVP64-related code, though. I'll add them.
Comment 2 Jacob Lifshay 2023-08-30 16:09:04 BST
(In reply to Dmitry Selyutin from comment #1)
> I've checked binutils and can confirm that instructions cntlzdm, cfuged,
> pextd, pdepd, brh, brw, brd, setbc, setbcr, setnbc are all present as
> vanilla binutils instructions.
> All of them are missing in SVP64-related code, though. I'll add them.

there's also setnbcr, which should also be in binutils but not as SVP64 yet.
Comment 3 Dmitry Selyutin 2023-08-30 16:11:42 BST
(In reply to Jacob Lifshay from comment #2)
> there's also setnbcr, which should also be in binutils but not as SVP64 yet.

Yeah I forgot to mention this one, thanks
Comment 4 Jacob Lifshay 2023-08-31 14:27:17 BST
added a full list in the top comment since we also forgot cnttzdm
Comment 5 Dmitry Selyutin 2023-11-12 18:17:55 GMT
I'll move on with this task next week (evenings or weekends). I expect not that many obstacles here, since I already had to update binutils SVP64 generated code in scope of some task we had recently; basically this should already mostly be covered.
Comment 6 Luke Kenneth Casson Leighton 2023-11-12 18:36:48 GMT
(In reply to Dmitry Selyutin from comment #5)
> I'll move on with this task next week (evenings or weekends). I expect not
> that many obstacles here, since I already had to update binutils SVP64
> generated code in scope of some task we had recently; basically this should
> already mostly be covered.

brilliant. btw do check email from David.

there is quite a lot of "small" work needed on SVP64 as well,
we cannot move to libopid because it is too massive a change
(and needs its own entire grant)

remember that we don't yet have these in the simulator and
therefore not in insndb, but the csv entries and OP_xx should
be reasonably straightforward to add.

* cntlzdm/tz should have the same OP_CNTLZ as existing instructions
* set?bc* should have the same OP_SETBC
Comment 7 Dmitry Selyutin 2023-11-12 19:16:45 GMT
(In reply to Luke Kenneth Casson Leighton from comment #6)
> (In reply to Dmitry Selyutin from comment #5)
> > I'll move on with this task next week (evenings or weekends). I expect not
> > that many obstacles here, since I already had to update binutils SVP64
> > generated code in scope of some task we had recently; basically this should
> > already mostly be covered.
> 
> brilliant. btw do check email from David.
> 
> there is quite a lot of "small" work needed on SVP64 as well,
> we cannot move to libopid because it is too massive a change
> (and needs its own entire grant)

Yes, this is a huge task. What's worse, it has several prerequisites; for example, fields and specs generation.

> remember that we don't yet have these in the simulator and
> therefore not in insndb, but the csv entries and OP_xx should
> be reasonably straightforward to add.

Luke, sorry, I'm probably missing what you mean. Could you explain further, please?

$ for insn in $(pysvp64db list | egrep "cntlzdm|cnttzdm|cfuged|pextd|pdepd|brh|brw|brd|setbc|setbcr|setnbc|setnbcr"); do echo  "${insn}"; pysvp64db opcodes "${insn}"; pysvp64db operands "${insn}" | sed -e 's|^|    |'; echo; done
cntlzdm
011111---------------0000111011-
    RA 11, 12, 13, 14, 15
    RS 6, 7, 8, 9, 10
    RB 16, 17, 18, 19, 20

brw
011111---------------0010011011-
    RA 11, 12, 13, 14, 15
    RS 6, 7, 8, 9, 10

pdepd
011111---------------0010011100-
    RA 11, 12, 13, 14, 15
    RS 6, 7, 8, 9, 10
    RB 16, 17, 18, 19, 20

brd
011111---------------0010111011-
    RA 11, 12, 13, 14, 15
    RS 6, 7, 8, 9, 10

pextd
011111---------------0010111100-
    RA 11, 12, 13, 14, 15
    RS 6, 7, 8, 9, 10
    RB 16, 17, 18, 19, 20

brh
011111---------------0011011011-
    RA 11, 12, 13, 14, 15
    RS 6, 7, 8, 9, 10

cfuged
011111---------------0011011100-
    RA 11, 12, 13, 14, 15
    RS 6, 7, 8, 9, 10
    RB 16, 17, 18, 19, 20

setbc
011111---------------0110000000-
    RT 6, 7, 8, 9, 10
    BI 11, 12, 13, 14, 15

setbcr
011111---------------0110100000-
    RT 6, 7, 8, 9, 10
    BI 11, 12, 13, 14, 15

setnbc
011111---------------0111000000-
    RT 6, 7, 8, 9, 10
    BI 11, 12, 13, 14, 15

setnbcr
011111---------------0111100000-
    RT 6, 7, 8, 9, 10
    BI 11, 12, 13, 14, 15

cnttzdm
011111---------------1000111011-
    RA 11, 12, 13, 14, 15
    RS 6, 7, 8, 9, 10
    RB 16, 17, 18, 19, 20
Comment 8 Luke Kenneth Casson Leighton 2023-11-12 21:18:14 GMT
libresoc@localhost:~/src/openpower-isa/openpower/isatables$ grep OP_CNT *
minor_31.csv:0b0000111010,LOGICAL,OP_CNTZ,RS,NONE,NONE,RA,NONE,CR0,0,0,ZERO,0,NONE,0,0,0,0,0,0,RC,0,0,cntlzd,X,,,

RM-1P-2S1D.csv:cntlzdm,NORMAL,,1P,EXTRA3,NO,d:RA,s:RS,s:RB,0,RS,RB,0,RA,0,0,0
minor_31.csv:0b0000111011,LOGICAL,OP_CNTZ,RS,RB,NONE,RA,NONE,NONE,0,0,ZERO,0,NONE,0,0,0,0,0,0,NONE,0,0,cntlzdm,X,,0,
sv_decode.vhdl:    2#0000111011# => (NORMAL, P1, EXTRA3, NO, RS, RB, NONE, RA, NONE, NONE, NONE, Idx1, Idx2, NONE, Idx0, NONE, NONE, NONE), -- cntlzdm

how is that missing yet functional? it is a good thing, i think. or maybe
not, as it means there is a second source where the CSV files are supposed
to be canonical.
Comment 9 Jacob Lifshay 2023-11-12 21:36:41 GMT
(In reply to Luke Kenneth Casson Leighton from comment #8)
> how is that missing yet functional?

what did you think is missing? afaict nothing is missing, all 6 variants of count-zeros are in the CSV:
https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=openpower/isatables/minor_31.csv;h=f6a9c6bbd71466d4d5663bef4c1e9c8c1b697975;hb=5a0517bba06e6b9fe62a435b3d0f067e36c2d120#l30
Comment 10 Dmitry Selyutin 2023-11-14 20:00:18 GMT
Done, svp64 branch of binutils-gdb is updated. As usual, I've squashed the results of the autogeneration into the commits which added the autogenerated files, and force-pushed. I also took a moment to rebase against the recent master and fix the conflicts.
Comment 11 Luke Kenneth Casson Leighton 2023-11-14 20:18:25 GMT
(In reply to Jacob Lifshay from comment #9)

> what did you think is missing? afaict nothing is missing, all 6 variants of
> count-zeros are in the CSV:
> https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=openpower/isatables/
> minor_31.csv;h=f6a9c6bbd71466d4d5663bef4c1e9c8c1b697975;
> hb=5a0517bba06e6b9fe62a435b3d0f067e36c2d120#l30

brilliant they are all under OP_CNTLZ.

(In reply to Dmitry Selyutin from comment #10)
> Done, svp64 branch of binutils-gdb is updated. 

looks great. a lot of work.

https://git.libre-soc.org/?p=binutils-gdb.git;a=commitdiff;h=e292c275038

ahhh hooray :) sffs separated from svp64 as options. awesome
Comment 12 Jacob Lifshay 2023-11-14 20:28:52 GMT
(In reply to Luke Kenneth Casson Leighton from comment #11)
> (In reply to Jacob Lifshay from comment #9)
> 
> > what did you think is missing? afaict nothing is missing, all 6 variants of
> > count-zeros are in the CSV:
> > https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=openpower/isatables/
> > minor_31.csv;h=f6a9c6bbd71466d4d5663bef4c1e9c8c1b697975;
> > hb=5a0517bba06e6b9fe62a435b3d0f067e36c2d120#l30
> 
> brilliant they are all under OP_CNTLZ.

OP_CNTZ, not OP_CNTLZ -- probably why you were confused about missing csv entries