[Libre-soc-isa] [Bug 794] SVP64 REMAP for utf8

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Aug 22 21:47:36 BST 2022


https://bugs.libre-soc.org/show_bug.cgi?id=794

--- Comment #14 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
ok i think i have a strategy.  firstly, note that the leading 1s == QTY(1)
is the patern 0b10------ which is also the "invalid" pattern.

secondly, there is a cntleadones scalar instruction in v3.1.
a vector of the 1s_count can be created.

thirdly, some sv.cmpi on that tells us where utf8 starts and ends,
where the end points may go into the next instruction as a mask

fourthly, a sv.addi/satu/ew=8/m=eq *RT,*RA,0xff where RT is 1 greater than RA
will perform a cascading non-rollover subtract of 1 from each element.
anything that started as a count of 2 3 4 5 or 6 will count down
*overwriting* the next register, but due to unsigned saturate it will
not wrap back to 0xff 0xfe etc.

furthermore due to the predicate mask the cascade *only* starts and
continues from non-terminating points.  it may be necessary to shift
the mask down by one as you want the subtract-cascade to stop at
the character *before* the beginning of the next utf8 sequence.

if there are only zeros at these last characters, then the expected
length is equal to the observed length.

setting VL to 64 would get you about...  maybe 14-18 instructions per
64 bytes?

the only thing about those cascading subtracts is, they could create
some horrendous hazard dependencies.  therefore another potential
way to do it would be to have a loop-unrolled sequence of sv.addi
operations, bouncing back and forth between two pairs of registers.
maybe three with a shift-incremented mask?

another potential way would be to use bmask, to analyse the start and
end points.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Libre-SOC-ISA mailing list