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