Annotation of OpenXM_contrib/gmp/mpn/m68k/m68k-defs.m4, Revision 1.1
1.1 ! ohara 1: divert(-1)
! 2:
! 3: dnl m4 macros for 68k assembler.
! 4:
! 5: dnl Copyright 2001, 2002 Free Software Foundation, Inc.
! 6: dnl
! 7: dnl This file is part of the GNU MP Library.
! 8: dnl
! 9: dnl The GNU MP Library is free software; you can redistribute it and/or
! 10: dnl modify it under the terms of the GNU Lesser General Public License as
! 11: dnl published by the Free Software Foundation; either version 2.1 of the
! 12: dnl License, or (at your option) any later version.
! 13: dnl
! 14: dnl The GNU MP Library is distributed in the hope that it will be useful,
! 15: dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
! 16: dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! 17: dnl Lesser General Public License for more details.
! 18: dnl
! 19: dnl You should have received a copy of the GNU Lesser General Public
! 20: dnl License along with the GNU MP Library; see the file COPYING.LIB. If
! 21: dnl not, write to the Free Software Foundation, Inc., 59 Temple Place -
! 22: dnl Suite 330, Boston, MA 02111-1307, USA.
! 23:
! 24:
! 25: dnl The default m4 `#' commenting interferes with the assembler syntax for
! 26: dnl immediates. `|' would be correct, but it interferes with "||" in
! 27: dnl eval(). Would like to disable commenting, but that's not possible (see
! 28: dnl mpn/asm-defs.m4), so use `;' which should be harmless.
! 29:
! 30: changecom(;)
! 31:
! 32:
! 33: dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
! 34: dnl
! 35: dnl Same as the standard PROLOGUE, but align to 2 bytes not 4.
! 36:
! 37: define(`PROLOGUE_cpu',
! 38: m4_assert_numargs(1)
! 39: ` TEXT
! 40: ALIGN(2)
! 41: GLOBL `$1' GLOBL_ATTR
! 42: TYPE(`$1',`function')
! 43: `$1'LABEL_SUFFIX')
! 44:
! 45:
! 46: dnl Usage: d0, etc
! 47: dnl
! 48: dnl Expand to d0 or %d0 according to the assembler's requirements.
! 49: dnl
! 50: dnl Actually d0 expands to `d0' or %`d0', the quotes protecting against
! 51: dnl further expansion. Definitions are made even if d0 is to be just `d0',
! 52: dnl so that any m4 quoting problems will show up everywhere, not just on a
! 53: dnl %d0 system.
! 54: dnl
! 55: dnl Care must be taken with quoting when using these in a definition. For
! 56: dnl instance the quotes in the following are essential or two %'s will be
! 57: dnl produced when `counter' is used.
! 58: dnl
! 59: dnl define(counter, `d7')
! 60: dnl
! 61:
! 62: dnl Called: m68k_reg(r)
! 63: define(m68k_reg,
! 64: m4_assert_numargs(1)
! 65: m4_assert_defined(`WANT_REGISTER_PERCENT')
! 66: `ifelse(WANT_REGISTER_PERCENT,yes,%)`$1'')
! 67:
! 68: dnl Usage: m68k_defreg(r)
! 69: define(m68k_defreg,
! 70: m4_assert_numargs(1)
! 71: `deflit($1,`m68k_reg(`$1')')')
! 72:
! 73: m68k_defreg(d0)
! 74: m68k_defreg(d1)
! 75: m68k_defreg(d2)
! 76: m68k_defreg(d3)
! 77: m68k_defreg(d4)
! 78: m68k_defreg(d5)
! 79: m68k_defreg(d6)
! 80: m68k_defreg(d7)
! 81:
! 82: m68k_defreg(a0)
! 83: m68k_defreg(a1)
! 84: m68k_defreg(a2)
! 85: m68k_defreg(a3)
! 86: m68k_defreg(a4)
! 87: m68k_defreg(a5)
! 88: m68k_defreg(a6)
! 89: m68k_defreg(a7)
! 90:
! 91: m68k_defreg(sp)
! 92: m68k_defreg(pc)
! 93:
! 94:
! 95: dnl Usage: M(base)
! 96: dnl M(base,displacement)
! 97: dnl M(base,index,size)
! 98: dnl M(base,index,size,scale)
! 99: dnl M(base,+)
! 100: dnl M(-,base)
! 101: dnl
! 102: dnl `base' is an address register, `index' is a data register, `size' is w
! 103: dnl or l, and scale is 1, 2, 4 or 8.
! 104: dnl
! 105: dnl M(-,base) has it's arguments that way around to emphasise it's a
! 106: dnl pre-decrement, as opposed to M(base,+) a post-increment.
! 107: dnl
! 108: dnl Enhancement: Add the memory indirect modes, if/when they're needed.
! 109:
! 110: define(M,
! 111: m4_assert_numargs_range(1,4)
! 112: m4_assert_defined(`WANT_ADDRESSING')
! 113: `ifelse(WANT_ADDRESSING,mit,
! 114: `ifelse($#,1, ``$1'@')dnl
! 115: ifelse($#,2,
! 116: `ifelse($2,+, ``$1'@+',
! 117: `ifelse($1,-, ``$2'@-',
! 118: ``$1'@($2)')')')dnl
! 119: ifelse($#,3, ``$1'@(`$2':`$3')')dnl
! 120: ifelse($#,4, ``$1'@(`$2':`$3':$4)')',
! 121:
! 122: dnl WANT_ADDRESSING `motorola'
! 123: `ifelse($#,1, `(`$1')')dnl
! 124: ifelse($#,2,
! 125: `ifelse($2,+, `(`$1')+',
! 126: `ifelse($1,-, `-(`$2')',
! 127: `$2(`$1')')')')dnl
! 128: ifelse($#,3, `(`$1',`$2'.$3)')dnl
! 129: ifelse($#,4, `(`$1',`$2'.$3*$4)')')')
! 130:
! 131:
! 132: dnl Usage: addl etc
! 133: dnl
! 134: dnl m68k instructions with special handling for the suffix, with for
! 135: dnl instance addl expanding to addl or add.l as necessary.
! 136: dnl
! 137: dnl See also t-m68k-defs.pl which verifies all mnemonics used in the asm
! 138: dnl files have entries here.
! 139:
! 140: dnl Called: m68k_insn(mnemonic,suffix)
! 141: define(m68k_insn,
! 142: m4_assert_numargs(2)
! 143: m4_assert_defined(`WANT_DOT_SIZE')
! 144: `ifelse(WANT_DOT_SIZE,yes, ``$1'.``$2''',
! 145: ``$1$2'')')
! 146:
! 147: dnl Usage: m68k_definsn(mnemonic,suffix)
! 148: define(m68k_definsn,
! 149: m4_assert_numargs(2)
! 150: `deflit($1`'$2,`m68k_insn(`$1',`$2')')')
! 151:
! 152: m68k_definsn(add, l)
! 153: m68k_definsn(addx, l)
! 154: m68k_definsn(addq, l)
! 155: m68k_definsn(asl, l)
! 156: m68k_definsn(cmp, l)
! 157: m68k_definsn(clr, l)
! 158: m68k_definsn(divu, l)
! 159: m68k_definsn(eor, w)
! 160: m68k_definsn(lsl, l)
! 161: m68k_definsn(lsr, l)
! 162: m68k_definsn(move, l)
! 163: m68k_definsn(movem,l)
! 164: m68k_definsn(moveq,l)
! 165: m68k_definsn(mulu, l)
! 166: m68k_definsn(neg, l)
! 167: m68k_definsn(or, l)
! 168: m68k_definsn(roxl, l)
! 169: m68k_definsn(roxr, l)
! 170: m68k_definsn(sub, l)
! 171: m68k_definsn(subx, l)
! 172: m68k_definsn(subq, l)
! 173:
! 174:
! 175: dnl Usage: bra etc
! 176: dnl
! 177: dnl Expand to `bra', `jra' or `jbra' according to what the assembler will
! 178: dnl accept. The latter two give variable-sized branches in gas.
! 179: dnl
! 180: dnl See also t-m68k-defs.pl which verifies all the bXX branches used in the
! 181: dnl asm files have entries here.
! 182:
! 183: dnl Called: m68k_branch(cond)
! 184: define(m68k_branch,
! 185: m4_assert_numargs(1)
! 186: m4_assert_defined(`WANT_BRANCHES')
! 187: `ifelse(WANT_BRANCHES,jra, `j$1',
! 188: `ifelse(WANT_BRANCHES,jbra,`jb$1',
! 189: ``b$1'')')')
! 190:
! 191: dnl Called: m68k_defbranch(cond)
! 192: define(m68k_defbranch,
! 193: m4_assert_numargs(1)
! 194: `deflit(b$1,`m68k_branch(`$1')')')
! 195:
! 196: m68k_defbranch(ra)
! 197: m68k_defbranch(cc)
! 198: m68k_defbranch(cs)
! 199: m68k_defbranch(ls)
! 200: m68k_defbranch(eq)
! 201: m68k_defbranch(ne)
! 202:
! 203:
! 204: dnl Usage: scale_available_p
! 205: dnl
! 206: dnl Expand to 1 if a scale factor can be used in addressing modes, or 0 if
! 207: dnl not. M(a0,d0,l,4), meaning a0+d0*4, is not available in 68000 or
! 208: dnl 68010, but is in CPU32 and in 68020 and up.
! 209:
! 210: define(scale_available_p,
! 211: `m4_ifdef_anyof_p(
! 212: `HAVE_HOST_CPU_m68360'
! 213: `HAVE_HOST_CPU_m68020'
! 214: `HAVE_HOST_CPU_m68030'
! 215: `HAVE_HOST_CPU_m68040'
! 216: `HAVE_HOST_CPU_m68060')')
! 217:
! 218:
! 219: divert
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>