tishift.S 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
  2. *
  3. * Copyright (C) 2017-2018 Jason A. Donenfeld <[email protected]>. All Rights Reserved.
  4. */
  5. #include <linux/linkage.h>
  6. #include <asm/assembler.h>
  7. SYM_FUNC_START(__ashlti3)
  8. cbz x2, 1f
  9. mov x3, #64
  10. sub x3, x3, x2
  11. cmp x3, #0
  12. b.le 2f
  13. lsl x1, x1, x2
  14. lsr x3, x0, x3
  15. lsl x2, x0, x2
  16. orr x1, x1, x3
  17. mov x0, x2
  18. 1:
  19. ret
  20. 2:
  21. neg w1, w3
  22. mov x2, #0
  23. lsl x1, x0, x1
  24. mov x0, x2
  25. ret
  26. SYM_FUNC_END(__ashlti3)
  27. EXPORT_SYMBOL(__ashlti3)
  28. SYM_FUNC_START(__ashrti3)
  29. cbz x2, 1f
  30. mov x3, #64
  31. sub x3, x3, x2
  32. cmp x3, #0
  33. b.le 2f
  34. lsr x0, x0, x2
  35. lsl x3, x1, x3
  36. asr x2, x1, x2
  37. orr x0, x0, x3
  38. mov x1, x2
  39. 1:
  40. ret
  41. 2:
  42. neg w0, w3
  43. asr x2, x1, #63
  44. asr x0, x1, x0
  45. mov x1, x2
  46. ret
  47. SYM_FUNC_END(__ashrti3)
  48. EXPORT_SYMBOL(__ashrti3)
  49. SYM_FUNC_START(__lshrti3)
  50. cbz x2, 1f
  51. mov x3, #64
  52. sub x3, x3, x2
  53. cmp x3, #0
  54. b.le 2f
  55. lsr x0, x0, x2
  56. lsl x3, x1, x3
  57. lsr x2, x1, x2
  58. orr x0, x0, x3
  59. mov x1, x2
  60. 1:
  61. ret
  62. 2:
  63. neg w0, w3
  64. mov x2, #0
  65. lsr x0, x1, x0
  66. mov x1, x2
  67. ret
  68. SYM_FUNC_END(__lshrti3)
  69. EXPORT_SYMBOL(__lshrti3)