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

Commit 15223e7

Browse files
committed
Sign Select instructions
1 parent 20e914b commit 15223e7

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
@@ -237,3 +237,7 @@ For example, `ImmLaneIdx16` is a byte with values in the range 0-15 (inclusive).
237237
| `i64x2.extmul_high_i32x4_s` | `0x119`| - |
238238
| `i64x2.extmul_low_i32x4_u` | `0x11a`| - |
239239
| `i64x2.extmul_high_i32x4_u` | `0x11b`| - |
240+
| `v8x16.signselect` | `0xfd7d`| - |
241+
| `v16x8.signselect` | `0xfd7e`| - |
242+
| `v32x4.signselect` | `0xfd7f`| - |
243+
| `v64x2.signselect` | `0xfd94`| - |

proposals/simd/ImplementationStatus.md

+4
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@
205205
| `i64x2.extmul_high_i32x4_s` | | | | | |
206206
| `i64x2.extmul_low_i32x4_u` | | | | | |
207207
| `i64x2.extmul_high_i32x4_u` | | | | | |
208+
| `v8x16.signselect` | | | | | |
209+
| `v16x8.signselect` | | | | | |
210+
| `v32x4.signselect` | | | | | |
211+
| `v64x2.signselect` | | | | | |
208212

209213
[1] Tip of tree LLVM as of May 20, 2020
210214

proposals/simd/SIMD.md

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

652+
### Sign select
653+
* `v8x16.signselect(v1: v128, v2: v128, c: v128) -> v128`
654+
* `v16x8.signselect(v1: v128, v2: v128, c: v128) -> v128`
655+
* `v32x4.signselect(v1: v128, v2: v128, c: v128) -> v128`
656+
* `v64x2.signselect(v1: v128, v2: v128, c: v128) -> v128`
657+
658+
Use the sign bits in the control mask `c` to select the corresponding element
659+
from `v1` when 1 (negative sign) and `v2` when 0 (positive sign).
660+
661+
Note that these instructions work for both signed integer and floating-point
662+
control masks.
652663

653664
## Boolean horizontal reductions
654665

0 commit comments

Comments
 (0)