# Pseudocode and examples
-For comparative purposes this is a copy of the v3.0B `bc` pseudocode,
-noting that M and AA have not been added to the SVP64 versions
-for simplicity of illustration. ctr_ok does not appear in the SVP64
-versions because of the way that CTRtest Mode interacts.
+For comparative purposes this is a copy of the v3.0B `bc` pseudocode
```
if (mode_is_64bit) then M <- 0
Pseudocode for Horizontal-First Mode:
```
+if (mode_is_64bit) then M <- 0
+else M <- 32
cond_ok = not SVRMmode.ALL
for srcstep in range(VL):
# select predicate bit or zero/one
# inverted CTR test skip mode
if ¬BO[2] & CTRtest & ¬CTI then
CTR = CTR - 1
- continue
+ continue # skip to next
else
testbit = SVRMmode.SNZ
+ if ¬BO[2] then CTR <- CTR - 1
+ ctr_ok <- BO[2] | ((CTR[M:63] != 0) ^ BO[3])
# actual element test here
- el_cond_ok <- BO[0] | ¬(testbit ^ BO[1])
+ el_cond_ok <- BO[0] | ¬(testbit ^ BO[1]) & ctr_ok
# merge in the test
if SVRMmode.ALL:
cond_ok &= el_cond_ok
SVSTATE.VL = srcstep
break
# early exit?
- if SVRMmode.ALL:
- if ~el_cond_ok:
- break
- else
- if el_cond_ok:
- break
+ if SVRMmode.ALL != el_cond_ok:
+ break
+ # SVP64 rules about Scalar registers still apply!
if SVCRf.scalar:
break
# loop finally done, now test if branch (and update LR)
else NIA <-iea CIA + EXTS(BD || 0b00)
lr_ok <- 0b1
if LK & lr_ok then LR <-iea CIA + 4
-
```
Pseudocode for Vertical-First Mode: