Bug 608

Summary: Add JavaScript ToInt32 instruction (f64 -> i32 with wrapping)
Product: Libre-SOC's first SoC Reporter: Jacob Lifshay <programmerjake>
Component: SpecificationAssignee: Luke Kenneth Casson Leighton <lkcl>
Status: CONFIRMED ---    
Severity: enhancement CC: libre-soc-isa
Priority: ---    
Version: unspecified   
Hardware: Other   
OS: Linux   
NLnet milestone: --- total budget (EUR) for completion of task and all subtasks: 0
budget (EUR) for this task, excluding subtasks' budget: 0 parent task for budget allocation:
child tasks for budget allocation: The table of payments (in EUR) for this task; TOML format:
Attachments: example implementation in C

Description Jacob Lifshay 2021-03-02 20:10:10 GMT
Created attachment 127 [details]
example implementation in C

Arm v8.3A added an instruction for accelerating JavaScript's ToInt32 operation. OpenPower could also benefit from adding something like that too, since the required operation can be easily implemented in hardware but there isn't any existing instruction sequence that can as efficiently implement that in software, since the existing instructions all saturate (iirc) instead of wrapping.

http://lists.libre-soc.org/pipermail/libre-soc-dev/2021-March/002055.html
http://lists.libre-soc.org/pipermail/libre-soc-dev/2021-March/002064.html

Example implementation in C:
https://gcc.godbolt.org/z/4KPxxh