summaryrefslogtreecommitdiffstats
path: root/target/arm/vec_helper.c
diff options
context:
space:
mode:
authorRichard Henderson2021-05-26 00:58:12 +0200
committerPeter Maydell2021-06-03 17:43:26 +0200
commit839144784b613998edf7a7277ed2ed2015b0b4d7 (patch)
tree88bf3487c95aaf2b1add57c80d1954e008796050 /target/arm/vec_helper.c
parenttarget/arm: Implement bfloat16 dot product (vector) (diff)
downloadqemu-839144784b613998edf7a7277ed2ed2015b0b4d7.tar.gz
qemu-839144784b613998edf7a7277ed2ed2015b0b4d7.tar.xz
qemu-839144784b613998edf7a7277ed2ed2015b0b4d7.zip
target/arm: Implement bfloat16 dot product (indexed)
This is BFDOT for both AArch64 AdvSIMD and SVE, and VDOT.BF16 for AArch32 NEON. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20210525225817.400336-8-richard.henderson@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm/vec_helper.c')
-rw-r--r--target/arm/vec_helper.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c
index 7eefcd06ea..74a497f38c 100644
--- a/target/arm/vec_helper.c
+++ b/target/arm/vec_helper.c
@@ -2452,3 +2452,23 @@ void HELPER(gvec_bfdot)(void *vd, void *vn, void *vm, void *va, uint32_t desc)
}
clear_tail(d, opr_sz, simd_maxsz(desc));
}
+
+void HELPER(gvec_bfdot_idx)(void *vd, void *vn, void *vm,
+ void *va, uint32_t desc)
+{
+ intptr_t i, j, opr_sz = simd_oprsz(desc);
+ intptr_t index = simd_data(desc);
+ intptr_t elements = opr_sz / 4;
+ intptr_t eltspersegment = MIN(16 / 4, elements);
+ float32 *d = vd, *a = va;
+ uint32_t *n = vn, *m = vm;
+
+ for (i = 0; i < elements; i += eltspersegment) {
+ uint32_t m_idx = m[i + H4(index)];
+
+ for (j = i; j < i + eltspersegment; j++) {
+ d[j] = bfdotadd(a[j], n[j], m_idx);
+ }
+ }
+ clear_tail(d, opr_sz, simd_maxsz(desc));
+}