Signed and unsigned multiply are different, and mixed multiplylilltroll wrote:The thing is that multiplication works exactly the same for
positive and negative numbers as well, as long as you sign extend the numbers.
is different still. XS1 does not have mixed multiply. And you need
it for multiprecision signed multiplies.
Sign extending in your case makes your numbers take three limbs
(words) instead of two (that is the "extending" part). Biasing the
numbers (to always be unsigned) does not, so you do not need
to calculate with that extension (multiply, mask, whatever). It
also gives you more freedom for the last steps (you can play many
more stupid little tricks with adds than you can with muladds).
On XS1, like on most machines without mixed multiply(-add), it isThe question is thus, when is it cheaper to add an offset and subtract it on the XMOS ISA, compared to just multiply direct?
almost always a win.
Do you mean you have no reuse of either at all? That is a differentAssume that both a and b are a(n) and b(n), (time-dependent),
Well let's count :-)is it better to use the bias method? Or is it only when one coefficient becomes static over a longer time-window the total instruction count is reduced.
For doing a single multiply, we'll lose four instructions (two ashr,
two muladds with those); we need two insns to do the biasing, and
two more for the final correction (unless you can combine it with
a shift you have elsewhere, then only one -- but let's ignore that).
So it's a wash then.
Say one of the numbers is fixed (for some period); then the biasing
takes only one insn, and the correction still only two (if doing multiple
accumulations, all the fixed corrections can be combined -- they are
just additions after all!) So one or two insns saved.
If both numbers are fixed, nothing is saved since either sequence
takes zero cycles :-P