2 dnl m4 macros for Mac OS 64-bit assembly.
4 dnl Copyright 2005, 2006 Free Software Foundation, Inc.
6 dnl This file is part of the GNU MP Library.
8 dnl The GNU MP Library is free software; you can redistribute it and/or
9 dnl modify it under the terms of the GNU Lesser General Public License as
10 dnl published by the Free Software Foundation; either version 3 of the
11 dnl License, or (at your option) any later version.
13 dnl The GNU MP Library is distributed in the hope that it will be useful,
14 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 dnl Lesser General Public License for more details.
18 dnl You should have received a copy of the GNU Lesser General Public License
19 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
21 define(`ASM_START',`')
23 dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
24 dnl EPILOGUE_cpu(GSYM_PREFIX`'foo)
29 define(`PROLOGUE_cpu',
36 define(`EPILOGUE_cpu',
39 dnl LEAL -- Load Effective Address Local. This is to be used for symbols
40 dnl defined in the same file. It will not work for externally defined
47 mflr r0 C save return address
50 addis $1, $1, ha16($2-1b)
51 la $1, lo16($2-1b)($1)
52 mtlr r0 C restore return address
58 dnl LEA -- Load Effective Address. This is to be used for symbols defined in
59 dnl another file. It will not work for locally defined symbols.
64 `define(`EPILOGUE_cpu',
65 ` .non_lazy_symbol_pointer
70 mflr r0 C save return address
73 addis $1, $1, ha16(`L'$2`'$non_lazy_ptr-1b)
74 ld $1, lo16(`L'$2`'$non_lazy_ptr-1b)($1)
75 mtlr r0 C restore return address
90 m4_assert_numargs_range(1,2)
92 ALIGN(ifelse($#,1,2,$2))
100 `bl GSYM_PREFIX`'$1')
102 define(`ASM_END', `dnl')