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

Commit

Permalink
Sign Select instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Maratyszcza committed Oct 28, 2019
1 parent 7abe171 commit 7e5d706
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proposals/simd/BinarySIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,7 @@ The `v8x16.shuffle` instruction has 16 bytes after `simdop`.
| `i64x2.load32x2_s` | `0xd6`| m:memarg |
| `i64x2.load32x2_u` | `0xd7`| m:memarg |
| `v128.andnot` | `0xd8`| - |
| `v8x16.signselect` | `0xd9`| |
| `v16x8.signselect` | `0xda`| |
| `v32x4.signselect` | `0xdb`| |
| `v64x2.signselect` | `0xdc`| |
5 changes: 5 additions & 0 deletions proposals/simd/ImplementationStatus.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
| Instruction | LLVM[1] | V8[2] | WAVM[3] | ChakraCore[4] |
| ---------------------------|---------------------------|-----------------------|--------------------|--------------------|
| `v128.load` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Expand Down Expand Up @@ -75,6 +76,10 @@
| `v128.or` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `v128.xor` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `v128.bitselect` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `v8x16.signselect` | | | | |
| `v16x8.signselect` | | | | |
| `v32x4.signselect` | | | | |
| `v64x2.signselect` | | | | |
| `i8x16.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i8x16.any_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| `i8x16.all_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Expand Down
11 changes: 11 additions & 0 deletions proposals/simd/SIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,17 @@ Note that the normal WebAssembly `select` instruction also works with vector
types. It selects between two whole vectors controlled by a single scalar value,
rather than selecting bits controlled by a control mask vector.

### Sign select
* `v8x16.signselect(v1: v128, v2: v128, c: v128) -> v128`
* `v16x8.signselect(v1: v128, v2: v128, c: v128) -> v128`
* `v32x4.signselect(v1: v128, v2: v128, c: v128) -> v128`
* `v64x2.signselect(v1: v128, v2: v128, c: v128) -> v128`

Use the sign bits in the control mask `c` to select the corresponding element
from `v1` when 1 (negative sign) and `v2` when 0 (positive sign).

Note that these instructions work for both signed integer and floating-point
control masks.

## Boolean horizontal reductions

Expand Down

0 comments on commit 7e5d706

Please sign in to comment.