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

Commit be76ffd

Browse files
committed
Sign Select instructions
1 parent b6ca6b2 commit be76ffd

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

proposals/simd/BinarySIMD.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,8 @@ For example, `ImmLaneIdx16` is a byte with values in the range 0-15 (inclusive).
262262
| `i16x8.extadd_pairwise_i8x16_s` | `TBD`| - |
263263
| `i16x8.extadd_pairwise_i8x16_u` | `TBD`| - |
264264
| `i32x4.extadd_pairwise_i16x8_s` | `TBD`| - |
265-
| `i32x4.extadd_pairwise_i16x8_u` | `TBD`| - |
265+
| `i32x4.extadd_pairwise_i16x8_u` | `TBD`| - |
266+
| `v8x16.signselect` | `TBD`| - |
267+
| `v16x8.signselect` | `TBD`| - |
268+
| `v32x4.signselect` | `TBD`| - |
269+
| `v64x2.signselect` | `TBD`| - |

proposals/simd/ImplementationStatus.md

+4
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@
231231
| `i16x8.extadd_pairwise_i8x16_u` | | | | | |
232232
| `i32x4.extadd_pairwise_i16x8_s` | | | | | |
233233
| `i32x4.extadd_pairwise_i16x8_u` | | | | | |
234+
| `v8x16.signselect` | | | | | |
235+
| `v16x8.signselect` | | | | | |
236+
| `v32x4.signselect` | | | | | |
237+
| `v64x2.signselect` | | | | | |
234238

235239
[1] Tip of tree LLVM as of May 20, 2020
236240

proposals/simd/SIMD.md

+12
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,18 @@ Note that the normal WebAssembly `select` instruction also works with vector
683683
types. It selects between two whole vectors controlled by a single scalar value,
684684
rather than selecting bits controlled by a control mask vector.
685685

686+
### Sign select
687+
* `v8x16.signselect(v1: v128, v2: v128, c: v128) -> v128`
688+
* `v16x8.signselect(v1: v128, v2: v128, c: v128) -> v128`
689+
* `v32x4.signselect(v1: v128, v2: v128, c: v128) -> v128`
690+
* `v64x2.signselect(v1: v128, v2: v128, c: v128) -> v128`
691+
692+
Use the sign bits in the control mask `c` to select the corresponding element
693+
from `v1` when 1 (negative sign) and `v2` when 0 (positive sign).
694+
695+
Note that these instructions work for both signed integer and floating-point
696+
control masks.
697+
686698
### Lane-wise Population Count
687699
* `i8x16.popcnt(v: v128) -> v128`
688700

0 commit comments

Comments
 (0)