WebAssembly / simd

Branch of the spec repo scoped to discussion of SIMD in WebAssembly
Other
531 stars 43 forks source link

Final opcodes #452

Closed tlively closed 3 years ago

tlively commented 3 years ago

A draft numbering of the most recently added instructions. I tried to keep related instructions together, so there are still holes in the opcode space. I also could have more aggressively filled holes at the expense of destroying much of the internal structure of the opcode space. There are 236 instructions, so in principle we could fit them all below 0x100, but it would be ugly. Comments welcome :)

Maratyszcza commented 3 years ago

Why are 0xe2 and 0xee reserved for round?

Maratyszcza commented 3 years ago

IMO we should recycle at least the opcodes where the original reserved instruction is meaningless. E.g. 0x67-0x6a opcodes are meaningless for widen instructions. Also, AFAICT it is missing v128.any_true.

tlively commented 3 years ago

@Maratyszcza I moved v128.any_true to 0x53 because it's now a one-off instruction, but if that renumbering would be disruptive, I could move it back to where it was.

tlively commented 3 years ago

Ok, I pushed a new version based on @ngzhian's suggestion and compacting more instructions into previous opcode holes. This version only uses opcodes up to 0xff, which will simplify V8 at least. The only block of instructions that really got scattered were the f64x2 rounding instructions, which are scattered among the integer operations.

ngzhian commented 3 years ago

Amazing bin packing work Thomas, thanks!

tlively commented 3 years ago

Why are 0xe2 and 0xee reserved for round?

TBH I don't remember. I must have thought at the time of the last renumbering that there would be just one floating point rounding instruction for each of f32x4 and f64x2.

zeux commented 3 years ago

256 opcodes was indeed enough for anyone 🚀

tlively commented 3 years ago

Merging because there were no further comments on this at today's meeting.