Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / arch / metag / lib / ashrdi3.S
blob7cb7ed3bb1ad6f422e687641e5f50274141caa1f
1 ! Copyright (C) 2012 by Imagination Technologies Ltd.
3 ! 64-bit arithmetic shift right routine.
6         .text
7         .global ___ashrdi3
8         .type   ___ashrdi3,function
10 ___ashrdi3:
11         MOV     D0Re0,D0Ar2
12         MOV     D1Re0,D1Ar1
13         CMP     D1Ar3,#0                ! COUNT == 0
14         MOVEQ   PC,D1RtP                ! Yes, return
16         MOV     D0Ar4,D1Ar3
17         SUBS    D1Ar3,D1Ar3,#32         ! N = COUNT - 32
18         BGE     $L20
20 !! Shift < 32
21         NEG     D1Ar3,D1Ar3             ! N = - N
22         LSR     D0Re0,D0Re0,D0Ar4       ! LO = LO >> COUNT
23         LSL     D0Ar6,D1Re0,D1Ar3       ! TMP= HI << -(COUNT - 32)
24         OR      D0Re0,D0Re0,D0Ar6       ! LO = LO | TMP
25         SWAP    D1Ar3,D0Ar4
26         ASR     D1Re0,D1Re0,D1Ar3       ! HI = HI >> COUNT
27         MOV     PC,D1RtP
28 $L20:
29 !! Shift >= 32
30         ASR     D0Re0,D1Re0,D1Ar3       ! LO = HI >> N
31         ASR     D1Re0,D1Re0,#31         ! HI = HI >> 31
32         MOV     PC,D1RtP
33         .size ___ashrdi3,.-___ashrdi3