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