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

Commit de9189d

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

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
@@ -183,6 +183,14 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
183183
| `i64x2.add` | `0xce`| - |
184184
| `i64x2.sub` | `0xd1`| - |
185185
| `i64x2.mul` | `0xd5`| - |
186+
| `f32x4.nearest` | `0xd8`| - |
187+
| `f32x4.trunc` | `0xd9`| - |
188+
| `f32x4.ceil` | `0xda`| - |
189+
| `f32x4.floor` | `0xdb`| - |
190+
| `f64x2.nearest` | `0xdc`| - |
191+
| `f64x2.trunc` | `0xdd`| - |
192+
| `f64x2.ceil` | `0xde`| - |
193+
| `f64x2.floor` | `0xdf`| - |
186194
| `f32x4.abs` | `0xe0`| - |
187195
| `f32x4.neg` | `0xe1`| - |
188196
| `f32x4.sqrt` | `0xe3`| - |

proposals/simd/ImplementationStatus.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@
165165
| `f32x4.div` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
166166
| `f32x4.min` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
167167
| `f32x4.max` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
168+
| `f32x4.nearest` | | | | | |
169+
| `f32x4.trunc` | | | | | |
170+
| `f32x4.ceil` | | | | | |
171+
| `f32x4.floor` | | | | | |
168172
| `f64x2.abs` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
169173
| `f64x2.neg` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
170174
| `f64x2.sqrt` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
@@ -174,6 +178,10 @@
174178
| `f64x2.div` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
175179
| `f64x2.min` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
176180
| `f64x2.max` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
181+
| `f64x2.nearest` | | | | | |
182+
| `f64x2.trunc` | | | | | |
183+
| `f64x2.ceil` | | | | | |
184+
| `f64x2.floor` | | | | | |
177185
| `i32x4.trunc_sat_f32x4_s` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
178186
| `i32x4.trunc_sat_f32x4_u` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
179187
| `f32x4.convert_i32x4_s` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |

proposals/simd/SIMD.md

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

901901
Lane-wise IEEE `squareRoot`.
902902

903+
### Round to nearest integer, ties to even
904+
* `f32x4.nearest(a: v128) -> v128`
905+
* `f64x2.nearest(a: v128) -> v128`
906+
907+
Lane-wise rounding to the nearest integral value; if two values are equally near, rounds to the even one.
908+
909+
### Round to integer toward zero (truncate to integer)
910+
* `f32x4.trunc(a: v128) -> v128`
911+
* `f64x2.trunc(a: v128) -> v128`
912+
913+
Lane-wise rounding to the nearest integral value with the magniture not larger than the input.
914+
915+
### Round to integer above (ceiling)
916+
* `f32x4.ceil(a: v128) -> v128`
917+
* `f64x2.ceil(a: v128) -> v128`
918+
919+
Lane-wise rounding to the nearest integral value not smaller than the input.
920+
921+
### Round to integer below (floor)
922+
* `f32x4.floor(a: v128) -> v128`
923+
* `f64x2.floor(a: v128) -> v128`
924+
925+
Lane-wise rounding to the nearest integral value not greater than the input.
926+
903927
## Conversions
904928
### Integer to floating point
905929
* `f32x4.convert_i32x4_s(a: v128) -> v128`

0 commit comments

Comments
 (0)