beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / powerpc64 / darwin.m4
bloba3180e48fd77312ce150e879819f715e2d99e075
1 divert(-1)
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.
7 dnl
8 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9 dnl  it under the terms of either:
10 dnl
11 dnl    * the GNU Lesser General Public License as published by the Free
12 dnl      Software Foundation; either version 3 of the License, or (at your
13 dnl      option) any later version.
14 dnl
15 dnl  or
16 dnl
17 dnl    * the GNU General Public License as published by the Free Software
18 dnl      Foundation; either version 2 of the License, or (at your option) any
19 dnl      later version.
20 dnl
21 dnl  or both in parallel, as here.
22 dnl
23 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
24 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26 dnl  for more details.
27 dnl
28 dnl  You should have received copies of the GNU General Public License and the
29 dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
30 dnl  see https://www.gnu.org/licenses/.
32 define(`ASM_START',`')
34 dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
35 dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
36 dnl
38 define(`DARWIN')
40 define(`PROLOGUE_cpu',
41 m4_assert_numargs_range(1,2)
42 `ifelse(`$2',toc,,
43 `ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
44         .text
45         .globl  $1
46         .align  5
47 $1:')
49 define(`EPILOGUE_cpu',
50 m4_assert_numargs(1))
52 dnl  LEAL -- Load Effective Address Local.  This is to be used for symbols
53 dnl  defined in the same file.  It will not work for externally defined
54 dnl  symbols.
56 define(`LEAL',
57 m4_assert_numargs(2)
58 `ifdef(`PIC',
60         mflr    r0                      C save return address
61         bcl     20, 31, 1f
62 1:      mflr    $1
63         addis   $1, $1, ha16($2-1b)
64         la      $1, lo16($2-1b)($1)
65         mtlr    r0                      C restore return address
66 ',`
67         lis     $1, ha16($2)
68         la      $1, lo16($2)($1)
69 ')')
71 dnl  LEA -- Load Effective Address.  This is to be used for symbols defined in
72 dnl  another file.  It will not work for locally defined symbols.
74 define(`LEA',
75 m4_assert_numargs(2)
76 `ifdef(`PIC',
77 `define(`EPILOGUE_cpu',
78 `       .non_lazy_symbol_pointer
79 `L'$2`'$non_lazy_ptr:
80         .indirect_symbol $2
81         .quad   0
83         mflr    r0                      C save return address
84         bcl     20, 31, 1f
85 1:      mflr    $1
86         addis   $1, $1, ha16(`L'$2`'$non_lazy_ptr-1b)
87         ld      $1, lo16(`L'$2`'$non_lazy_ptr-1b)($1)
88         mtlr    r0                      C restore return address
89 ',`
90         lis     $1, ha16($2)
91         la      $1, lo16($2)($1)
92 ')')
94 define(`EXTERN',
95 m4_assert_numargs(1)
96 `dnl')
98 define(`EXTERN_FUNC',
99 m4_assert_numargs(1)
100 `dnl')
102 define(`DEF_OBJECT',
103 m4_assert_numargs_range(1,2)
104 `       .const
105         ALIGN(ifelse($#,1,2,$2))
109 define(`END_OBJECT',
110 m4_assert_numargs(1))
112 define(`CALL',
113         `bl     GSYM_PREFIX`'$1')
115 define(`ASM_END', `dnl')
117 define(`EXTRA_REGISTER', r2)
119 divert