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

Introduce unsigned narrowing with signed inputs #95

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions proposals/simd/BinarySIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,16 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
| `i32x4.load_splat` | `0xc4`| - |
| `i64x2.load_splat` | `0xc5`| - |
| `i8x16.narrow_i16x8_s` | `0xc6`| - |
| `i8x16.narrow_i16x8_u` | `0xc7`| - |
| `i16x8.narrow_i32x4_s` | `0xc8`| - |
| `i16x8.narrow_i32x4_u` | `0xc9`| - |
| `i16x8.widen_low_i8x16_s` | `0xca`| - |
| `i16x8.widen_high_i8x16_s` | `0xcb`| - |
| `i16x8.widen_low_i8x16_u` | `0xcc`| - |
| `i16x8.widen_high_i8x16_u` | `0xcd`| - |
| `i32x4.widen_low_i16x8_s` | `0xce`| - |
| `i32x4.widen_high_i16x8_s` | `0xcf`| - |
| `i32x4.widen_low_i16x8_u` | `0xd0`| - |
| `i32x4.widen_high_i16x8_u` | `0xd1`| - |
| `i8x16.narrow_u16x8_u` | `0xc7`| - |
| `i8x16.narrow_i16x8_u` | `0xc8`| - |
| `i16x8.narrow_i32x4_s` | `0xc9`| - |
| `i16x8.narrow_u32x4_u` | `0xca`| - |
| `i16x8.narrow_i32x4_u` | `0xcb`| - |
| `i16x8.widen_low_i8x16_s` | `0xcc`| - |
| `i16x8.widen_high_i8x16_s` | `0xcd`| - |
| `i16x8.widen_low_i8x16_u` | `0xce`| - |
| `i16x8.widen_high_i8x16_u` | `0xcf`| - |
| `i32x4.widen_low_i16x8_s` | `0xd0`| - |
| `i32x4.widen_high_i16x8_s` | `0xd1`| - |
| `i32x4.widen_low_i16x8_u` | `0xd2`| - |
| `i32x4.widen_high_i16x8_u` | `0xd3`| - |
6 changes: 4 additions & 2 deletions proposals/simd/ImplementationStatus.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@
| `v8x16.swizzle` | | | :heavy_check_mark: | |
| `v8x16.shuffle` | | | :heavy_check_mark: | :heavy_check_mark: |
| `i8x16.narrow_i16x8_s` | | :heavy_check_mark: | :heavy_check_mark: | |
| `i8x16.narrow_i16x8_u` | | :heavy_check_mark: | :heavy_check_mark: | |
| `i8x16.narrow_u16x8_u` | | :heavy_check_mark: | :heavy_check_mark: | |
| `i8x16.narrow_i16x8_u` | | | | |
| `i16x8.narrow_i32x4_s` | | :heavy_check_mark: | :heavy_check_mark: | |
| `i16x8.narrow_i32x4_u` | | :heavy_check_mark: | :heavy_check_mark: | |
| `i16x8.narrow_u32x4_u` | | :heavy_check_mark: | :heavy_check_mark: | |
| `i16x8.narrow_i32x4_u` | | | | |
| `i16x8.widen_low_i8x16_s` | | :heavy_check_mark: | :heavy_check_mark: | |
| `i16x8.widen_high_i8x16_s` | | :heavy_check_mark: | :heavy_check_mark: | |
| `i16x8.widen_low_i8x16_u` | | :heavy_check_mark: | :heavy_check_mark: | |
Expand Down
10 changes: 7 additions & 3 deletions proposals/simd/SIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -788,13 +788,17 @@ representable integer value.
### Integer to integer narrowing
* `i8x16.narrow_i16x8_s(a: v128, b: v128) -> v128`
* `i8x16.narrow_i16x8_u(a: v128, b: v128) -> v128`
* `i8x16.narrow_u16x8_u(a: v128, b: v128) -> v128`
* `i16x8.narrow_i32x4_s(a: v128, b: v128) -> v128`
* `i16x8.narrow_i32x4_u(a: v128, b: v128) -> v128`
* `i16x8.narrow_u32x4_u(a: v128, b: v128) -> v128`

Converts two input vectors into a smaller lane vector by narrowing each lane,
signed or unsigned. The signed narrowing operation will use signed saturation
to handle overflow, 0x7f or 0x80 for i8x16, the unsigned narrowing operation
will use unsigned saturation to handle overflow, 0x00 or 0xff for i8x16.
signed or unsigned, the latter with either signed or unsigned inputs
(`narrow_i..` and `narrow_u..`, respectively). The signed narrowing operation
will use signed saturation to handle overflow, 0x7f or 0x80 for i8x16, the
unsigned narrowing operation will use unsigned saturation to handle overflow,
0x00 or 0xff for i8x16.

### Integer to integer widening
* `i16x8.widen_low_i8x16_s(a: v128) -> v128`
Expand Down