1divert(-1) 2 3dnl m4 macros for SPARC assembler (32 and 64 bit). 4 5 6dnl Copyright 2002, 2011, 2013, 2017 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. 65dnl 66dnl Caveat: We used to use the setx pseudo insn here, but some GNU/Linux 67dnl releases causes invalid code or relocs for that. 68dnl 69dnl Optimisation 1: Use thunk call instead of RDPC which causes pipeline 70dnl replay for some sparcs. 71dnl 72dnl Optimisation 2: Do the two symbol building sequences in parallel instead 73dnl of one after the other. That might need one more scratch register. 74 75define(LEA64, 76m4_assert_numargs(3) 77m4_assert_defined(`HAVE_GOTDATA') 78`ifdef(`PIC',` 79 rd %pc, %`$2' 80 sethi %hi(_GLOBAL_OFFSET_TABLE_+4), %`$3' 81 add %`$3', %lo(_GLOBAL_OFFSET_TABLE_+8), %`$3' 82 add %`$2', %`$3', %`$3' 83 sethi %gdop_hix22(`$1'), %`$2' 84 xor %`$2', %gdop_lox10(`$1'), %`$2' 85 ldx [%`$3' + %`$2'], %`$2', %gdop(`$1') 86',` 87 sethi %h44(`$1'), %`$2' 88 or %`$2', %m44(`$1'), %`$2' 89 sllx %`$2', 12, %`$2' 90 or %`$2', %l44(`$1'), %$2 91')') 92 93divert 94