• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1! SPDX-License-Identifier: GPL-2.0
2! Copyright (C) 2012 by Imagination Technologies Ltd.
3!
4! 64-bit logical shift right routine.
5!
6
7	.text
8	.global ___lshrdi3
9	.type   ___lshrdi3,function
10
11___lshrdi3:
12	MOV     D0Re0,D0Ar2
13	MOV     D1Re0,D1Ar1
14	CMP     D1Ar3,#0                ! COUNT == 0
15	MOVEQ   PC,D1RtP                ! Yes, return
16
17	MOV     D0Ar4,D1Ar3
18	SUBS    D1Ar3,D1Ar3,#32         ! N = COUNT - 32
19	BGE     $L30
20
21!! Shift < 32
22	NEG     D1Ar3,D1Ar3             ! N = - N
23	LSR     D0Re0,D0Re0,D0Ar4       ! LO = LO >> COUNT
24	LSL     D0Ar6,D1Re0,D1Ar3       ! TMP= HI << -(COUNT - 32)
25	OR      D0Re0,D0Re0,D0Ar6       ! LO = LO | TMP
26	SWAP    D1Ar3,D0Ar4
27	LSR     D1Re0,D1Re0,D1Ar3       ! HI = HI >> COUNT
28	MOV     PC,D1RtP
29$L30:
30!! Shift >= 32
31	LSR     D0Re0,D1Re0,D1Ar3       ! LO = HI >> N
32	MOV     D1Re0,#0                ! HI = 0
33	MOV     PC,D1RtP
34	.size ___lshrdi3,.-___lshrdi3
35