xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/powerpc32/darwin.m4 (revision ce54336801cf28877c3414aa2fcb251dddd543a2)
1divert(-1)
2dnl  m4 macros for Mac OS 32-bit assembly.
3
4dnl  Copyright 2005, 2006 Free Software Foundation, Inc.
5
6dnl  This file is part of the GNU MP Library.
7dnl
8dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9dnl  it under the terms of either:
10dnl
11dnl    * the GNU Lesser General Public License as published by the Free
12dnl      Software Foundation; either version 3 of the License, or (at your
13dnl      option) any later version.
14dnl
15dnl  or
16dnl
17dnl    * the GNU General Public License as published by the Free Software
18dnl      Foundation; either version 2 of the License, or (at your option) any
19dnl      later version.
20dnl
21dnl  or both in parallel, as here.
22dnl
23dnl  The GNU MP Library is distributed in the hope that it will be useful, but
24dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26dnl  for more details.
27dnl
28dnl  You should have received copies of the GNU General Public License and the
29dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
30dnl  see https://www.gnu.org/licenses/.
31
32define(`ASM_START',`')
33
34dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
35dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
36dnl
37
38define(`PROLOGUE_cpu',
39m4_assert_numargs_range(1,2)
40`ifelse(`$2',toc,,
41`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
42	.text
43	.globl	$1
44	.align	3
45$1:')
46
47define(`EPILOGUE_cpu',
48m4_assert_numargs(1))
49
50
51dnl  LEA -- Load Effective Address.
52
53define(`LEA',
54m4_assert_numargs(2)
55`ifdef(`PIC',
56`	mflr	r0			C save return address
57	bcl	20, 31, 1f
581:	mflr	$1
59	addis	$1, $1, ha16($2-1b)
60	la	$1, lo16($2-1b)($1)
61	mtlr	r0			C restore return address
62',`
63	lis	$1, ha16($2)
64	la	$1, lo16($2)($1)
65')')
66
67define(`LEAL',
68m4_assert_numargs(2)
69`LEA($1,$2)')
70
71
72define(`EXTERN',
73m4_assert_numargs(1)
74`dnl')
75
76define(`DEF_OBJECT',
77m4_assert_numargs_range(1,2)
78`	.const
79	ALIGN(ifelse($#,1,2,$2))
80$1:
81')
82
83define(`END_OBJECT',
84m4_assert_numargs(1))
85
86define(`ASM_END', `dnl')
87
88ifdef(`PIC',`
89define(`PIC_SLOW')')
90
91divert
92