bug 676: noted a way to reduce the number of instructions
[libreriscv.git] / conferences / fosdem2024 / fosdem2024_ddffirst / maxloc.s
index f72de742ada525b7e148fb4dedffa11faf37d2fa..2639c112d8ffbe3de4ce8a1b17ea951d12342891 100644 (file)
@@ -8,7 +8,7 @@ mtcrf 128,0           # clear CR0 (in case VL=0?)
 #  while (i<n and a[i]>m):
 sv.minmax./ff=le/m=ge/mr 4,*10,4,1 # r4 accumulate
 crternlogi 0,1,2,127  # test >= (or VL=0)
-sv.crand *19,*16,0    # clear if CR0.eq=0
+sv.crnand/m=lt/zz *19,*16,0 # SO=~LT, if CR0.eq=0
 #   nm = i: count masked bits. could use crweirds
 sv.svstep/mr/m=so 1,0,6,1 # get vector dststep
 sv.creqv *16,*16,*16  # set mask on already-tested