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

Commit e9d8eb3

Browse files
committed
Sign Select instructions
1 parent c0a5dde commit e9d8eb3

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

proposals/simd/BinarySIMD.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,7 @@ For example, `ImmLaneIdx16` is a byte with values in the range 0-15 (inclusive).
241241
| `i64x2.extmul_high_i32x4_u` | `0x11b`| - |
242242
| `i16x8.q15mulr_sat_s` | `TBD`| - |
243243
| `v128.any_true` | `TBD`| - |
244+
| `v8x16.signselect` | `TBD`| - |
245+
| `v16x8.signselect` | `TBD`| - |
246+
| `v32x4.signselect` | `TBD`| - |
247+
| `v64x2.signselect` | `TBD`| - |

proposals/simd/ImplementationStatus.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@
209209
| `i64x2.extmul_low_i32x4_u` | | | | | |
210210
| `i64x2.extmul_high_i32x4_u` | | | | | |
211211
| `v128.any_true` | | | | | |
212+
| `v8x16.signselect` | | | | | |
213+
| `v16x8.signselect` | | | | | |
214+
| `v32x4.signselect` | | | | | |
215+
| `v64x2.signselect` | | | | | |
212216

213217
[1] Tip of tree LLVM as of May 20, 2020
214218

proposals/simd/SIMD.md

Lines changed: 11 additions & 0 deletions
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)