(no commit message)
authorlkcl <lkcl@web>
Sat, 25 Jun 2022 18:51:32 +0000 (19:51 +0100)
committerIkiWiki <ikiwiki.info>
Sat, 25 Jun 2022 18:51:32 +0000 (19:51 +0100)
openpower/sv/svp64/appendix.mdwn

index 1ed354fda4dee906a1f12330f95daa21bb4e2539..3ff57f151c15e5a386e8eba5c0278ae8a1429d07 100644 (file)
@@ -999,29 +999,10 @@ Additional state cannot be saved on context-switching beyond that
 of SVSTATE, making things slightly tricky.
 
 Executable demo pseudocode, full version
-[here](https://git.libre-soc.org/?p=libreriscv.git;a=blob;f=openpower/sv/preduce.py;hb=HEAD)
+[here](https://git.libre-soc.org/?p=libreriscv.git;a=blob;f=openpower/sv/test_preduce.py;hb=HEAD)
 
 ```
-def preducei(vl, vec, pred):
-    vec = copy(vec)
-    pred = copy(pred) # must not damage predicate
-    step = 1
-    ix = list(range(vl)) # indices move rather than copy data
-    print(" start", step, pred, vec)
-    while step < vl:
-        step *= 2
-        for i in range(0, vl, step):
-            other = i + step // 2
-            ci = ix[i]
-            oi = ix[other] if other < vl else None
-            other_pred = other < vl and pred[oi]
-            if pred[ci] and other_pred:
-                vec[ci] += vec[oi]
-            elif other_pred:
-                ix[i] = oi # leave data in-place, copy index instead
-            pred[ci] |= other_pred
-        print("   row", step, pred, vec, ix)
-    return vec
+[[!inline raw="yes" pages="openpower/sv/preduce.py" ]]
 ```
 
 This algorithm works by noting when data remains in-place rather than