sub_n.S 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* MIPS2 __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
  2. store difference in a third limb vector.
  3. Copyright (C) 1995-2019 Free Software Foundation, Inc.
  4. This file is part of the GNU MP Library.
  5. The GNU MP Library is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU Lesser General Public License as published by
  7. the Free Software Foundation; either version 2.1 of the License, or (at your
  8. option) any later version.
  9. The GNU MP Library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  12. License for more details.
  13. You should have received a copy of the GNU Lesser General Public License
  14. along with the GNU MP Library. If not, see
  15. <http://www.gnu.org/licenses/>. */
  16. #include <sysdep.h>
  17. /* INPUT PARAMETERS
  18. res_ptr $4
  19. s1_ptr $5
  20. s2_ptr $6
  21. size $7
  22. */
  23. #ifdef __PIC__
  24. .option pic2
  25. #endif
  26. ENTRY (__mpn_sub_n)
  27. .set noreorder
  28. #ifdef __PIC__
  29. .cpload t9
  30. #endif
  31. .set nomacro
  32. lw $10,0($5)
  33. lw $11,0($6)
  34. addiu $7,$7,-1
  35. and $9,$7,4-1 /* number of limbs in first loop */
  36. beq $9,$0,L(L0) /* if multiple of 4 limbs, skip first loop */
  37. move $2,$0
  38. subu $7,$7,$9
  39. L(Loop0): addiu $9,$9,-1
  40. lw $12,4($5)
  41. addu $11,$11,$2
  42. lw $13,4($6)
  43. sltu $8,$11,$2
  44. subu $11,$10,$11
  45. sltu $2,$10,$11
  46. sw $11,0($4)
  47. or $2,$2,$8
  48. addiu $5,$5,4
  49. addiu $6,$6,4
  50. move $10,$12
  51. move $11,$13
  52. bne $9,$0,L(Loop0)
  53. addiu $4,$4,4
  54. L(L0): beq $7,$0,L(Lend)
  55. nop
  56. L(Loop): addiu $7,$7,-4
  57. lw $12,4($5)
  58. addu $11,$11,$2
  59. lw $13,4($6)
  60. sltu $8,$11,$2
  61. subu $11,$10,$11
  62. sltu $2,$10,$11
  63. sw $11,0($4)
  64. or $2,$2,$8
  65. lw $10,8($5)
  66. addu $13,$13,$2
  67. lw $11,8($6)
  68. sltu $8,$13,$2
  69. subu $13,$12,$13
  70. sltu $2,$12,$13
  71. sw $13,4($4)
  72. or $2,$2,$8
  73. lw $12,12($5)
  74. addu $11,$11,$2
  75. lw $13,12($6)
  76. sltu $8,$11,$2
  77. subu $11,$10,$11
  78. sltu $2,$10,$11
  79. sw $11,8($4)
  80. or $2,$2,$8
  81. lw $10,16($5)
  82. addu $13,$13,$2
  83. lw $11,16($6)
  84. sltu $8,$13,$2
  85. subu $13,$12,$13
  86. sltu $2,$12,$13
  87. sw $13,12($4)
  88. or $2,$2,$8
  89. addiu $5,$5,16
  90. addiu $6,$6,16
  91. bne $7,$0,L(Loop)
  92. addiu $4,$4,16
  93. L(Lend): addu $11,$11,$2
  94. sltu $8,$11,$2
  95. subu $11,$10,$11
  96. sltu $2,$10,$11
  97. sw $11,0($4)
  98. j $31
  99. or $2,$2,$8
  100. END (__mpn_sub_n)