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

Commit 3d06a28

Browse files
committed
Sign Select instructions
1 parent 8551a32 commit 3d06a28

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
@@ -225,3 +225,7 @@ For example, `ImmLaneIdx16` is a byte with values in the range 0-15 (inclusive).
225225
| `f32x4.convert_i32x4_u` | `0xfb`| - |
226226
| `v128.load32_zero` | `0xfc`| - |
227227
| `v128.load64_zero` | `0xfd`| - |
228+
| `v8x16.signselect` | `0xfd7d`| - |
229+
| `v16x8.signselect` | `0xfd7e`| - |
230+
| `v32x4.signselect` | `0xfd7f`| - |
231+
| `v64x2.signselect` | `0xfd94`| - |

proposals/simd/ImplementationStatus.md

+4
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@
193193
| `f32x4.convert_i32x4_u` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
194194
| `v128.load32_zero` | | :heavy_check_mark: | | | :heavy_check_mark: |
195195
| `v128.load64_zero` | | :heavy_check_mark: | | | :heavy_check_mark: |
196+
| `v8x16.signselect` | | | | | |
197+
| `v16x8.signselect` | | | | | |
198+
| `v32x4.signselect` | | | | | |
199+
| `v64x2.signselect` | | | | | |
196200

197201
[1] Tip of tree LLVM as of May 20, 2020
198202

proposals/simd/SIMD.md

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

620+
### Sign select
621+
* `v8x16.signselect(v1: v128, v2: v128, c: v128) -> v128`
622+
* `v16x8.signselect(v1: v128, v2: v128, c: v128) -> v128`
623+
* `v32x4.signselect(v1: v128, v2: v128, c: v128) -> v128`
624+
* `v64x2.signselect(v1: v128, v2: v128, c: v128) -> v128`
625+
626+
Use the sign bits in the control mask `c` to select the corresponding element
627+
from `v1` when 1 (negative sign) and `v2` when 0 (positive sign).
628+
629+
Note that these instructions work for both signed integer and floating-point
630+
control masks.
620631

621632
## Boolean horizontal reductions
622633

0 commit comments

Comments
 (0)