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 Jan 14, 2020
1 parent 4819d61 commit d4e1f89
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 @@ -203,3 +203,6 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
| `v128.andnot` | `0xd8`| - |
| `i8x16.avgr_u` | `0xd9`| |
| `i16x8.avgr_u` | `0xda`| |
| `i8x16.abs` | `0xe1`| - |
| `i16x8.abs` | `0xe2`| - |
| `i32x4.abs` | `0xe3`| - |
3 changes: 3 additions & 0 deletions proposals/simd/ImplementationStatus.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
| `i8x16.max_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
| `i8x16.max_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
| `i8x16.avgr_u` | `-munimplemented-simd128` | | :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 @@ -110,6 +111,7 @@
| `i16x8.max_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
| `i16x8.max_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
| `i16x8.avgr_u` | `-munimplemented-simd128` | | :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 @@ -123,6 +125,7 @@
| `i32x4.min_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
| `i32x4.max_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
| `i32x4.max_u` | `-msimd128` | :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 @@ -503,6 +503,18 @@ def S.avgr_u(a, b):
return S.lanewise_binary(S.RoundingAverage, S.AsUnsigned(a), S.AsUnsigned(b))
```

### Lane-wise 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 @@ -791,7 +803,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 d4e1f89

Please sign in to comment.