You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

llshift.S 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
  2. .text
  3. .arm
  4. /**
  5. * Logical shift left
  6. *
  7. * @v r1:r0 Value to shift
  8. * @v r2 Shift amount
  9. * @ret r1:r0 Shifted value
  10. */
  11. .section ".text.__aeabi_llsl", "ax", %progbits
  12. .globl __aeabi_llsl
  13. .type __aeabi_llsl, %function
  14. __aeabi_llsl:
  15. /* r3 = ( shift - 32 ) */
  16. subs r3, r2, #32
  17. /* If shift >= 32, then
  18. * high = ( low << ( shift - 32 ) )
  19. */
  20. movpl r1, r0, lsl r3
  21. /* If shift < 32, then
  22. * high = ( ( high << shift ) | ( low >> ( 32 - shift ) ) )
  23. */
  24. movmi r1, r1, lsl r2
  25. rsbmi r3, r2, #32
  26. orrmi r1, r1, r0, lsr r3
  27. /* low = ( low << shift ) */
  28. mov r0, r0, lsl r2
  29. bx lr
  30. .size __aeabi_llsl, . - __aeabi_llsl
  31. /**
  32. * Logical shift right
  33. *
  34. * @v r1:r0 Value to shift
  35. * @v r2 Shift amount
  36. * @ret r1:r0 Shifted value
  37. */
  38. .section ".text.__aeabi_llsr", "ax", %progbits
  39. .globl __aeabi_llsr
  40. .type __aeabi_llsr, %function
  41. __aeabi_llsr:
  42. /* r3 = ( shift - 32 ) */
  43. subs r3, r2, #32
  44. /* If shift >= 32, then
  45. * low = ( high >> ( shift - 32 ) )
  46. */
  47. movpl r0, r1, lsr r3
  48. /* If shift < 32, then
  49. * low = ( ( low >> shift ) | ( high << ( 32 - shift ) ) )
  50. */
  51. movmi r0, r0, lsr r2
  52. rsbmi r3, r2, #32
  53. orrmi r0, r0, r1, lsl r3
  54. /* high = ( high >> shift ) */
  55. mov r1, r1, lsr r2
  56. bx lr
  57. .size __aeabi_llsr, . - __aeabi_llsr
  58. /**
  59. * Arithmetic shift right
  60. *
  61. * @v r1:r0 Value to shift
  62. * @v r2 Shift amount
  63. * @ret r1:r0 Shifted value
  64. */
  65. .section ".text.__aeabi_lasr", "ax", %progbits
  66. .globl __aeabi_lasr
  67. .type __aeabi_lasr, %function
  68. __aeabi_lasr:
  69. /* r3 = ( shift - 32 ) */
  70. subs r3, r2, #32
  71. /* If shift >= 32, then
  72. * low = ( high >> ( shift - 32 ) )
  73. */
  74. movpl r0, r1, asr r3
  75. /* If shift < 32, then
  76. * low = ( ( low >> shift ) | ( high << ( 32 - shift ) ) )
  77. */
  78. movmi r0, r0, lsr r2
  79. rsbmi r3, r2, #32
  80. orrmi r0, r0, r1, lsl r3
  81. /* high = ( high >> shift ) */
  82. mov r1, r1, asr r2
  83. bx lr
  84. .size __aeabi_lasr, . - __aeabi_lasr