Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit edf4a31

Browse files
committed
Floating-point rounding instructions
SIMD equivalents of the nearest/trunc/ceil/floor instructions
1 parent bbf08e4 commit edf4a31

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

proposals/simd/BinarySIMD.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,11 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
202202
| `i8x16.abs` | `0xe1`| - |
203203
| `i16x8.abs` | `0xe2`| - |
204204
| `i32x4.abs` | `0xe3`| - |
205+
| `f32x4.nearest` | `0xe4`| - |
206+
| `f32x4.trunc` | `0xe5`| - |
207+
| `f32x4.ceil` | `0xe6`| - |
208+
| `f32x4.floor` | `0xe7`| - |
209+
| `f64x2.nearest` | `0xe8`| - |
210+
| `f64x2.trunc` | `0xe9`| - |
211+
| `f64x2.ceil` | `0xea`| - |
212+
| `f64x2.floor` | `0xeb`| - |

proposals/simd/ImplementationStatus.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@
142142
| `f32x4.div` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
143143
| `f32x4.min` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
144144
| `f32x4.max` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
145+
| `f32x4.nearest` | | | | |
146+
| `f32x4.trunc` | | | | |
147+
| `f32x4.ceil` | | | | |
148+
| `f32x4.floor` | | | | |
145149
| `f64x2.abs` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
146150
| `f64x2.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
147151
| `f64x2.sqrt` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
@@ -151,6 +155,10 @@
151155
| `f64x2.div` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
152156
| `f64x2.min` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
153157
| `f64x2.max` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
158+
| `f64x2.nearest` | | | | |
159+
| `f64x2.trunc` | | | | |
160+
| `f64x2.ceil` | | | | |
161+
| `f64x2.floor` | | | | |
154162
| `i32x4.trunc_sat_f32x4_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
155163
| `i32x4.trunc_sat_f32x4_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
156164
| `f32x4.convert_i32x4_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |

proposals/simd/SIMD.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,30 @@ Lane-wise IEEE `multiplication`.
882882

883883
Lane-wise IEEE `squareRoot`.
884884

885+
### Round to nearest integer, ties to even
886+
* `f32x4.nearest(a: v128) -> v128`
887+
* `f64x2.nearest(a: v128) -> v128`
888+
889+
Lane-wise rounding to the nearest integral value; if two values are equally near, rounds to the even one.
890+
891+
### Round to integer toward zero (truncate to integer)
892+
* `f32x4.trunc(a: v128) -> v128`
893+
* `f64x2.trunc(a: v128) -> v128`
894+
895+
Lane-wise rounding to the nearest integral value with the magniture not larger than the input.
896+
897+
### Round to integer above (ceiling)
898+
* `f32x4.ceil(a: v128) -> v128`
899+
* `f64x2.ceil(a: v128) -> v128`
900+
901+
Lane-wise rounding to the nearest integral value not smaller than the input.
902+
903+
### Round to integer below (floor)
904+
* `f32x4.floor(a: v128) -> v128`
905+
* `f64x2.floor(a: v128) -> v128`
906+
907+
Lane-wise rounding to the nearest integral value not greater than the input.
908+
885909
## Conversions
886910
### Integer to floating point
887911
* `f32x4.convert_i32x4_s(a: v128) -> v128`

0 commit comments

Comments
 (0)