Skip to content

Commit

Permalink
Update proposal to include Integer Min/Max Ops (WebAssembly#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtig authored Nov 18, 2019
1 parent 7437ebb commit 6704ea8
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
12 changes: 12 additions & 0 deletions proposals/simd/BinarySIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
| `i8x16.sub` | `0x5a`| - |
| `i8x16.sub_saturate_s` | `0x5b`| - |
| `i8x16.sub_saturate_u` | `0x5c`| - |
| `i8x16.min_s` | `0x5e`| - |
| `i8x16.min_u` | `0x5f`| - |
| `i8x16.max_s` | `0x60`| - |
| `i8x16.max_u` | `0x61`| - |
| `i16x8.neg` | `0x62`| - |
| `i16x8.any_true` | `0x63`| - |
| `i16x8.all_true` | `0x64`| - |
Expand All @@ -122,6 +126,10 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
| `i16x8.sub_saturate_s` | `0x6c`| - |
| `i16x8.sub_saturate_u` | `0x6d`| - |
| `i16x8.mul` | `0x6e`| - |
| `i16x8.min_s` | `0x6f`| - |
| `i16x8.min_u` | `0x70`| - |
| `i16x8.max_s` | `0x71`| - |
| `i16x8.max_u` | `0x72`| - |
| `i32x4.neg` | `0x73`| - |
| `i32x4.any_true` | `0x74`| - |
| `i32x4.all_true` | `0x75`| - |
Expand All @@ -131,6 +139,10 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
| `i32x4.add` | `0x79`| - |
| `i32x4.sub` | `0x7c`| - |
| `i32x4.mul` | `0x7f`| - |
| `i32x4.min_s` | `0x80`| - |
| `i32x4.min_u` | `0x81`| - |
| `i32x4.max_s` | `0x82`| - |
| `i32x4.max_u` | `0x83`| - |
| `i64x2.neg` | `0x84`| - |
| `i64x2.shl` | `0x87`| - |
| `i64x2.shr_s` | `0x88`| - |
Expand Down
12 changes: 12 additions & 0 deletions proposals/simd/ImplementationStatus.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
| `i8x16.sub` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i8x16.sub_saturate_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i8x16.sub_saturate_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i8x16.min_s` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i8x16.min_u` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i8x16.max_s` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i8x16.max_u` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i16x8.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i16x8.any_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i16x8.all_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Expand All @@ -100,6 +104,10 @@
| `i16x8.sub_saturate_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i16x8.sub_saturate_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i16x8.mul` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i16x8.min_s` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i16x8.min_u` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i16x8.max_s` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i16x8.max_u` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i32x4.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i32x4.any_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i32x4.all_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Expand All @@ -109,6 +117,10 @@
| `i32x4.add` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i32x4.sub` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i32x4.mul` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i32x4.min_s` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i32x4.min_u` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i32x4.max_s` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i32x4.max_u` | `-munimplemented-simd128` | :heavy_check_mark: | | |
| `i64x2.neg` | `-munimplemented-simd128` | | :heavy_check_mark: | :heavy_check_mark: |
| `i64x2.shl` | `-munimplemented-simd128` | | :heavy_check_mark: | :heavy_check_mark: |
| `i64x2.shr_s` | `-munimplemented-simd128` | | :heavy_check_mark: | :heavy_check_mark: |
Expand Down
31 changes: 31 additions & 0 deletions proposals/simd/SIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,37 @@ def S.sub_saturate_u(a, b):
return S.lanewise_binary(subsat, S.AsUnsigned(a), S.AsUnsigned(b))
```

### Lane-wise integer minimum
* `i8x16.min_s(a: v128, b: v128) -> v128`
* `i8x16.min_u(a: v128, b: v128) -> v128`
* `i16x8.min_s(a: v128, b: v128) -> v128`
* `i16x8.min_u(a: v128, b: v128) -> v128`
* `i32x4.min_s(a: v128, b: v128) -> v128`
* `i32x4.min_u(a: v128, b: v128) -> v128`

Compares lane-wise signed/unsigned integers, and returns the minimum of
each pair.

```python
def S.min(a, b):
return S.lanewise_binary(min, a, b)
```

### Lane-wise integer maximum
* `i8x16.max_s(a: v128, b: v128) -> v128`
* `i8x16.max_u(a: v128, b: v128) -> v128`
* `i16x8.max_s(a: v128, b: v128) -> v128`
* `i16x8.max_u(a: v128, b: v128) -> v128`
* `i32x4.max_s(a: v128, b: v128) -> v128`
* `i32x4.max_u(a: v128, b: v128) -> v128`

Compares lane-wise signed/unsigned integers, and returns the maximum of
each pair.

```python
def S.max(a, b):
return S.lanewise_binary(max, a, b)
```
## Bit shifts

### Left shift by scalar
Expand Down

0 comments on commit 6704ea8

Please sign in to comment.