Tizen 2.1 base
[external/gmp.git] / mpn / powerpc64 / darwin.m4
1 divert(-1)
2 dnl  m4 macros for Mac OS 64-bit assembly.
3
4 dnl  Copyright 2005, 2006 Free Software Foundation, Inc.
5 dnl
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
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.
12 dnl
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.
17 dnl
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/.
20
21 define(`ASM_START',`')
22
23 dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
24 dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
25 dnl
26
27 define(`DARWIN')
28
29 define(`PROLOGUE_cpu',
30 m4_assert_numargs(1)
31 `       .text
32         .globl  $1
33         .align  4
34 $1:')
35
36 define(`EPILOGUE_cpu',
37 m4_assert_numargs(1))
38
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
41 dnl  symbols.
42
43 define(`LEAL',
44 m4_assert_numargs(2)
45 `ifdef(`PIC',
46 `
47         mflr    r0                      C save return address
48         bcl     20, 31, 1f
49 1:      mflr    $1
50         addis   $1, $1, ha16($2-1b)
51         la      $1, lo16($2-1b)($1)
52         mtlr    r0                      C restore return address
53 ',`
54         lis     $1, ha16($2)
55         la      $1, lo16($2)($1)
56 ')')
57
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.
60
61 define(`LEA',
62 m4_assert_numargs(2)
63 `ifdef(`PIC',
64 `define(`EPILOGUE_cpu',
65 `       .non_lazy_symbol_pointer
66 `L'$2`'$non_lazy_ptr:
67         .indirect_symbol $2
68         .quad   0
69 ')
70         mflr    r0                      C save return address
71         bcl     20, 31, 1f
72 1:      mflr    $1
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
76 ',`
77         lis     $1, ha16($2)
78         la      $1, lo16($2)($1)
79 ')')
80
81 define(`EXTERN',
82 m4_assert_numargs(1)
83 `dnl')
84
85 define(`EXTERN_FUNC',
86 m4_assert_numargs(1)
87 `dnl')
88
89 define(`DEF_OBJECT',
90 m4_assert_numargs_range(1,2)
91 `       .const
92         ALIGN(ifelse($#,1,2,$2))
93 $1:
94 ')
95
96 define(`END_OBJECT',
97 m4_assert_numargs(1))
98
99 define(`CALL',
100         `bl     GSYM_PREFIX`'$1')
101
102 define(`ASM_END', `dnl')
103
104 divert