ashrdi3.S 867 B

12345678910111213141516171819202122232425262728293031323334
  1. ! Copyright (C) 2012 by Imagination Technologies Ltd.
  2. !
  3. ! 64-bit arithmetic shift right routine.
  4. !
  5. .text
  6. .global ___ashrdi3
  7. .type ___ashrdi3,function
  8. ___ashrdi3:
  9. MOV D0Re0,D0Ar2
  10. MOV D1Re0,D1Ar1
  11. CMP D1Ar3,#0 ! COUNT == 0
  12. MOVEQ PC,D1RtP ! Yes, return
  13. MOV D0Ar4,D1Ar3
  14. SUBS D1Ar3,D1Ar3,#32 ! N = COUNT - 32
  15. BGE $L20
  16. !! Shift < 32
  17. NEG D1Ar3,D1Ar3 ! N = - N
  18. LSR D0Re0,D0Re0,D0Ar4 ! LO = LO >> COUNT
  19. LSL D0Ar6,D1Re0,D1Ar3 ! TMP= HI << -(COUNT - 32)
  20. OR D0Re0,D0Re0,D0Ar6 ! LO = LO | TMP
  21. SWAP D1Ar3,D0Ar4
  22. ASR D1Re0,D1Re0,D1Ar3 ! HI = HI >> COUNT
  23. MOV PC,D1RtP
  24. $L20:
  25. !! Shift >= 32
  26. ASR D0Re0,D1Re0,D1Ar3 ! LO = HI >> N
  27. ASR D1Re0,D1Re0,#31 ! HI = HI >> 31
  28. MOV PC,D1RtP
  29. .size ___ashrdi3,.-___ashrdi3