io-readsb.S 760 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (C) 2004-2006 Atmel Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. .text
  9. .Lnot_word_aligned:
  10. 1: ld.ub r8, r12[0]
  11. sub r10, 1
  12. st.b r11++, r8
  13. reteq r12
  14. tst r11, r9
  15. brne 1b
  16. /* fall through */
  17. .global __raw_readsb
  18. .type __raw_readsb,@function
  19. __raw_readsb:
  20. cp.w r10, 0
  21. mov r9, 3
  22. reteq r12
  23. tst r11, r9
  24. brne .Lnot_word_aligned
  25. sub r10, 4
  26. brlt 2f
  27. 1: ldins.b r8:t, r12[0]
  28. ldins.b r8:u, r12[0]
  29. ldins.b r8:l, r12[0]
  30. ldins.b r8:b, r12[0]
  31. st.w r11++, r8
  32. sub r10, 4
  33. brge 1b
  34. 2: sub r10, -4
  35. reteq r12
  36. 3: ld.ub r8, r12[0]
  37. sub r10, 1
  38. st.b r11++, r8
  39. brne 3b
  40. retal r12