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

Commit 7e5d706

Browse files
committed
Sign Select instructions
1 parent 7abe171 commit 7e5d706

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

proposals/simd/BinarySIMD.md

+4
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,7 @@ 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+
| `v8x16.signselect` | `0xd9`| |
193+
| `v16x8.signselect` | `0xda`| |
194+
| `v32x4.signselect` | `0xdb`| |
195+
| `v64x2.signselect` | `0xdc`| |

proposals/simd/ImplementationStatus.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
| Instruction | LLVM[1] | V8[2] | WAVM[3] | ChakraCore[4] |
23
| ---------------------------|---------------------------|-----------------------|--------------------|--------------------|
34
| `v128.load` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
@@ -75,6 +76,10 @@
7576
| `v128.or` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
7677
| `v128.xor` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
7778
| `v128.bitselect` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
79+
| `v8x16.signselect` | | | | |
80+
| `v16x8.signselect` | | | | |
81+
| `v32x4.signselect` | | | | |
82+
| `v64x2.signselect` | | | | |
7883
| `i8x16.neg` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
7984
| `i8x16.any_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
8085
| `i8x16.all_true` | `-msimd128` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |

proposals/simd/SIMD.md

+11
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,17 @@ Note that the normal WebAssembly `select` instruction also works with vector
539539
types. It selects between two whole vectors controlled by a single scalar value,
540540
rather than selecting bits controlled by a control mask vector.
541541

542+
### Sign select
543+
* `v8x16.signselect(v1: v128, v2: v128, c: v128) -> v128`
544+
* `v16x8.signselect(v1: v128, v2: v128, c: v128) -> v128`
545+
* `v32x4.signselect(v1: v128, v2: v128, c: v128) -> v128`
546+
* `v64x2.signselect(v1: v128, v2: v128, c: v128) -> v128`
547+
548+
Use the sign bits in the control mask `c` to select the corresponding element
549+
from `v1` when 1 (negative sign) and `v2` when 0 (positive sign).
550+
551+
Note that these instructions work for both signed integer and floating-point
552+
control masks.
542553

543554
## Boolean horizontal reductions
544555

0 commit comments

Comments
 (0)