From 4f533cac229c58cd367b9a12909badfa44662556 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 7 Jan 2023 22:07:45 +0100 Subject: [PATCH] Document opcode 0x1C, typed select. https://webassembly.github.io/spec/core/bikeshed/index.html#valid-select --- WebAssembly.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/WebAssembly.md b/WebAssembly.md index 445f604..fd535e4 100644 --- a/WebAssembly.md +++ b/WebAssembly.md @@ -1751,9 +1751,10 @@ parameter is bound to the type of the global. #### Select -| Mnemonic | Opcode | Signature | Families | -| ----------- | ------ | ------------------------------------------- | -------- | -| `select` | 0x1b | `($T[1], $T[1], $condition: i32) : ($T[1])` | | +| Mnemonic | Opcode | Immediates | Signature | Families | +| ----------- | ------ | --------------------------------------------------- | ------------------------------------------- | -------- | +| `select` | 0x1b | | `($T[1], $T[1], $condition: i32) : ($T[1])` | | +| `select` | 0x1c | `$signature`: [array] of [value types]; length is 1 | `($T[1], $T[1], $condition: i32) : ($T[1])` | | The `select` instruction returns its first operand if `$condition` is [true], or its second operand otherwise. @@ -1767,6 +1768,9 @@ meant to have similar performance properties. > This instruction is sometimes called "value-polymorphic" because it can operate on values of any type. +**Validation:** + - `$signature[0]` is the [type] of the first and second operand. + TODO: Explicitly describe the binding of $T. #### Call