[Libre-soc-isa] [Bug 937] instructions for bigint shift and prefix-code encode

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Sep 26 02:48:20 BST 2022


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

--- Comment #4 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Jacob Lifshay from comment #2)

>     # shift:
>     shifted0 = [0] * (len(symbols) + 1)
>     for i in range(len(symbols)):
>         shifted0[i + 1] = u64(sym_bits[i] << (start[i] % 64))
>     shifted1 = [0] * (len(symbols) + 1)
>     for i in range(len(symbols)):
>         shifted1[i + 1] = (sym_bits[i] << (start[i] % 64)) >> 64

doubleshifts.

>     # for pedagogical purposes, not needed in final algorithm:
>     # orig_shifted0 = shifted0.copy()
>     # orig_shifted1 = shifted1.copy()
> 
>     # xor prefix-sum (can't use bitwise-or because it's not invertible):
>     for i in range(len(symbols)):
>         shifted0[i + 1] ^= shifted0[i]
>     for i in range(len(symbols)):
>         shifted1[i + 1] ^= shifted1[i]

interesting. sorta making sense

>     # scatter or twin-pred:
>     out_to_in_map = [0] * (start[-1] // 64 + 1)
>     for i in range(len(start)):
>         out_to_in_map[start[i] // 64] = i

sv.svstep gets indices, grep examples for "iota".
binary incrementing numbers, turning into unary
bitmask? interesting. oh - easy. shift then or-reduction
(again).  failfirst-cmpi truncates VL to ensure
start[i] no greater than vector len.

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


More information about the Libre-SOC-ISA mailing list