Debian Codegraph @

libgcc/config/pru/mpyll.S

raw
1 /* Copyright (C) 2014-2025 Free Software Foundation, Inc.
2 Contributed by Dimitar Dimitrov <[email protected]>
3
4 This file is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 3, or (at your option) any
7 later version.
8
9 This file is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 Under Section 7 of GPL version 3, you are granted additional
15 permissions described in the GCC Runtime Library Exception, version
16 3.1, as published by the Free Software Foundation.
17
18 You should have received a copy of the GNU General Public License and
19 a copy of the GCC Runtime Library Exception along with this program;
20 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
21 <http://www.gnu.org/licenses/>.
22
23 (al + C * ah) * (bl + C * bh) = al * bl
24 + C * ah * bl
25 + C * al * bh
26 + C * C * ah * bh -> discard, overflow
27 Where C=(1 << 32)
28 */
29
30 #include "pru-asm.h"
31
32 .section .text.__pruabi_mpyll, "ax"
33
34 .global SYM(__pruabi_mpyll)
35 FUNC(__pruabi_mpyll)
36 SYM(__pruabi_mpyll):
37 /* + C * ah * bl */
38 mov r28, r15
39 mov r29, r16
40 nop
41 xin 0, r26, 8
42
43 /* + C * al * bh */
44 mov r28, r14
45 mov r29, r17
46 mov r15, r26 /* "Loose" ah, record only reslo. */
47 xin 0, r26, 8
48
49 /* + al * bl */
50 /* mov r28, r14 -> No need, already loaded. */
51 mov r29, r16
52 add r15, r15, r26
53 xin 0, r26, 8
54 mov r14, r26
55 add r15, r15, r27
56
57 ret
58
59 ENDFUNC(__pruabi_mpyll)