Austin Schuh | dace2a6 | 2020-08-18 10:56:48 -0700 | [diff] [blame] | 1 | divert(-1) |
| 2 | |
| 3 | dnl m4 macros for MIPS assembly code (both 32-bit and 64-bit). |
| 4 | |
| 5 | |
| 6 | dnl Copyright 2000-2002 Free Software Foundation, Inc. |
| 7 | dnl |
| 8 | dnl This file is part of the GNU MP Library. |
| 9 | dnl |
| 10 | dnl The GNU MP Library is free software; you can redistribute it and/or modify |
| 11 | dnl it under the terms of either: |
| 12 | dnl |
| 13 | dnl * the GNU Lesser General Public License as published by the Free |
| 14 | dnl Software Foundation; either version 3 of the License, or (at your |
| 15 | dnl option) any later version. |
| 16 | dnl |
| 17 | dnl or |
| 18 | dnl |
| 19 | dnl * the GNU General Public License as published by the Free Software |
| 20 | dnl Foundation; either version 2 of the License, or (at your option) any |
| 21 | dnl later version. |
| 22 | dnl |
| 23 | dnl or both in parallel, as here. |
| 24 | dnl |
| 25 | dnl The GNU MP Library is distributed in the hope that it will be useful, but |
| 26 | dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 27 | dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 28 | dnl for more details. |
| 29 | dnl |
| 30 | dnl You should have received copies of the GNU General Public License and the |
| 31 | dnl GNU Lesser General Public License along with the GNU MP Library. If not, |
| 32 | dnl see https://www.gnu.org/licenses/. |
| 33 | |
| 34 | |
| 35 | dnl Usage: ASM_START() |
| 36 | define(`ASM_START', |
| 37 | m4_assert_numargs(0) |
| 38 | ` .set noreorder |
| 39 | .set nomacro') |
| 40 | |
| 41 | dnl Usage: X(value) |
| 42 | define(`X', |
| 43 | m4_assert_numargs(1) |
| 44 | `0x$1') |
| 45 | |
| 46 | dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo) |
| 47 | dnl EPILOGUE_cpu(GSYM_PREFIX`'foo) |
| 48 | |
| 49 | define(`PROLOGUE_cpu', |
| 50 | m4_assert_numargs(1) |
| 51 | ` .text |
| 52 | .align 4 |
| 53 | .globl $1 |
| 54 | .ent $1 |
| 55 | $1:') |
| 56 | |
| 57 | define(`EPILOGUE_cpu', |
| 58 | m4_assert_numargs(1) |
| 59 | ` .end $1') |
| 60 | |
| 61 | |
| 62 | dnl Usage: r0 ... r31 |
| 63 | dnl f0 ... f31 |
| 64 | dnl |
| 65 | dnl Map register names r0 to $0, and f0 to $f0, etc. |
| 66 | dnl |
| 67 | dnl defreg() is used to protect the $ in $0 (otherwise it would represent a |
| 68 | dnl macro argument). Double quoting is used to protect the f0 in $f0 |
| 69 | dnl (otherwise it would be an infinite recursion). |
| 70 | |
| 71 | forloop(i,0,31,`defreg(`r'i,$i)') |
| 72 | forloop(i,0,31,`deflit(`f'i,``$f''i)') |
| 73 | |
| 74 | |
| 75 | dnl Usage: ASM_END() |
| 76 | define(`ASM_END', |
| 77 | m4_assert_numargs(0) |
| 78 | ) |
| 79 | |
| 80 | divert |