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

Commit

Permalink
Sign Select instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Maratyszcza committed Dec 4, 2020
1 parent 8551a32 commit 3d06a28
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proposals/simd/BinarySIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,7 @@ For example, `ImmLaneIdx16` is a byte with values in the range 0-15 (inclusive).
| `f32x4.convert_i32x4_u` | `0xfb`| - |
| `v128.load32_zero` | `0xfc`| - |
| `v128.load64_zero` | `0xfd`| - |
| `v8x16.signselect` | `0xfd7d`| - |
| `v16x8.signselect` | `0xfd7e`| - |
| `v32x4.signselect` | `0xfd7f`| - |
| `v64x2.signselect` | `0xfd94`| - |
4 changes: 4 additions & 0 deletions proposals/simd/ImplementationStatus.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@
| `f32x4.convert_i32x4_u` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
| `v128.load32_zero` | | :heavy_check_mark: | | | :heavy_check_mark: |
| `v128.load64_zero` | | :heavy_check_mark: | | | :heavy_check_mark: |
| `v8x16.signselect` | | | | | |
| `v16x8.signselect` | | | | | |
| `v32x4.signselect` | | | | | |
| `v64x2.signselect` | | | | | |

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

Expand Down
11 changes: 11 additions & 0 deletions proposals/simd/SIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,17 @@ Note that the normal WebAssembly `select` instruction also works with vector
types. It selects between two whole vectors controlled by a single scalar value,
rather than selecting bits controlled by a control mask vector.

### Sign select
* `v8x16.signselect(v1: v128, v2: v128, c: v128) -> v128`
* `v16x8.signselect(v1: v128, v2: v128, c: v128) -> v128`
* `v32x4.signselect(v1: v128, v2: v128, c: v128) -> v128`
* `v64x2.signselect(v1: v128, v2: v128, c: v128) -> v128`

Use the sign bits in the control mask `c` to select the corresponding element
from `v1` when 1 (negative sign) and `v2` when 0 (positive sign).

Note that these instructions work for both signed integer and floating-point
control masks.

## Boolean horizontal reductions

Expand Down

0 comments on commit 3d06a28

Please sign in to comment.