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

Commit cc67e7c

Browse files
committed
Rounding Average instructions
1 parent 7abe171 commit cc67e7c

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

proposals/simd/BinarySIMD.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,5 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
189189
| `i64x2.load32x2_s` | `0xd6`| m:memarg |
190190
| `i64x2.load32x2_u` | `0xd7`| m:memarg |
191191
| `v128.andnot` | `0xd8`| - |
192+
| `i8x16.avgr_u` | `0xd9`| |
193+
| `i16x8.avgr_u` | `0xda`| |

proposals/simd/ImplementationStatus.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
| `i8x16.sub` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
8888
| `i8x16.sub_saturate_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
8989
| `i8x16.sub_saturate_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
90+
| `i8x16.avgr_u` | | | | |
9091
| `i16x8.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
9192
| `i16x8.any_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
9293
| `i16x8.all_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
@@ -100,6 +101,7 @@
100101
| `i16x8.sub_saturate_s` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
101102
| `i16x8.sub_saturate_u` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
102103
| `i16x8.mul` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
104+
| `i16x8.avgr_u` | | | | |
103105
| `i32x4.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
104106
| `i32x4.any_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
105107
| `i32x4.all_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |

proposals/simd/SIMD.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,20 @@ def S.sub_saturate_u(a, b):
457457
return S.lanewise_binary(subsat, S.AsUnsigned(a), S.AsUnsigned(b))
458458
```
459459

460+
### Integer rounding average
461+
* `i8x16.avgr_u(a: v128, b: v128) -> v128`
462+
* `i16x8.avgr_u(a: v128, b: v128) -> v128`
463+
464+
Lane-wise rounding average:
465+
466+
```python
467+
def S.RoundingAverage(x, y):
468+
return (x + y + 1) // 2
469+
470+
def S.avgr_u(a, b):
471+
return S.lanewise_binary(S.RoundingAverage, S.AsUnsigned(a), S.AsUnsigned(b))
472+
```
473+
460474
## Bit shifts
461475

462476
### Left shift by scalar

0 commit comments

Comments
 (0)