mulsi3.S 679 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. ;
  2. ; mulsi3 for H8/300H - based on Renesas SH implementation
  3. ;
  4. ; by Toshiyasu Morita
  5. ;
  6. ; Old code:
  7. ;
  8. ; 16b * 16b = 372 states (worst case)
  9. ; 32b * 32b = 724 states (worst case)
  10. ;
  11. ; New code:
  12. ;
  13. ; 16b * 16b = 48 states
  14. ; 16b * 32b = 72 states
  15. ; 32b * 32b = 92 states
  16. ;
  17. .global __mulsi3
  18. __mulsi3:
  19. mov.w r1,r2 ; ( 2 states) b * d
  20. mulxu r0,er2 ; (22 states)
  21. mov.w e0,r3 ; ( 2 states) a * d
  22. beq L_skip1 ; ( 4 states)
  23. mulxu r1,er3 ; (22 states)
  24. add.w r3,e2 ; ( 2 states)
  25. L_skip1:
  26. mov.w e1,r3 ; ( 2 states) c * b
  27. beq L_skip2 ; ( 4 states)
  28. mulxu r0,er3 ; (22 states)
  29. add.w r3,e2 ; ( 2 states)
  30. L_skip2:
  31. mov.l er2,er0 ; ( 2 states)
  32. rts ; (10 states)
  33. .end