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