lshift.asm
上传用户:qaz666999
上传日期:2022-08-06
资源大小:2570k
文件大小:2k
源码类别:

数学计算

开发平台:

Unix_Linux

  1. dnl  MIPS32 mpn_lshift -- Left shift.
  2. dnl  Copyright 1995, 2000, 2002 Free Software Foundation, Inc.
  3. dnl  This file is part of the GNU MP Library.
  4. dnl  The GNU MP Library is free software; you can redistribute it and/or modify
  5. dnl  it under the terms of the GNU Lesser General Public License as published
  6. dnl  by the Free Software Foundation; either version 3 of the License, or (at
  7. dnl  your option) any later version.
  8. dnl  The GNU MP Library is distributed in the hope that it will be useful, but
  9. dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
  11. dnl  License for more details.
  12. dnl  You should have received a copy of the GNU Lesser General Public License
  13. dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
  14. include(`../config.m4')
  15. C INPUT PARAMETERS
  16. C res_ptr $4
  17. C src_ptr $5
  18. C size $6
  19. C cnt $7
  20. ASM_START()
  21. PROLOGUE(mpn_lshift)
  22. sll $2,$6,2
  23. addu $5,$5,$2 C make r5 point at end of src
  24. lw $10,-4($5) C load first limb
  25. subu $13,$0,$7
  26. addu $4,$4,$2 C make r4 point at end of res
  27. addiu $6,$6,-1
  28. and $9,$6,4-1 C number of limbs in first loop
  29. beq $9,$0,.L0 C if multiple of 4 limbs, skip first loop
  30.  srl $2,$10,$13 C compute function result
  31. subu $6,$6,$9
  32. .Loop0: lw $3,-8($5)
  33. addiu $4,$4,-4
  34. addiu $5,$5,-4
  35. addiu $9,$9,-1
  36. sll $11,$10,$7
  37. srl $12,$3,$13
  38. move $10,$3
  39. or $8,$11,$12
  40. bne $9,$0,.Loop0
  41.  sw $8,0($4)
  42. .L0: beq $6,$0,.Lend
  43.  nop
  44. .Loop: lw $3,-8($5)
  45. addiu $4,$4,-16
  46. addiu $6,$6,-4
  47. sll $11,$10,$7
  48. srl $12,$3,$13
  49. lw $10,-12($5)
  50. sll $14,$3,$7
  51. or $8,$11,$12
  52. sw $8,12($4)
  53. srl $9,$10,$13
  54. lw $3,-16($5)
  55. sll $11,$10,$7
  56. or $8,$14,$9
  57. sw $8,8($4)
  58. srl $12,$3,$13
  59. lw $10,-20($5)
  60. sll $14,$3,$7
  61. or $8,$11,$12
  62. sw $8,4($4)
  63. srl $9,$10,$13
  64. addiu $5,$5,-16
  65. or $8,$14,$9
  66. bgtz $6,.Loop
  67.  sw $8,0($4)
  68. .Lend: sll $8,$10,$7
  69. j $31
  70. sw $8,-4($4)
  71. EPILOGUE(mpn_lshift)