diff --git a/proposals/simd/BinarySIMD.md b/proposals/simd/BinarySIMD.md index 4297afbd3..2d86a67b1 100644 --- a/proposals/simd/BinarySIMD.md +++ b/proposals/simd/BinarySIMD.md @@ -222,3 +222,7 @@ For example, `ImmLaneIdx16` is a byte with values in the range 0-15 (inclusive). | `i32x4.trunc_sat_f32x4_u` | `0xf9`| - | | `f32x4.convert_i32x4_s` | `0xfa`| - | | `f32x4.convert_i32x4_u` | `0xfb`| - | +| `v128.move32_zero_r` | `0xfe`| - | +| `v128.move32_zero_v` | `0xff`| - | +| `v128.move64_zero_r` | `0x100`| - | +| `v128.move64_zero_v` | `0x101`| - | diff --git a/proposals/simd/ImplementationStatus.md b/proposals/simd/ImplementationStatus.md index e50409829..b647dd0d3 100644 --- a/proposals/simd/ImplementationStatus.md +++ b/proposals/simd/ImplementationStatus.md @@ -190,6 +190,10 @@ | `i32x4.trunc_sat_f32x4_u` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: | | `f32x4.convert_i32x4_s` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: | | `f32x4.convert_i32x4_u` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: | +| `v128.move32_zero_r` | | | | | +| `v128.move32_zero_v` | | | | | +| `v128.move64_zero_r` | | | | | +| `v128.move64_zero_v` | | | | | [1] Tip of tree LLVM as of May 20, 2020 diff --git a/proposals/simd/SIMD.md b/proposals/simd/SIMD.md index 0b6b9cde6..20b78573e 100644 --- a/proposals/simd/SIMD.md +++ b/proposals/simd/SIMD.md @@ -1023,3 +1023,33 @@ def S.widen_low_T_u(a): def S.widen_high_T_u(a): return S.widen_high_T(Zext, a) ``` + + +### Move and Zero-Pad + +* `v128.move32_zero_r(x: i32) -> v128` +* `v128.move32_zero_v(a: v128) -> v128` +* `v128.move64_zero_r(x: i64) -> v128` +* `v128.move64_zero_v(a: v128) -> v128` + +Move a single 32-bit or 64-bit element into the lowest bits of `v128` vector, +and initialize all other bits of the `v128` vector to zero. +```python +def S.moveT_zero_r(x): + result = S.New() + for i in range(S.Lanes): + if i == 0: + result[i] = x + else: + result[i] = 0 + return result + +def S.moveT_zero_v(a): + result = S.New() + for i in range(S.Lanes): + if i == 0: + result[i] = a[i] + else: + result[i] = 0 + return result +```