aboutsummaryrefslogtreecommitdiff
path: root/arch/metag/lib/ashldi3.S
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2012-10-05 17:02:09 +0100
committerJames Hogan <james.hogan@imgtec.com>2013-03-02 20:09:52 +0000
commit086e9dc0e2ca925b1b58caefd04ed2757d14790b (patch)
treecfe182f1d07d40d09d2cae09e337423462250cac /arch/metag/lib/ashldi3.S
parentf507758ccbed5c354cc1ce3b8f53ea072d7bc222 (diff)
metag: Optimised library functions
Add optimised library functions for metag. Signed-off-by: James Hogan <james.hogan@imgtec.com>
Diffstat (limited to 'arch/metag/lib/ashldi3.S')
-rw-r--r--arch/metag/lib/ashldi3.S33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/metag/lib/ashldi3.S b/arch/metag/lib/ashldi3.S
new file mode 100644
index 00000000000..78d6974cffe
--- /dev/null
+++ b/arch/metag/lib/ashldi3.S
@@ -0,0 +1,33 @@
+! Copyright (C) 2012 by Imagination Technologies Ltd.
+!
+! 64-bit arithmetic shift left routine.
+!
+
+ .text
+ .global ___ashldi3
+ .type ___ashldi3,function
+
+___ashldi3:
+ MOV D0Re0,D0Ar2
+ MOV D1Re0,D1Ar1
+ CMP D1Ar3,#0 ! COUNT == 0
+ MOVEQ PC,D1RtP ! Yes, return
+
+ SUBS D0Ar4,D1Ar3,#32 ! N = COUNT - 32
+ BGE $L10
+
+!! Shift < 32
+ NEG D0Ar4,D0Ar4 ! N = - N
+ LSL D1Re0,D1Re0,D1Ar3 ! HI = HI << COUNT
+ LSR D0Ar6,D0Re0,D0Ar4 ! TMP= LO >> -(COUNT - 32)
+ OR D1Re0,D1Re0,D0Ar6 ! HI = HI | TMP
+ SWAP D0Ar4,D1Ar3
+ LSL D0Re0,D0Re0,D0Ar4 ! LO = LO << COUNT
+ MOV PC,D1RtP
+
+$L10:
+!! Shift >= 32
+ LSL D1Re0,D0Re0,D0Ar4 ! HI = LO << N
+ MOV D0Re0,#0 ! LO = 0
+ MOV PC,D1RtP
+ .size ___ashldi3,.-___ashldi3