Imported Upstream version 6.0.0
[platform/upstream/gmp.git] / mpn / arm / arm-defs.m4
1 divert(-1)
2
3 dnl  m4 macros for ARM assembler.
4
5 dnl  Copyright 2001, 2012, 2013 Free Software Foundation, Inc.
6
7 dnl  This file is part of the GNU MP Library.
8 dnl
9 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
10 dnl  it under the terms of either:
11 dnl
12 dnl    * the GNU Lesser General Public License as published by the Free
13 dnl      Software Foundation; either version 3 of the License, or (at your
14 dnl      option) any later version.
15 dnl
16 dnl  or
17 dnl
18 dnl    * the GNU General Public License as published by the Free Software
19 dnl      Foundation; either version 2 of the License, or (at your option) any
20 dnl      later version.
21 dnl
22 dnl  or both in parallel, as here.
23 dnl
24 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
25 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
27 dnl  for more details.
28 dnl
29 dnl  You should have received copies of the GNU General Public License and the
30 dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
31 dnl  see https://www.gnu.org/licenses/.
32
33
34 dnl  Standard commenting is with @, the default m4 # is for constants and we
35 dnl  don't want to disable macro expansions in or after them.
36
37 changecom(@&*$)
38
39
40 dnl  APCS register names.
41
42 deflit(a1,r0)
43 deflit(a2,r1)
44 deflit(a3,r2)
45 deflit(a4,r3)
46 deflit(v1,r4)
47 deflit(v2,r5)
48 deflit(v3,r6)
49 deflit(v4,r7)
50 deflit(v5,r8)
51 deflit(v6,r9)
52 deflit(sb,r9)
53 deflit(v7,r10)
54 deflit(sl,r10)
55 deflit(fp,r11)
56 deflit(ip,r12)
57 deflit(sp,r13)
58 deflit(lr,r14)
59 deflit(pc,r15)
60
61
62 define(`lea_list', `')
63 define(`lea_num',0)
64
65 dnl  LEA(reg,gmp_symbol)
66 dnl
67 dnl  Load the address of gmp_symbol into a register.  The gmp_symbol must be
68 dnl  either local or protected/hidden, since we assume it has a fixed distance
69 dnl  from the point of use.
70
71 define(`LEA',`dnl
72 ldr     $1, L(ptr`'lea_num)
73 ifdef(`PIC',dnl
74 `dnl
75 L(bas`'lea_num):dnl
76         add     $1, $1, pc`'dnl
77         m4append(`lea_list',`
78 L(ptr'lea_num`):        .word   GSYM_PREFIX`'$2-L(bas'lea_num`)-8')
79         define(`lea_num', eval(lea_num+1))dnl
80 ',`dnl
81         m4append(`lea_list',`
82 L(ptr'lea_num`):        .word   GSYM_PREFIX`'$2')
83         define(`lea_num', eval(lea_num+1))dnl
84 ')dnl
85 ')
86
87 define(`EPILOGUE_cpu',
88 `lea_list
89         SIZE(`$1',.-`$1')')
90
91 divert