io-readsw.S 789 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. .Lnot_word_aligned:
  9. /*
  10. * Bad alignment will cause a hardware exception, which is as
  11. * good as anything. No need for us to check for proper alignment.
  12. */
  13. ld.uh r8, r12[0]
  14. sub r10, 1
  15. st.h r11++, r8
  16. /* fall through */
  17. .global __raw_readsw
  18. .type __raw_readsw,@function
  19. __raw_readsw:
  20. cp.w r10, 0
  21. reteq r12
  22. mov r9, 3
  23. tst r11, r9
  24. brne .Lnot_word_aligned
  25. sub r10, 2
  26. brlt 2f
  27. 1: ldins.h r8:t, r12[0]
  28. ldins.h r8:b, r12[0]
  29. st.w r11++, r8
  30. sub r10, 2
  31. brge 1b
  32. 2: sub r10, -2
  33. reteq r12
  34. ld.uh r8, r12[0]
  35. st.h r11++, r8
  36. retal r12