From 8d84db3e5788078924e399c5fdbc37f71f4ee5e7 Mon Sep 17 00:00:00 2001 From: lkcl Date: Sat, 5 Oct 2019 10:31:52 +0100 Subject: [PATCH] --- simple_v_extension/vector_ops.mdwn | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/simple_v_extension/vector_ops.mdwn b/simple_v_extension/vector_ops.mdwn index e45b9642f..71d45fbfb 100644 --- a/simple_v_extension/vector_ops.mdwn +++ b/simple_v_extension/vector_ops.mdwn @@ -131,6 +131,16 @@ Pseudocode in c: return result; } +## Vector Normalisation (not included) + +Vector normalisation may be performed through dot product, recip square root and multiplication: + + fdot F3, F1, F1 # vector dot with self + rcpsqrta F3, F3 + fscale,0 F2, F3, F1 + +Or it may be performed through VLEN (Vector length) and division. + ## Vector length * rd=scalar, vs1=vec (SUBVL=1) @@ -144,6 +154,8 @@ The scalar length of a vector: sqrt(x[0]^2 + x[1]^2 + ...). +One option is for this to be a macro op fusion sequence, with inverse-sqrt also being a second macro op sequence suitable for normalisation. + ## Vector distance * VDIST rd, vs1, vs2 -- 2.30.2