From 6b12c6b8af4ae6218ad5a6ecf882334652d9d445 Mon Sep 17 00:00:00 2001 From: Dan Weber Date: Tue, 13 Oct 2020 01:03:29 +0000 Subject: [PATCH 1/3] extended multiply horizontal add instruction --- proposals/simd/BinarySIMD.md | 1 + proposals/simd/ImplementationStatus.md | 1 + proposals/simd/SIMD.md | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/proposals/simd/BinarySIMD.md b/proposals/simd/BinarySIMD.md index 4297afbd3..c68f5271e 100644 --- a/proposals/simd/BinarySIMD.md +++ b/proposals/simd/BinarySIMD.md @@ -222,3 +222,4 @@ 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`| - | +| `u8x16.ext_mul_padd_u8` | | - | diff --git a/proposals/simd/ImplementationStatus.md b/proposals/simd/ImplementationStatus.md index e50409829..1990c4183 100644 --- a/proposals/simd/ImplementationStatus.md +++ b/proposals/simd/ImplementationStatus.md @@ -190,6 +190,7 @@ | `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: | +| `u8x16.ext_mul_padd_u8` | | | | | | [1] Tip of tree LLVM as of May 20, 2020 diff --git a/proposals/simd/SIMD.md b/proposals/simd/SIMD.md index 0b6b9cde6..147495f16 100644 --- a/proposals/simd/SIMD.md +++ b/proposals/simd/SIMD.md @@ -1023,3 +1023,18 @@ def S.widen_low_T_u(a): def S.widen_high_T_u(a): return S.widen_high_T(Zext, a) ``` + + +### Horizontal Multiply Extend and Add +* `u8x16.ext_mul_padd_u8(a: v128, b: v128) -> v128` + +Multiplies two u8x16 vectors, temporarily expands the values to two i16x8s, before performing +pairwise addition leading to one i16x8/u16x8. + +```python +def S.ext_mul_padd_u8(a, b): + result = S.New() + for i in S.range(S.Lanes/2): + result[i] = (a[i]*b[i])+(a[i+1]*b[i+1]) + return result +``` From 4d0a236d962e0f711d49dbaeb50989020e611b4f Mon Sep 17 00:00:00 2001 From: Dan Weber Date: Tue, 13 Oct 2020 01:34:31 +0000 Subject: [PATCH 2/3] fix nomenclature --- proposals/simd/BinarySIMD.md | 2 +- proposals/simd/ImplementationStatus.md | 2 +- proposals/simd/SIMD.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/proposals/simd/BinarySIMD.md b/proposals/simd/BinarySIMD.md index c68f5271e..8bc6e9d87 100644 --- a/proposals/simd/BinarySIMD.md +++ b/proposals/simd/BinarySIMD.md @@ -222,4 +222,4 @@ 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`| - | -| `u8x16.ext_mul_padd_u8` | | - | +| `i16x8.extmul_padd_i8x16_u`| | - | diff --git a/proposals/simd/ImplementationStatus.md b/proposals/simd/ImplementationStatus.md index 1990c4183..78b3b7706 100644 --- a/proposals/simd/ImplementationStatus.md +++ b/proposals/simd/ImplementationStatus.md @@ -190,7 +190,7 @@ | `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: | -| `u8x16.ext_mul_padd_u8` | | | | | | +| `i16x8.extmul_padd_i8x16_u`| | | | | | [1] Tip of tree LLVM as of May 20, 2020 diff --git a/proposals/simd/SIMD.md b/proposals/simd/SIMD.md index 147495f16..cf87af7da 100644 --- a/proposals/simd/SIMD.md +++ b/proposals/simd/SIMD.md @@ -1026,13 +1026,13 @@ def S.widen_high_T_u(a): ### Horizontal Multiply Extend and Add -* `u8x16.ext_mul_padd_u8(a: v128, b: v128) -> v128` +* `i16x8.extmul_padd_i8x16_u(a: v128, b: v128) -> v128` Multiplies two u8x16 vectors, temporarily expands the values to two i16x8s, before performing pairwise addition leading to one i16x8/u16x8. ```python -def S.ext_mul_padd_u8(a, b): +def S.extmul_padd_i8x16_u(a, b): result = S.New() for i in S.range(S.Lanes/2): result[i] = (a[i]*b[i])+(a[i+1]*b[i+1]) From e699ff60b7cb85456fad672d8b18d642ff6395ac Mon Sep 17 00:00:00 2001 From: Dan Weber Date: Thu, 15 Oct 2020 18:07:49 +0000 Subject: [PATCH 3/3] Update nomenclature to match @Maratyszcza proposal in #127 --- proposals/simd/BinarySIMD.md | 2 +- proposals/simd/ImplementationStatus.md | 2 +- proposals/simd/SIMD.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proposals/simd/BinarySIMD.md b/proposals/simd/BinarySIMD.md index 8bc6e9d87..deb916de6 100644 --- a/proposals/simd/BinarySIMD.md +++ b/proposals/simd/BinarySIMD.md @@ -222,4 +222,4 @@ 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`| - | -| `i16x8.extmul_padd_i8x16_u`| | - | +| `i16x8.dot_i8x16_u` | | - | diff --git a/proposals/simd/ImplementationStatus.md b/proposals/simd/ImplementationStatus.md index 78b3b7706..d6dae677c 100644 --- a/proposals/simd/ImplementationStatus.md +++ b/proposals/simd/ImplementationStatus.md @@ -190,7 +190,7 @@ | `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: | -| `i16x8.extmul_padd_i8x16_u`| | | | | | +| `i16x8.dot_i8x16_u` | | | | | | [1] Tip of tree LLVM as of May 20, 2020 diff --git a/proposals/simd/SIMD.md b/proposals/simd/SIMD.md index cf87af7da..36e41c51c 100644 --- a/proposals/simd/SIMD.md +++ b/proposals/simd/SIMD.md @@ -1026,7 +1026,7 @@ def S.widen_high_T_u(a): ### Horizontal Multiply Extend and Add -* `i16x8.extmul_padd_i8x16_u(a: v128, b: v128) -> v128` +* `i16x8.dot_i8x16_u(a: v128, b: v128) -> v128` Multiplies two u8x16 vectors, temporarily expands the values to two i16x8s, before performing pairwise addition leading to one i16x8/u16x8.