adddi3.S revision 1.1.1.1.4.2 1 1.1.1.1.4.2 martin ; Copyright (C) 2017-2018 Free Software Foundation, Inc.
2 1.1.1.1.4.2 martin ; Contributed by Sebastian Perta.
3 1.1.1.1.4.2 martin ;
4 1.1.1.1.4.2 martin ; This file is free software; you can redistribute it and/or modify it
5 1.1.1.1.4.2 martin ; under the terms of the GNU General Public License as published by the
6 1.1.1.1.4.2 martin ; Free Software Foundation; either version 3, or (at your option) any
7 1.1.1.1.4.2 martin ; later version.
8 1.1.1.1.4.2 martin ;
9 1.1.1.1.4.2 martin ; This file is distributed in the hope that it will be useful, but
10 1.1.1.1.4.2 martin ; WITHOUT ANY WARRANTY; without even the implied warranty of
11 1.1.1.1.4.2 martin ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 1.1.1.1.4.2 martin ; General Public License for more details.
13 1.1.1.1.4.2 martin ;
14 1.1.1.1.4.2 martin ; Under Section 7 of GPL version 3, you are granted additional
15 1.1.1.1.4.2 martin ; permissions described in the GCC Runtime Library Exception, version
16 1.1.1.1.4.2 martin ; 3.1, as published by the Free Software Foundation.
17 1.1.1.1.4.2 martin ;
18 1.1.1.1.4.2 martin ; You should have received a copy of the GNU General Public License and
19 1.1.1.1.4.2 martin ; a copy of the GCC Runtime Library Exception along with this program;
20 1.1.1.1.4.2 martin ; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
21 1.1.1.1.4.2 martin ; <http://www.gnu.org/licenses/>.
22 1.1.1.1.4.2 martin
23 1.1.1.1.4.2 martin
24 1.1.1.1.4.2 martin #include "vregs.h"
25 1.1.1.1.4.2 martin
26 1.1.1.1.4.2 martin .text
27 1.1.1.1.4.2 martin
28 1.1.1.1.4.2 martin START_FUNC ___adddi3
29 1.1.1.1.4.2 martin
30 1.1.1.1.4.2 martin movw hl, sp ; use HL-based addressing (allows for direct addw)
31 1.1.1.1.4.2 martin
32 1.1.1.1.4.2 martin movw ax, [hl+4]
33 1.1.1.1.4.2 martin addw ax, [hl+12]
34 1.1.1.1.4.2 martin movw r8, ax
35 1.1.1.1.4.2 martin
36 1.1.1.1.4.2 martin mov a, [hl+6] ; middle bytes of the result are determined using 8-bit
37 1.1.1.1.4.2 martin addc a, [hl+14] ; ADDC insns which both account for and update the carry bit
38 1.1.1.1.4.2 martin mov r10, a ; (no ADDWC instruction is available)
39 1.1.1.1.4.2 martin mov a, [hl+7]
40 1.1.1.1.4.2 martin addc a, [hl+15]
41 1.1.1.1.4.2 martin mov r11, a
42 1.1.1.1.4.2 martin
43 1.1.1.1.4.2 martin mov a, [hl+8]
44 1.1.1.1.4.2 martin addc a, [hl+16]
45 1.1.1.1.4.2 martin mov r12, a
46 1.1.1.1.4.2 martin mov a, [hl+9]
47 1.1.1.1.4.2 martin addc a, [hl+17]
48 1.1.1.1.4.2 martin mov r13, a
49 1.1.1.1.4.2 martin
50 1.1.1.1.4.2 martin movw ax, [hl+10]
51 1.1.1.1.4.2 martin sknc ; account for the possible carry from the
52 1.1.1.1.4.2 martin incw ax ; latest 8-bit operation
53 1.1.1.1.4.2 martin addw ax, [hl+18]
54 1.1.1.1.4.2 martin movw r14, ax
55 1.1.1.1.4.2 martin
56 1.1.1.1.4.2 martin ret
57 1.1.1.1.4.2 martin
58 1.1.1.1.4.2 martin END_FUNC ___adddi3
59