[Libre-soc-bugs] [Bug 659] New: SVP64 demo / unit test of CRM data-dependent ffirst mode implementing insertion sort

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Wed Jul 21 11:03:09 BST 2021


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

            Bug ID: 659
           Summary: SVP64 demo / unit test of CRM data-dependent ffirst
                    mode implementing insertion sort
           Product: Libre-SOC's first SoC
           Version: unspecified
          Hardware: Other
                OS: Linux
            Status: CONFIRMED
          Severity: enhancement
          Priority: ---
         Component: Source Code
          Assignee: lkcl at lkcl.net
          Reporter: lkcl at lkcl.net
                CC: libre-soc-bugs at lists.libre-soc.org
   NLnet milestone: ---

it should be possible to do this using 1<<r3 predicate
for selection and insertion, data-dependent failfirst
to do the inner loop (needs a reverse mode) and a compare
xchg instruction.

failfirst will drop out with VL set to the failed element,
getvl can copy this into r3 and use 1<<r3 as the predicate
to insert key_item.

excluding LDs it should be possible to do in registers
in about 10 instructions.

def insertion_sort(array):
    for i in range(1, len(array)):
        key_item = array[i]
        j = i - 1
        while j >= 0 and array[j] > key_item:
            array[j + 1] = array[j]
            j -= 1
        array[j + 1] = key_item
    return array

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


More information about the libre-soc-bugs mailing list