• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1! Copyright (C) 2012 by Imagination Technologies Ltd.
2!
3! 64-bit multiply routine.
4!
5
6!
7! 64-bit signed/unsigned multiply
8!
9! A = D1Ar1:D0Ar2 = a 2^48 + b 2^32 +  c 2^16 + d 2^0
10!
11! B = D1Ar3:D0Ar4 = w 2^48 + x 2^32 +  y 2^16 + z 2^0
12!
13	.text
14	.global ___muldi3
15	.type   ___muldi3,function
16
17___muldi3:
18	MULD    D1Re0,D1Ar1,D0Ar4       ! (a 2^48 + b 2^32)(y 2^16 + z 2^0)
19	MULD    D0Re0,D0Ar2,D1Ar3       ! (w 2^48 + x 2^32)(c 2^16 + d 2^0)
20	ADD     D1Re0,D1Re0,D0Re0
21
22	MULW    D0Re0,D0Ar2,D0Ar4       ! (d 2^0)  * (z 2^0)
23
24	RTDW    D0Ar2,D0Ar2
25	MULW    D0Ar6,D0Ar2,D0Ar4       ! (c 2^16)(z 2^0)
26	LSR     D1Ar5,D0Ar6,#16
27	LSL     D0Ar6,D0Ar6,#16
28	ADDS    D0Re0,D0Re0,D0Ar6
29	ADDCS   D1Re0,D1Re0,#1
30	RTDW    D0Ar4,D0Ar4
31	ADD     D1Re0,D1Re0,D1Ar5
32
33	MULW    D0Ar6,D0Ar2,D0Ar4       ! (c 2^16)(y 2^16)
34	ADD     D1Re0,D1Re0,D0Ar6
35
36	RTDW    D0Ar2,D0Ar2
37	MULW    D0Ar6,D0Ar2,D0Ar4       ! (d 2^0)(y 2^16)
38	LSR     D1Ar5,D0Ar6,#16
39	LSL     D0Ar6,D0Ar6,#16
40	ADDS    D0Re0,D0Re0,D0Ar6
41	ADD     D1Re0,D1Re0,D1Ar5
42	ADDCS   D1Re0,D1Re0,#1
43	MOV     PC, D1RtP
44	.size ___muldi3,.-___muldi3
45