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

Commit e261fdd

Browse files
committed
Integer absolute value instructions
1 parent ce49397 commit e261fdd

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

proposals/simd/BinarySIMD.md

+3
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,6 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
199199
| `v128.andnot` | `0xd8`| - |
200200
| `i8x16.avgr_u` | `0xd9`| |
201201
| `i16x8.avgr_u` | `0xda`| |
202+
| `i8x16.abs` | `0xe1`| - |
203+
| `i16x8.abs` | `0xe2`| - |
204+
| `i32x4.abs` | `0xe3`| - |

proposals/simd/ImplementationStatus.md

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
| `i8x16.max_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
9393
| `i8x16.max_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
9494
| `i8x16.avgr_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
95+
| `i8x16.abs` | | | | |
9596
| `i16x8.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
9697
| `i16x8.any_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
9798
| `i16x8.all_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
@@ -110,6 +111,7 @@
110111
| `i16x8.max_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
111112
| `i16x8.max_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
112113
| `i16x8.avgr_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
114+
| `i16x8.abs` | | | | |
113115
| `i32x4.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
114116
| `i32x4.any_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
115117
| `i32x4.all_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
@@ -123,6 +125,7 @@
123125
| `i32x4.min_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
124126
| `i32x4.max_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
125127
| `i32x4.max_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | |
128+
| `i32x4.abs` | | | | |
126129
| `i64x2.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
127130
| `i64x2.shl` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
128131
| `i64x2.shr_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |

proposals/simd/SIMD.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,18 @@ def S.avgr_u(a, b):
503503
return S.lanewise_binary(S.RoundingAverage, S.AsUnsigned(a), S.AsUnsigned(b))
504504
```
505505

506+
### Lane-wise integer absolute value
507+
* `i8x16.abs(a: v128) -> v128`
508+
* `i16x8.abs(a: v128) -> v128`
509+
* `i32x4.abs(a: v128) -> v128`
510+
511+
Lane-wise wrapping absolute value.
512+
513+
```python
514+
def S.abs(a):
515+
return S.lanewise_unary(abs, S.AsSigned(a))
516+
```
517+
506518
## Bit shifts
507519

508520
### Left shift by scalar
@@ -791,7 +803,7 @@ def S.neg(a):
791803
return S.lanewise_unary(ieee.negate, a)
792804
```
793805

794-
### Absolute value
806+
### Floating-point absolute value
795807
* `f32x4.abs(a: v128) -> v128`
796808
* `f64x2.abs(a: v128) -> v128`
797809

0 commit comments

Comments
 (0)