0

I want two registers to be combined as one unit. I am learning new multiplication by adding and shifting. So is this a wrong way to do?

1stmul:
        set     0x04ee67b7,     %l1     !multiplicand 
        set     0x072e8b8c,     %l2     !multiplier
        clr     %l0                     !product      
        addx    %l0, %l2, %l2           !combining two units?
user432297
  • 121
  • 1
  • 6
  • sorry, a register. product and multiplier registers combined as a unit – user432297 Oct 13 '15 at 04:13
  • how do you want them combined, and why? – user3528438 Oct 13 '15 at 04:15
  • I have an algorithm to implement - negative = multiplier >= 0 ? 0 : 1; product = 0; for (i = 0; i < 32; i++) { if (multiplier & 1) product += multiplicand; (product and multiplier registers combined as a unit) >> 1; } if (negative) product -= multiplicand; And I have to write that in assembly. The multiplication method to use is shift and add. And I know that the product and the multiplier have to be combined together. – user432297 Oct 13 '15 at 04:20
  • then why not just write it in C and compile it? – user3528438 Oct 13 '15 at 04:21
  • Because this is my homework assignment, I am suppose to write it in assembly, using the shift and add method.. – user432297 Oct 13 '15 at 04:22
  • Ohh thanks I will check this one out – user432297 Oct 13 '15 at 04:38

0 Answers0