[Libre-soc-bugs] [Bug 1044] SVP64 implementation of pow(x,y,z)

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Wed Oct 11 06:27:10 BST 2023


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

--- Comment #53 from Jacob Lifshay <programmerjake at gmail.com> ---
one annoying thing I encountered while implementing DivModKnuthAlgorithmD is
setting up a REMAP to reverse element order -- to implement the simple python
loop where denom_size = len(v):

n = denom_size

# get non-zero length of divisor
while n > 0 and v[n - 1] == 0:
    n -= 1

I had to do all of:

setvl 0, 0, {denom_size}, 0, 1, 1
addis 0, 0, {svshape_high}
ori 0, 0, {svshape_low}
mtspr {SVSHAPE0}, 0 # mtspr SVSHAPE0, 0
svremap 0o01, 0, 0, 0, 0, 0, 0  # enable SVSHAPE0 for RA
sv.cmpi/ff=ne *0, 1, *{v}, 0
setvl {n_scalar}, 0, 1, 0, 0, 0 # getvl {n_scalar}
subfic {n_scalar}, {n_scalar}, {denom_size}

if we had reverse gear for data-dependent fail-first, it would be 3
instructions:
setvl 0, 0, {denom_size}, 0, 1, 1
sv.cmpi/ff=ne/mrr *0, 1, *{v}, 0
setvl {n_scalar}, 0, 1, 0, 0, 0 # getvl {n_scalar}

(I also had to fix the simulator for mtspr SVSHAPE*, which was not keeping the
SVSHAPE* SPRs as SVSHAPE instances, I changed SPR.__setitem__ to convert to
SVSHAPE)

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


More information about the libre-soc-bugs mailing list