I would like to discuss the names of load instructions (this came up in #237 and #271).
Currently, we have:
v128.loadv8x16.load_splat, v16x8.load_splat, v32x4.load_splat, v64x2.load_splati16x8.load8x8_s ,i16x8.load8x8_u ,i32x4.load16x4_s ,i32x4.load16x4_u ,i64x2.load32x2_s ,i64x2.load32x2_uv128.load32_zero, v128.load64_zeroSome issues:
v128 v.s. v8x16 v.s. i8x16.load8x8_s), in some cases it has the number of bytes loaded (in load32_zero), and sometimes it's just a word (splat).A more consistent naming convention will be:
v128.load prefix, this is the return type, it makes it clear that all the loads return a v128i32.load8_s)splat, extend, zeroWith this convention, all the loads now look like:
v128.loadv128.load8_splat, v128.load16_splat, v128.load32_splat, v128.load64_splatv128.load64_extend8x8_s, v128.load64_extend8x8_u, v128.load64_extend16x4_s, v128.load64_extend16x4_u, v128.load64_extend32x2_s, v128.load64_extend32x2_sv128.load8x8_s, v128.load8x8_u, v128.load16x4_s, v128.load16x4_u, v128.load32x2_s, v128.load32x2_sv128.load32_zero, v128.load64_zero(The load extends are a bit wordy, maybe we can come up with a better name.)
cc @tlively @Maratyszcza
I like that this is more explicit about the load size. It seems like it's a win for the splat/zero cases, but the extend case is less clear, IMO. Not sure quite how to improve, though.
Could we balance spec simplicity with readability by having the load-extends be v128.load<shape>_extend_{s,u}? Maybe we could say that 32, 64 and 8x8 are all members of some shape abstraction the syntax can use here?
Edit: In more detail, perhaps 32 and 64 could be aliases for the shapes 32x1 and 64x1?
In the basic numeric load instructions we don't spell out "extend", so wouldn't the most symmetric names simply be v128.load<shape>_{s,u}?
Good point, so the names will be:
v128.loadv128.load8_splat, v128.load16_splat, v128.load32_splat, v128.load64_splatv128.load8x8_s, v128.load8x8_u, v128.load16x4_s, v128.load16x4_u, v128.load32x2_s, v128.load32x2_sv128.load32_zero, v128.load64_zeroThose look great to me!
Yes, these look pretty good to me too. I still think the extend instructions are not super clear, but that's OK. (still not as bad as i64.extend_i32_s vs. i64.extend32_s)
Most helpful comment
In the basic numeric load instructions we don't spell out "extend", so wouldn't the most symmetric names simply be
v128.load<shape>_{s,u}?