clarify branch predication pseudocode
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 7 Oct 2018 08:08:18 +0000 (09:08 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 7 Oct 2018 08:08:18 +0000 (09:08 +0100)
simple_v_extension/specification.mdwn

index 7ecf6d3ec04e3856d99d895d5c3874c356433abc..39debb78f07cea485d67f9cae2e3e576cff3d9fa 100644 (file)
@@ -523,13 +523,18 @@ complex), this becomes:
         preg = fp_pred_reg[rd]
         reg = fp_regfile
 
+    ps = get_pred_val(I/F==INT, rs);
+
+    preg[rd] = 0; # initialise to zero
     s1 = reg_is_vectorised(src1);
     s2 = reg_is_vectorised(src2);
     if (!s2 && !s1) goto branch;
     for (int i = 0; i < VL; ++i)
-      if (cmp(s1 ? reg[src1+i]:reg[src1],
-              s2 ? reg[src2+i]:reg[src2])
-             preg[rd] |= 1<<i;  # bitfield not vector
+      if (ps & (1<<i)) && (cmp(s1 ? reg[src1+i]:reg[src1],
+                               s2 ? reg[src2+i]:reg[src2])
+          preg[rd] |= 1<<i;  # bitfield not vector
+
+zeroing has been temporarily left out of the above pseudo-code
 
 Notes: