Bug 964 - binutils: support maddedu, divmod2du instructions
Summary: binutils: support maddedu, divmod2du instructions
Status: RESOLVED FIXED
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: Source Code (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- enhancement
Assignee: Dmitry Selyutin
URL:
Depends on:
Blocks:
 
Reported: 2022-10-22 17:00 BST by Dmitry Selyutin
Modified: 2023-03-13 17:25 GMT (History)
1 user (show)

See Also:
NLnet milestone: NLnet.2021.02A.052.CryptoRouter
total budget (EUR) for completion of task and all subtasks: 500
budget (EUR) for this task, excluding subtasks' budget: 500
parent task for budget allocation: 772
child tasks for budget allocation:
The table of payments (in EUR) for this task; TOML format:
[ghostmansd] amount = 500 submitted = 2023-01-25 paid = 2023-03-10


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Selyutin 2022-10-22 17:00:55 BST
Currently binutils lack these instructions which can be used for cryptographic purposes.

https://libre-soc.org/irclog/%23libre-soc.2022-10-22.log.html#t2022-10-22T10:31:30
Comment 1 Dmitry Selyutin 2022-10-22 17:02:52 BST
[ghostmansd@dell gas]$ cat ~/Code/test.s 
sv.maddedu 31,0,0,0
sv.maddedu 0,31,0,0
sv.maddedu 0,0,31,0
sv.maddedu 0,0,0,31
sv.divmod2du 31,0,0,0
sv.divmod2du 0,31,0,0
sv.divmod2du 0,0,31,0
sv.divmod2du 0,0,0,31
[ghostmansd@dell gas]$ ../binutils/objdump -dr -Mlibresoc /tmp/test.o 

/tmp/test.o:     file format elf64-powerpcle


Disassembly of section .text:

0000000000000000 <.text>:
   0:   00 00 40 05     sv.maddedu r31,r0,r0,r0
   4:   32 00 e0 13 
   8:   00 00 40 05     sv.maddedu r0,r31,r0,r0
   c:   32 00 1f 10 
  10:   00 00 40 05     sv.maddedu r0,r0,r31,r0
  14:   32 f8 00 10 
  18:   00 00 40 05     sv.maddedu r0,r0,r0,r31
  1c:   f2 07 00 10 
  20:   00 00 40 05     sv.divmod2du r31,r0,r0,r0
  24:   34 00 e0 13 
  28:   00 00 40 05     sv.divmod2du r0,r31,r0,r0
  2c:   34 00 1f 10 
  30:   00 00 40 05     sv.divmod2du r0,r0,r31,r0
  34:   34 f8 00 10 
  38:   00 00 40 05     sv.divmod2du r0,r0,r0,r31
  3c:   f4 07 00 10
Comment 2 Dmitry Selyutin 2022-10-22 17:03:35 BST
Here's what we get with pysvp64asm:

.long 0x05400000; .long 0x13E00032 # sv.maddedu 31,0,0,0 # sv.maddedu 31,0,0,0
.long 0x05400000; .long 0x101F0032 # sv.maddedu 0,31,0,0 # sv.maddedu 0,31,0,0
.long 0x05400000; .long 0x1000F832 # sv.maddedu 0,0,31,0 # sv.maddedu 0,0,31,0
.long 0x05400000; .long 0x100007F2 # sv.maddedu 0,0,0,31 # sv.maddedu 0,0,0,31
.long 0x05400000; .long 0x13E00034 # sv.divmod2du 31,0,0,0 # sv.divmod2du 31,0,0,0
.long 0x05400000; .long 0x101F0034 # sv.divmod2du 0,31,0,0 # sv.divmod2du 0,31,0,0
.long 0x05400000; .long 0x1000F834 # sv.divmod2du 0,0,31,0 # sv.divmod2du 0,0,31,0
.long 0x05400000; .long 0x100007F4 # sv.divmod2du 0,0,0,31 # sv.divmod2du 0,0,0,31
Comment 3 Dmitry Selyutin 2022-10-22 17:10:46 BST
Comments above state what applies to divmod2du before it's been moved to XO=58. Stay tuned.
Comment 4 Dmitry Selyutin 2022-10-22 17:26:08 BST
New output, after the update:

   0:   00 00 40 05     sv.maddedu r31,r0,r0,r0
   4:   32 00 e0 13 
   8:   00 00 40 05     sv.maddedu r0,r31,r0,r0
   c:   32 00 1f 10 
  10:   00 00 40 05     sv.maddedu r0,r0,r31,r0
  14:   32 f8 00 10 
  18:   00 00 40 05     sv.maddedu r0,r0,r0,r31
  1c:   f2 07 00 10 
  20:   00 00 40 05     sv.divmod2du r31,r0,r0,r0
  24:   3a 00 e0 13 
  28:   00 00 40 05     sv.divmod2du r0,r31,r0,r0
  2c:   3a 00 1f 10 
  30:   00 00 40 05     sv.divmod2du r0,r0,r31,r0
  34:   3a f8 00 10 
  38:   00 00 40 05     sv.divmod2du r0,r0,r0,r31
  3c:   fa 07 00 10
Comment 5 Dmitry Selyutin 2023-01-14 10:10:06 GMT
It seems we've forgotten to allocate the budget here. Is EUR 500 OK?
Comment 6 Dmitry Selyutin 2023-01-16 21:37:00 GMT
https://bugs.libre-soc.org/show_bug.cgi?id=964#c5
I've updated the budgets for this task and its parent. Please let me know if you have objections.