Bug 608 - Add JavaScript ToInt32 instruction (f64 -> i32 with wrapping)
Summary: Add JavaScript ToInt32 instruction (f64 -> i32 with wrapping)
Status: CONFIRMED
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: Specification (show other bugs)
Version: unspecified
Hardware: Other Linux
: --- enhancement
Assignee: Luke Kenneth Casson Leighton
URL:
Depends on:
Blocks:
 
Reported: 2021-03-02 20:10 GMT by Jacob Lifshay
Modified: 2021-03-02 20:10 GMT (History)
1 user (show)

See Also:
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 (2.88 KB, text/plain)
2021-03-02 20:10 GMT, Jacob Lifshay
Details

Note You need to log in before you can comment on or make changes to this bug.
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