modsi3.S 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //===----------------------Hexagon builtin routine ------------------------===//
  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. .macro FUNCTION_BEGIN name
  9. .text
  10. .p2align 5
  11. .globl \name
  12. .type \name, @function
  13. \name:
  14. .endm
  15. .macro FUNCTION_END name
  16. .size \name, . - \name
  17. .endm
  18. FUNCTION_BEGIN __hexagon_modsi3
  19. {
  20. p2 = cmp.ge(r0,#0)
  21. r2 = abs(r0)
  22. r1 = abs(r1)
  23. }
  24. {
  25. r3 = cl0(r2)
  26. r4 = cl0(r1)
  27. p0 = cmp.gtu(r1,r2)
  28. }
  29. {
  30. r3 = sub(r4,r3)
  31. if (p0) jumpr r31
  32. }
  33. {
  34. p1 = cmp.eq(r3,#0)
  35. loop0(1f,r3)
  36. r0 = r2
  37. r2 = lsl(r1,r3)
  38. }
  39. .falign
  40. 1:
  41. {
  42. p0 = cmp.gtu(r2,r0)
  43. if (!p0.new) r0 = sub(r0,r2)
  44. r2 = lsr(r2,#1)
  45. if (p1) r1 = #0
  46. }:endloop0
  47. {
  48. p0 = cmp.gtu(r2,r0)
  49. if (!p0.new) r0 = sub(r0,r1)
  50. if (p2) jumpr r31
  51. }
  52. {
  53. r0 = neg(r0)
  54. jumpr r31
  55. }
  56. FUNCTION_END __hexagon_modsi3
  57. .globl __qdsp_modsi3
  58. .set __qdsp_modsi3, __hexagon_modsi3