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

Commit

Permalink
Integer absolute value instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Maratyszcza committed Oct 28, 2019
1 parent 7abe171 commit 9412e76
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions proposals/simd/BinarySIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
| `i8x16.sub` | `0x5a`| - |
| `i8x16.sub_saturate_s` | `0x5b`| - |
| `i8x16.sub_saturate_u` | `0x5c`| - |
| `i8x16.abs` | `0x5d`| - |
| `i16x8.neg` | `0x62`| - |
| `i16x8.any_true` | `0x63`| - |
| `i16x8.all_true` | `0x64`| - |
Expand All @@ -122,6 +123,7 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
| `i16x8.sub_saturate_s` | `0x6c`| - |
| `i16x8.sub_saturate_u` | `0x6d`| - |
| `i16x8.mul` | `0x6e`| - |
| `i16x8.abs` | `0x6f`| - |
| `i32x4.neg` | `0x73`| - |
| `i32x4.any_true` | `0x74`| - |
| `i32x4.all_true` | `0x75`| - |
Expand All @@ -131,6 +133,7 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
| `i32x4.add` | `0x79`| - |
| `i32x4.sub` | `0x7c`| - |
| `i32x4.mul` | `0x7f`| - |
| `i32x4.abs` | `0x80`| - |
| `i64x2.neg` | `0x84`| - |
| `i64x2.shl` | `0x87`| - |
| `i64x2.shr_s` | `0x88`| - |
Expand Down
3 changes: 3 additions & 0 deletions proposals/simd/ImplementationStatus.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
| `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.abs` | | | | |
| `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 +101,7 @@
| `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.abs` | | | | |
| `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 +111,7 @@
| `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.abs` | | | | |
| `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
14 changes: 13 additions & 1 deletion proposals/simd/SIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,18 @@ def S.sub_saturate_u(a, b):
return S.lanewise_binary(subsat, S.AsUnsigned(a), S.AsUnsigned(b))
```

### Integer absolute value
* `i8x16.abs(a: v128) -> v128`
* `i16x8.abs(a: v128) -> v128`
* `i32x4.abs(a: v128) -> v128`

Lane-wise wrapping absolute value.

```python
def S.abs(a):
return S.lanewise_unary(abs, S.AsSigned(a))
```

## Bit shifts

### Left shift by scalar
Expand Down Expand Up @@ -714,7 +726,7 @@ def S.neg(a):
return S.lanewise_unary(ieee.negate, a)
```

### Absolute value
### Floating-point absolute value
* `f32x4.abs(a: v128) -> v128`
* `f64x2.abs(a: v128) -> v128`

Expand Down

0 comments on commit 9412e76

Please sign in to comment.