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

Commit 6965e62

Browse files
committed
Sign Select instructions
1 parent 3d8c870 commit 6965e62

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

proposals/simd/BinarySIMD.md

+4
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,7 @@ For example, `ImmLaneIdx16` is a byte with values in the range 0-15 (inclusive).
252252
| `i64x2.eq` | `TBD`| - |
253253
| `i64x2.ne` | `TBD`| - |
254254
| `i64x2.all_true` | `TBD`| - |
255+
| `v8x16.signselect` | `TBD`| - |
256+
| `v16x8.signselect` | `TBD`| - |
257+
| `v32x4.signselect` | `TBD`| - |
258+
| `v64x2.signselect` | `TBD`| - |

proposals/simd/ImplementationStatus.md

+4
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@
220220
| `v128.store32_lane` | | | | | |
221221
| `v128.store64_lane` | | | | | |
222222
| `i64x2.ne` | | | | | |
223+
| `v8x16.signselect` | | | | | |
224+
| `v16x8.signselect` | | | | | |
225+
| `v32x4.signselect` | | | | | |
226+
| `v64x2.signselect` | | | | | |
223227

224228
[1] Tip of tree LLVM as of May 20, 2020
225229

proposals/simd/SIMD.md

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

665+
### Sign select
666+
* `v8x16.signselect(v1: v128, v2: v128, c: v128) -> v128`
667+
* `v16x8.signselect(v1: v128, v2: v128, c: v128) -> v128`
668+
* `v32x4.signselect(v1: v128, v2: v128, c: v128) -> v128`
669+
* `v64x2.signselect(v1: v128, v2: v128, c: v128) -> v128`
670+
671+
Use the sign bits in the control mask `c` to select the corresponding element
672+
from `v1` when 1 (negative sign) and `v2` when 0 (positive sign).
673+
674+
Note that these instructions work for both signed integer and floating-point
675+
control masks.
665676

666677
## Boolean horizontal reductions
667678

0 commit comments

Comments
 (0)