Tizen 2.1 base
[external/gmp.git] / mpn / ia64 / ia64-defs.m4
1 divert(-1)
2
3
4 dnl  Copyright 2000, 2002, 2003 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
22 dnl  ia64 assembler comments are C++ style "//" to the end of line.  gas
23 dnl  also accepts "#" as a comment, if it's the first non-blank on a line.
24 dnl
25 dnl  BSD m4 can't handle a multi-character comment like "//" (see notes in
26 dnl  mpn/asm-defs.m4).  For now the default "#" is left, but with care taken
27 dnl  not to put any macros after "foo#" (since of course they won't expand).
28
29
30 define(`ASM_START',
31 m4_assert_numargs(0)
32 `')
33
34
35 dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
36 dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
37 dnl
38 dnl  32-byte alignment is used for the benefit of itanium-2, where the code
39 dnl  fetcher will only take 2 bundles from a 32-byte aligned target.  At
40 dnl  16mod32 it only reads 1 in the first cycle.  This might not make any
41 dnl  difference if the rotate buffers are full or there's other work holding
42 dnl  up execution, but we use 32-bytes to give the best chance of peak
43 dnl  throughput.
44 dnl
45 dnl  We can use .align here despite the gas bug noted in mpn/ia64/README,
46 dnl  since we're not expecting to execute across a PROLOGUE(), at least not
47 dnl  currently.
48
49 define(`PROLOGUE_cpu',
50 m4_assert_numargs(1)
51         `
52         .text
53         .align  32
54         .global $1#
55         .proc   $1#
56 $1:')
57
58 define(`EPILOGUE_cpu',
59 m4_assert_numargs(1)
60         `
61         .endp   $1#
62 ')
63
64 define(`DATASTART',
65         `dnl
66         DATA
67 $1:')
68 define(`DATAEND',`dnl')
69
70 define(`ASM_END',`dnl')
71
72
73 dnl  Usage: ALIGN(bytes)
74 dnl
75 dnl  Emit a ".align" directive.  "bytes" is eval()ed, so can be an
76 dnl  expression.
77 dnl
78 dnl  This version overrides the definition in mpn/asm-defs.m4.  We suppress
79 dnl  any .align if the gas byte-swapped-nops bug was detected by configure
80 dnl  GMP_ASM_IA64_ALIGN_OK.
81
82 define(`ALIGN',
83 m4_assert_numargs(1)
84 m4_assert_defined(`IA64_ALIGN_OK')
85 `ifelse(IA64_ALIGN_OK,no,,
86 `.align eval($1)')')
87
88
89 dnl  Usage: ASSERT([pr] [,code])
90 dnl
91 dnl  Require that the given predictate register is true after executing the
92 dnl  test code.  For example,
93 dnl
94 dnl         ASSERT(p6,
95 dnl         `       cmp.eq  p6,p0 = r3, r4')
96 dnl
97 dnl  If the predicate register argument is empty then nothing is tested, the
98 dnl  code is just executed.  This can be used for setups required by later
99 dnl  ASSERTs.  The code argument can be omitted to just test a predicate
100 dnl  with no special setup code.
101 dnl
102 dnl  For convenience, stops are inserted before and after the code emitted.
103
104 define(ASSERT,
105 m4_assert_numargs_range(1,2)
106 m4_assert_defined(`WANT_ASSERT')
107 `ifelse(WANT_ASSERT,1,
108 `       ;;
109 ifelse(`$2',,,
110 `$2
111         ;;
112 ')
113 ifelse(`$1',,,
114 `($1)   br      .LASSERTok`'ASSERT_label_counter ;;
115         cmp.ne  p6,p6 = r0, r0  C illegal instruction
116         ;;
117 .LASSERTok`'ASSERT_label_counter:
118 define(`ASSERT_label_counter',eval(ASSERT_label_counter+1))
119 ')
120 ')')
121 define(`ASSERT_label_counter',1)
122
123
124 divert