Document opcode 0x1C, typed select.#18
Conversation
| | 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])` | | |
There was a problem hiding this comment.
I don't think "array" is correct here because "array" as defined in this document includes an encoding of the length, which the actual binary encoding for typed select doesn't have. Instead of saying it's an array with "length is 1", could we just say there's a single type? The spec does have wording leaving open the possibility of having more types, but the binary encoding doesn't reflect that.
There was a problem hiding this comment.
The octets for typed select look like this: 1C 01 7F - the last one is the actual type; the second one is always 1 but I think that qualifies as array-like?
(Just guessing but I suspect it's to allow future extension for a select where the two operands have different types?)
There was a problem hiding this comment.
Ah, you're right. I misread the spec. Could you then move the length is 1 out and add it as a Validation requirement?
https://webassembly.github.io/spec/core/bikeshed/index.html#valid-select