[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 60/81] target/arm: Implement SVE mixed sign dot product
From: |
Richard Henderson |
Subject: |
[PATCH v5 60/81] target/arm: Implement SVE mixed sign dot product |
Date: |
Fri, 16 Apr 2021 14:02:19 -0700 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/helper.h | 2 ++
target/arm/sve.decode | 4 ++++
target/arm/translate-sve.c | 16 ++++++++++++++++
target/arm/vec_helper.c | 18 ++++++++++++++++++
4 files changed, 40 insertions(+)
diff --git a/target/arm/helper.h b/target/arm/helper.h
index e4c6458f98..86f938c938 100644
--- a/target/arm/helper.h
+++ b/target/arm/helper.h
@@ -612,6 +612,8 @@ DEF_HELPER_FLAGS_5(gvec_sdot_b, TCG_CALL_NO_RWG, void, ptr,
ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_udot_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_sdot_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_udot_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_5(gvec_usdot_b, TCG_CALL_NO_RWG,
+ void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_sdot_idx_b, TCG_CALL_NO_RWG,
void, ptr, ptr, ptr, ptr, i32)
diff --git a/target/arm/sve.decode b/target/arm/sve.decode
index 05360e2608..73f1348313 100644
--- a/target/arm/sve.decode
+++ b/target/arm/sve.decode
@@ -1481,6 +1481,10 @@ UMLSLT_zzzw 01000100 .. 0 ..... 010 111 ..... .....
@rda_rn_rm
CMLA_zzzz 01000100 esz:2 0 rm:5 0010 rot:2 rn:5 rd:5 ra=%reg_movprfx
SQRDCMLAH_zzzz 01000100 esz:2 0 rm:5 0011 rot:2 rn:5 rd:5 ra=%reg_movprfx
+## SVE mixed sign dot product
+
+USDOT_zzzz 01000100 .. 0 ..... 011 110 ..... ..... @rda_rn_rm
+
### SVE2 floating point matrix multiply accumulate
FMMLA 01100100 .. 1 ..... 111001 ..... ..... @rda_rn_rm
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 1f07131cff..0da4a48199 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -8056,3 +8056,19 @@ static bool trans_SQRDCMLAH_zzzz(DisasContext *s,
arg_SQRDCMLAH_zzzz *a)
}
return true;
}
+
+static bool trans_USDOT_zzzz(DisasContext *s, arg_USDOT_zzzz *a)
+{
+ if (a->esz != 2 || !dc_isar_feature(aa64_sve_i8mm, s)) {
+ return false;
+ }
+ if (sve_access_check(s)) {
+ unsigned vsz = vec_full_reg_size(s);
+ tcg_gen_gvec_4_ool(vec_full_reg_offset(s, a->rd),
+ vec_full_reg_offset(s, a->rn),
+ vec_full_reg_offset(s, a->rm),
+ vec_full_reg_offset(s, a->ra),
+ vsz, vsz, 0, gen_helper_gvec_usdot_b);
+ }
+ return true;
+}
diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c
index 98b707f4f5..9b2a4d5b7e 100644
--- a/target/arm/vec_helper.c
+++ b/target/arm/vec_helper.c
@@ -579,6 +579,24 @@ void HELPER(gvec_udot_b)(void *vd, void *vn, void *vm,
void *va, uint32_t desc)
clear_tail(d, opr_sz, simd_maxsz(desc));
}
+void HELPER(gvec_usdot_b)(void *vd, void *vn, void *vm,
+ void *va, uint32_t desc)
+{
+ intptr_t i, opr_sz = simd_oprsz(desc);
+ int32_t *d = vd, *a = va;
+ uint8_t *n = vn;
+ int8_t *m = vm;
+
+ for (i = 0; i < opr_sz / 4; ++i) {
+ d[i] = (a[i] +
+ n[i * 4 + 0] * m[i * 4 + 0] +
+ n[i * 4 + 1] * m[i * 4 + 1] +
+ n[i * 4 + 2] * m[i * 4 + 2] +
+ n[i * 4 + 3] * m[i * 4 + 3]);
+ }
+ clear_tail(d, opr_sz, simd_maxsz(desc));
+}
+
void HELPER(gvec_sdot_h)(void *vd, void *vn, void *vm, void *va, uint32_t desc)
{
intptr_t i, opr_sz = simd_oprsz(desc);
--
2.25.1
- [PATCH v5 47/81] target/arm: Implement SVE2 SPLICE, EXT, (continued)
- [PATCH v5 47/81] target/arm: Implement SVE2 SPLICE, EXT, Richard Henderson, 2021/04/16
- [PATCH v5 50/81] target/arm: Split out formats for 2 vectors + 1 index, Richard Henderson, 2021/04/16
- [PATCH v5 49/81] target/arm: Pass separate addend to FCMLA helpers, Richard Henderson, 2021/04/16
- [PATCH v5 55/81] target/arm: Implement SVE2 saturating multiply-add (indexed), Richard Henderson, 2021/04/16
- [PATCH v5 57/81] target/arm: Implement SVE2 signed saturating doubling multiply high, Richard Henderson, 2021/04/16
- [PATCH v5 52/81] target/arm: Implement SVE2 integer multiply (indexed), Richard Henderson, 2021/04/16
- [PATCH v5 58/81] target/arm: Implement SVE2 saturating multiply high (indexed), Richard Henderson, 2021/04/16
- [PATCH v5 54/81] target/arm: Implement SVE2 saturating multiply-add high (indexed), Richard Henderson, 2021/04/16
- [PATCH v5 61/81] target/arm: Implement SVE2 crypto unary operations, Richard Henderson, 2021/04/16
- [PATCH v5 64/81] target/arm: Implement SVE2 TBL, TBX, Richard Henderson, 2021/04/16
- [PATCH v5 60/81] target/arm: Implement SVE mixed sign dot product,
Richard Henderson <=
- [PATCH v5 68/81] target/arm: Implement SVE2 FLOGB, Richard Henderson, 2021/04/16
- [PATCH v5 69/81] target/arm: Share table of sve load functions, Richard Henderson, 2021/04/16
- [PATCH v5 62/81] target/arm: Implement SVE2 crypto destructive binary operations, Richard Henderson, 2021/04/16
- [PATCH v5 66/81] target/arm: Implement SVE2 FCVTLT, Richard Henderson, 2021/04/16
- [PATCH v5 53/81] target/arm: Implement SVE2 integer multiply-add (indexed), Richard Henderson, 2021/04/16
- [PATCH v5 59/81] target/arm: Implement SVE mixed sign dot product (indexed), Richard Henderson, 2021/04/16
- [PATCH v5 65/81] target/arm: Implement SVE2 FCVTNT, Richard Henderson, 2021/04/16
- [PATCH v5 67/81] target/arm: Implement SVE2 FCVTXNT, FCVTX, Richard Henderson, 2021/04/16
- [PATCH v5 63/81] target/arm: Implement SVE2 crypto constructive binary operations, Richard Henderson, 2021/04/16
- [PATCH v5 70/81] target/arm: Implement SVE2 LD1RO, Richard Henderson, 2021/04/16