[Libre-soc-bugs] [Bug 324] create POWER9 DIV pipeline

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Fri Jun 19 15:35:34 BST 2020


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

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

> I was thinking SelectableInt and other custom classes would implement the
> trunc_div and rtrunc_div member functions, which is the trunc_div version of
> __sub__ and __rsub__. Similarly for trunc_rem and rtrunc_rem.

the problem is that if we do that, SelectableInt behaves unpredictably.

SelectableInt is designed not to be a "POWER9 compliant integer arithmetic"
class, it's designed to be a direct one-to-one and onto map of the behaviour
of the python *int* class - just one that happens to have a bitlength
associated
with it.

thus we genuinely expect SelectableInt's floordiv and truncdiv behaviour to
be exactly that of int, and consequently if in any code anywhere we need to
perform a div (or mod), we expect it to actually work.

here's the thing: although you may not have been aware of it, trunc_div and
trunc_rem are *behaving as expected* despite the fact that you wrote them
assuming that they would take python ints as arguments!

and that's *exactly* why SelectableInt.__floordiv__ and
SelectableInt.__truncdiv__
should not implement POWER9 div behaviour :)

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


More information about the libre-soc-bugs mailing list