int_mul_impl.inc 815 B

123456789101112131415161718192021222324252627282930313233
  1. //===-- int_mul_impl.inc - Integer multiplication -------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // Helpers used by __mulsi3, __muldi3.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef __mulxi3
  13. #error "__mulxi3 must be defined to use this generic implementation"
  14. #endif
  15. .text
  16. .align 2
  17. .globl __mulxi3
  18. .type __mulxi3, @function
  19. __mulxi3:
  20. mv a2, a0
  21. mv a0, zero
  22. .L1:
  23. andi a3, a1, 1
  24. beqz a3, .L2
  25. add a0, a0, a2
  26. .L2:
  27. srli a1, a1, 1
  28. slli a2, a2, 1
  29. bnez a1, .L1
  30. ret