xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/sparc32/sparc-defs.m4 (revision 4d342c046e3288fb5a1edcd33cfec48c41c80664)
1divert(-1)
2
3dnl  m4 macros for SPARC assembler (32 and 64 bit).
4
5
6dnl  Copyright 2002, 2011, 2013 Free Software Foundation, Inc.
7
8dnl  This file is part of the GNU MP Library.
9dnl
10dnl  The GNU MP Library is free software; you can redistribute it and/or modify
11dnl  it under the terms of either:
12dnl
13dnl    * the GNU Lesser General Public License as published by the Free
14dnl      Software Foundation; either version 3 of the License, or (at your
15dnl      option) any later version.
16dnl
17dnl  or
18dnl
19dnl    * the GNU General Public License as published by the Free Software
20dnl      Foundation; either version 2 of the License, or (at your option) any
21dnl      later version.
22dnl
23dnl  or both in parallel, as here.
24dnl
25dnl  The GNU MP Library is distributed in the hope that it will be useful, but
26dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
27dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
28dnl  for more details.
29dnl
30dnl  You should have received copies of the GNU General Public License and the
31dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
32dnl  see https://www.gnu.org/licenses/.
33
34
35changecom(;)	dnl cannot use default # since that's used in REGISTER decls
36
37
38dnl  Usage: REGISTER(reg,attr)
39dnl
40dnl  Give a ".register reg,attr" directive, if the assembler supports it.
41dnl  HAVE_REGISTER comes from the GMP_ASM_SPARC_REGISTER configure test.
42
43define(REGISTER,
44m4_assert_numargs(2)
45m4_assert_defined(`HAVE_REGISTER')
46`ifelse(HAVE_REGISTER,yes,
47`.register `$1',`$2'')')
48
49
50C Testing mechanism for running newer code on older processors
51ifdef(`FAKE_T3',`
52  include_mpn(`sparc64/ultrasparct3/missing.m4')
53',`
54  define(`addxccc',	``addxccc'	$1, $2, $3')
55  define(`addxc',	``addxc'	$1, $2, $3')
56  define(`umulxhi',	``umulxhi'	$1, $2, $3')
57  define(`lzcnt',	``lzd'	$1, $2')
58')
59
60dnl  Usage: LEA64(symbol,reg,pic_reg)
61dnl
62dnl  Use whatever 64-bit code sequence is appropriate to load "symbol" into
63dnl  register "reg", potentially using register "pic_reg" to perform the
64dnl  calculations.
65
66define(LEA64,
67m4_assert_numargs(3)
68m4_assert_defined(`HAVE_GOTDATA')
69`ifdef(`PIC',`
70	rd	%pc, %`$2'
71	sethi	%hi(_GLOBAL_OFFSET_TABLE_+4), %`$3'
72	add	%`$3', %lo(_GLOBAL_OFFSET_TABLE_+8), %`$3'
73	add	%`$2', %`$3', %`$3'
74	sethi	%hi(`$1'), %`$2'
75	or	%`$2', %lo(`$1'), %`$2'
76	ldx	[%`$3' + %`$2'], %`$2'',`
77	setx	`$1', %`$3', %`$2'')')
78
79divert
80