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

Commit d254eea

Browse files
Maratyszczadtig
authored andcommitted
Rounding Average instructions (#126)
1 parent 670d94a commit d254eea

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

proposals/simd/BinarySIMD.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,5 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
201201
| `i64x2.load32x2_s` | `0xd6`| m:memarg |
202202
| `i64x2.load32x2_u` | `0xd7`| m:memarg |
203203
| `v128.andnot` | `0xd8`| - |
204+
| `i8x16.avgr_u` | `0xd9`| |
205+
| `i16x8.avgr_u` | `0xda`| |

proposals/simd/ImplementationStatus.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
| `i8x16.min_u` | `-munimplemented-simd128` | :heavy_check_mark: | | |
9292
| `i8x16.max_s` | `-munimplemented-simd128` | :heavy_check_mark: | | |
9393
| `i8x16.max_u` | `-munimplemented-simd128` | :heavy_check_mark: | | |
94+
| `i8x16.avgr_u` | | | | |
9495
| `i16x8.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
9596
| `i16x8.any_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
9697
| `i16x8.all_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
@@ -108,6 +109,7 @@
108109
| `i16x8.min_u` | `-munimplemented-simd128` | :heavy_check_mark: | | |
109110
| `i16x8.max_s` | `-munimplemented-simd128` | :heavy_check_mark: | | |
110111
| `i16x8.max_u` | `-munimplemented-simd128` | :heavy_check_mark: | | |
112+
| `i16x8.avgr_u` | | | | |
111113
| `i32x4.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
112114
| `i32x4.any_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
113115
| `i32x4.all_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |

proposals/simd/SIMD.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,21 @@ each pair.
488488
def S.max(a, b):
489489
return S.lanewise_binary(max, a, b)
490490
```
491+
492+
### Lane-wise integer rounding average
493+
* `i8x16.avgr_u(a: v128, b: v128) -> v128`
494+
* `i16x8.avgr_u(a: v128, b: v128) -> v128`
495+
496+
Lane-wise rounding average:
497+
498+
```python
499+
def S.RoundingAverage(x, y):
500+
return (x + y + 1) // 2
501+
502+
def S.avgr_u(a, b):
503+
return S.lanewise_binary(S.RoundingAverage, S.AsUnsigned(a), S.AsUnsigned(b))
504+
```
505+
491506
## Bit shifts
492507

493508
### Left shift by scalar

0 commit comments

Comments
 (0)