bug 1244: update maxloc slides after finding shorter algorithm
[libreriscv.git] / conferences / fosdem2024 / fosdem2024_ddffirst / maxloc.s
1 # while (i<n)
2 setvl 2,0,4,0,1,1 # set MVL=4,VL=MIN(MVL,CTR)
3 # while (i<n and a[i]<=m) : i += 1
4 sv.cmp/ff=gt/m=ge *0,0,*10,4 # truncates VL to min
5 sv.creqv *16,*16,*16 # set mask on already-tested
6 setvl 2,0,4,0,1,1 # set MVL=4,VL=MIN(MVL,CTR)
7 mtcrf 128,0 # clear CR0 (in case VL=0?)
8 # while (i<n and a[i]>m):
9 sv.minmax./ff=le/m=ge/mr 4,*10,4,1 # r4 accumulate
10 crternlogi 0,1,2,127 # test >= (or VL=0)
11 sv.crnand/m=lt/zz *19,*16,0 # SO=~LT, if CR0.eq=0
12 # nm = i: count masked bits. could use crweirds
13 sv.svstep/mr/m=so 1,0,6,1 # get vector dststep
14 sv.creqv *16,*16,*16 # set mask on already-tested
15 bc 12,0,-0x3c # CR0 lt clear, branch back