diff --git a/proposals/simd/BinarySIMD.md b/proposals/simd/BinarySIMD.md index 19077bb2e..135ab99dc 100644 --- a/proposals/simd/BinarySIMD.md +++ b/proposals/simd/BinarySIMD.md @@ -225,3 +225,9 @@ For example, `ImmLaneIdx16` is a byte with values in the range 0-15 (inclusive). | `f32x4.convert_i32x4_u` | `0xfb`| - | | `v128.load32_zero` | `0xfc`| - | | `v128.load64_zero` | `0xfd`| - | +| `i32x4.widen_i8x16_u` | | - | +| `i32x4.widen_i8x16_s` | | - | +| `i64x2.widen_i8x16_u` | | - | +| `i64x2.widen_i8x16_s` | | - | +| `i64x2.widen_i16x8_u` | | - | +| `i64x2.widen_i16x8_s` | | - | diff --git a/proposals/simd/ImplementationStatus.md b/proposals/simd/ImplementationStatus.md index 7e33288e2..c76c83953 100644 --- a/proposals/simd/ImplementationStatus.md +++ b/proposals/simd/ImplementationStatus.md @@ -193,6 +193,12 @@ | `f32x4.convert_i32x4_u` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: | | `v128.load32_zero` | | :heavy_check_mark: | | | :heavy_check_mark: | | `v128.load64_zero` | | :heavy_check_mark: | | | :heavy_check_mark: | +| `i32x4.widen_i8x16_u` | | - | | | | +| `i32x4.widen_i8x16_s` | | - | | | | +| `i64x2.widen_i8x16_u` | | - | | | | +| `i64x2.widen_i8x16_s` | | - | | | | +| `i64x2.widen_i16x8_u` | | - | | | | +| `i64x2.widen_i16x8_s` | | - | | | | [1] Tip of tree LLVM as of May 20, 2020 diff --git a/proposals/simd/SIMD.md b/proposals/simd/SIMD.md index 8e4a94080..a4eece3ce 100644 --- a/proposals/simd/SIMD.md +++ b/proposals/simd/SIMD.md @@ -1046,3 +1046,25 @@ def S.widen_low_T_u(a): def S.widen_high_T_u(a): return S.widen_high_T(Zext, a) ``` +### Integer to integer Widening (Constant Immediate) +* `i32x4.widen_i8x16_u(v128: a, ImmLaneIdx4: c) -> v128` +* `i32x4.widen_i8x16_s(v128: a, ImmLaneIdx4: c) -> v128` +* `i64x2.widen_i8x16_u(v128: a, ImmLaneIdx8: c) -> v128` +* `i64x2.widen_i8x16_s(v128: a, ImmLaneIdx8: c) -> v128` +* `i64x2.widen_i16x8_u(v128: a, ImmLaneIdx4: c) -> v128` +* `i64x2.widen_i16x8_s(v128: a, ImmLaneIdx4: c) -> v128` + +Using the constant immediate, widens selected integers with zero or sign extension. +```python +def S.widen_T_u(a,c): + result = S.New() + for i in range(S.Lanes): + result[i] = Zext(a[S.Lanes + i + c]) + return result + +def S.widen_T_s(a,c): + result = S.New() + for i in range(S.Lanes): + result[i] = Sext(a[S.Lanes + i + c]) + return result +```