[BACK]Return to asm-defs.m4 CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / mpn

Diff for /OpenXM_contrib/gmp/mpn/Attic/asm-defs.m4 between version 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2000/09/09 14:12:20 version 1.1.1.2, 2003/08/25 16:06:16
Line 9  dnl  GNU m4 and OpenBSD 2.7 m4 will give filenames and
Line 9  dnl  GNU m4 and OpenBSD 2.7 m4 will give filenames and
 dnl  messages.  dnl  messages.
   
   
 dnl  Copyright (C) 1999, 2000 Free Software Foundation, Inc.  dnl  Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 dnl  dnl
 dnl  This file is part of the GNU MP Library.  dnl  This file is part of the GNU MP Library.
 dnl  dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or  dnl  The GNU MP Library is free software; you can redistribute it and/or
Line 112  dnl  eval() <<,>> - SysV m4 doesn't support shift oper
Line 112  dnl  eval() <<,>> - SysV m4 doesn't support shift oper
 dnl       SunOS 5.7 /usr/xpg4/m4 has them but /usr/ccs/m4 doesn't).  See  dnl       SunOS 5.7 /usr/xpg4/m4 has them but /usr/ccs/m4 doesn't).  See
 dnl       m4_lshift() and m4_rshift() below for workarounds.  dnl       m4_lshift() and m4_rshift() below for workarounds.
 dnl  dnl
 dnl  m4wrap() - in BSD m4, m4wrap() replaces any previous m4wrap() string,  dnl  m4wrap() sequence - in BSD m4, m4wrap() replaces any previous m4wrap()
 dnl       in SysV m4 it appends to it, and in GNU m4 it prepends.  See  dnl       string, in SysV m4 it appends to it, and in GNU m4 it prepends.
 dnl       m4wrap_prepend() below which brings uniformity to this.  dnl       See m4wrap_prepend() below which brings uniformity to this.
 dnl  dnl
   dnl  m4wrap() 0xFF - old versions of BSD m4 store EOF in a C "char" under an
   dnl       m4wrap() and on systems where char is unsigned by default a
   dnl       spurious 0xFF is output.  This has been observed on recent Unicos
   dnl       Alpha and MacOS X systems.  An autoconf test is used to check for
   dnl       this, see the m4wrap handling below.  It might work to end the
   dnl       m4wrap string with a dnl to consume the 0xFF, but that probably
   dnl       induces the offending m4's to read from an already closed "FILE
   dnl       *", which could be bad on a glibc style stdio.
   dnl
 dnl  __file__,__line__ - GNU m4 and OpenBSD 2.7 m4 provide these, and  dnl  __file__,__line__ - GNU m4 and OpenBSD 2.7 m4 provide these, and
 dnl       they're used here to make error messages more informative.  GNU m4  dnl       they're used here to make error messages more informative.  GNU m4
 dnl       gives an unhelpful "NONE 0" in an m4wrap(), but that's worked  dnl       gives an unhelpful "NONE 0" in an m4wrap(), but that's worked
Line 126  dnl       filename in __file__, so care should be take
Line 135  dnl       filename in __file__, so care should be take
 dnl       the same name as a file, or an unwanted expansion will occur when  dnl       the same name as a file, or an unwanted expansion will occur when
 dnl       printing an error or warning.  dnl       printing an error or warning.
 dnl  dnl
 dnl  OpenBSD 2.6 m4 - this m4 rejects decimal constants containing an 8 or 9  dnl  changecom() - BSD m4 changecom doesn't quite work like the man page
 dnl       in eval(), making it pretty much unusable.  This bug is confined  dnl       suggests, in particular "changecom" or "changecom()" doesn't
 dnl       to version 2.6 (it's not in 2.5, and has been fixed in 2.7).  dnl       disable the comment feature, and multi-character comment sequences
   dnl       don't seem to work.  If the default `#' and newline aren't
   dnl       suitable it's necessary to change it to something else,
   dnl       eg. changecom(;).
 dnl  dnl
   dnl  OpenBSD 2.6 m4 - in this m4, eval() rejects decimal constants containing
   dnl       an 8 or 9, making it pretty much unusable.  The bug is confined to
   dnl       version 2.6 (it's not in 2.5, and has been fixed in 2.7).
   dnl
 dnl  SunOS /usr/bin/m4 - this m4 lacks a number of desired features,  dnl  SunOS /usr/bin/m4 - this m4 lacks a number of desired features,
 dnl       including $# and $@, defn(), m4exit(), m4wrap(), pushdef(),  dnl       including $# and $@, defn(), m4exit(), m4wrap(), pushdef(),
 dnl       popdef().  /usr/5bin/m4 is a SysV style m4 which should always be  dnl       popdef().  /usr/5bin/m4 is a SysV style m4 which should always be
Line 211  define(m4wrap_prepend,
Line 227  define(m4wrap_prepend,
 m4_assert_numargs(1)  m4_assert_numargs(1)
 `define(`m4wrap_string',`$1'defn(`m4wrap_string'))')  `define(`m4wrap_string',`$1'defn(`m4wrap_string'))')
   
 m4wrap(`m4wrap_string')  
 define(m4wrap_string,`')  define(m4wrap_string,`')
   
   define(m4wrap_works_p,
   `ifelse(M4WRAP_SPURIOUS,yes,0,1)')
   
   ifelse(m4wrap_works_p,1,
   `m4wrap(`m4wrap_string')')
   
   
 dnl  Usage: m4_file_and_line  dnl  Usage: m4_file_and_line
 dnl  dnl
 dnl  Expand to the current file and line number, if the GNU m4 extensions  dnl  Expand to the current file and line number, if the GNU m4 extensions
Line 276  define(m4_warning,
Line 297  define(m4_warning,
 `m4_errprint_commas(m4_file_and_line`'$@)')  `m4_errprint_commas(m4_file_and_line`'$@)')
   
 define(m4_error,  define(m4_error,
 `define(`m4_error_occurred',1)m4_warning($@)')  `define(`m4_error_occurred',1)m4_warning($@)dnl
   ifelse(m4wrap_works_p,0,`m4exit(1)')')
   
 define(`m4_error_occurred',0)  define(`m4_error_occurred',0)
   
Line 721  m4_assert_numargs(2)
Line 743  m4_assert_numargs(2)
 `m4_lshift_internal(m4_div2_towards_zero($1),incr($2))')')')  `m4_lshift_internal(m4_div2_towards_zero($1),incr($2))')')')
   
   
   dnl  Usage: m4_popcount(n)
   dnl
   dnl  Expand to the number 1 bits in n.
   
   define(m4_popcount,
   m4_assert_numargs(1)
   `m4_popcount_internal(0,eval(`$1'))')
   
   dnl  Called: m4_popcount_internal(count,rem)
   define(m4_popcount_internal,
   m4_assert_numargs(2)
   `ifelse($2,0,$1,
   `m4_popcount_internal(eval($1+($2%2)),eval($2/2))')')
   
   
   dnl  Usage: m4_count_trailing_zeros(N)
   dnl
   dnl  Determine the number of trailing zero bits on N.  N is eval()ed and so
   dnl  can be an expression.  If N is zero an error is generated.
   
   define(m4_count_trailing_zeros,
   m4_assert_numargs(1)
   `m4_count_trailing_zeros_internal(eval(`$1'),0)')
   
   dnl  Called: m4_count_trailing_zeros_internal(val,count)
   define(m4_count_trailing_zeros_internal,
   m4_assert_numargs(2)
   `ifelse($1,0,
   `m4_error(`m4_count_trailing_zeros() given a zero value')',
   `ifelse(eval(($1)%2),1,`$2',
   `m4_count_trailing_zeros_internal(eval($1/2),incr($2))')')')
   
   
 dnl  Usage: deflit(name,value)  dnl  Usage: deflit(name,value)
 dnl  dnl
 dnl  Like define(), but "name" expands like a literal, rather than taking  dnl  Like define(), but "name" expands like a literal, rather than taking
Line 781  m4_assert_numargs(1)
Line 836  m4_assert_numargs(1)
 ')')')  ')')')
   
   
   dnl  Usage: m4_repeat(count,text)
   dnl
   dnl  Expand to the given repetitions of the given text.  A zero count is
   dnl  allowed, and expands to nothing.
   
   define(m4_repeat,
   m4_assert_numargs(2)
   `m4_repeat_internal(eval($1),`$2')')
   
   define(m4_repeat_internal,
   m4_assert_numargs(2)
   `ifelse(`$1',0,,
   `forloop(m4_repeat_internal_counter,1,$1,``$2'')')')
   
   
   dnl  Usage: m4_hex_lowmask(bits)
   dnl
   dnl  Generate a hex constant which is a low mask of the given number of
   dnl  bits.  For example m4_hex_lowmask(10) would give 0x3ff.
   
   define(m4_hex_lowmask,
   m4_assert_numargs(1)
   `m4_cpu_hex_constant(m4_hex_lowmask_internal1(eval(`$1')))')
   
   dnl  Called: m4_hex_lowmask_internal1(bits)
   define(m4_hex_lowmask_internal1,
   m4_assert_numargs(1)
   `ifelse($1,0,`0',
   `m4_hex_lowmask_internal2(eval(($1)%4),eval(($1)/4))')')
   
   dnl  Called: m4_hex_lowmask_internal(remainder,digits)
   define(m4_hex_lowmask_internal2,
   m4_assert_numargs(2)
   `ifelse($1,1,`1',
   `ifelse($1,2,`3',
   `ifelse($1,3,`7')')')dnl
   m4_repeat($2,`f')')
   
   
 dnl  --------------------------------------------------------------------------  dnl  --------------------------------------------------------------------------
   dnl  The following m4_list functions take a list as multiple arguments.
   dnl  Arguments are evaluated multiple times, there's no attempt at strict
   dnl  quoting.  Empty list elements are not allowed, since an empty final
   dnl  argument is ignored.  These restrictions don't affect the current uses,
   dnl  and make the implementation easier.
   
   
   dnl  Usage: m4_list_quote(list,...)
   dnl
   dnl  Produce a list with quoted commas, so it can be a single argument
   dnl  string.  For instance m4_list_quote(a,b,c) gives
   dnl
   dnl         a`,'b`,'c`,'
   dnl
   dnl  This can be used to put a list in a define,
   dnl
   dnl         define(foolist, m4_list_quote(a,b,c))
   dnl
   dnl  Which can then be used for instance as
   dnl
   dnl         m4_list_find(target, foolist)
   
   define(m4_list_quote,
   `ifelse(`$1',,,
   `$1`,'m4_list_quote(shift($@))')')
   
   
   dnl  Usage: m4_list_find(key,list,...)
   dnl
   dnl  Evaluate to 1 or 0 according to whether key is in the list elements.
   
   define(m4_list_find,
   m4_assert_numargs_range(1,1000)
   `ifelse(`$2',,0,
   `ifelse(`$1',`$2',1,
   `m4_list_find(`$1',shift(shift($@)))')')')
   
   
   dnl  Usage: m4_list_remove(key,list,...)
   dnl
   dnl  Evaluate to the given list with `key' removed (if present).
   
   define(m4_list_remove,
   m4_assert_numargs_range(1,1000)
   `ifelse(`$2',,,
   `ifelse(`$1',`$2',,`$2,')dnl
   m4_list_remove(`$1',shift(shift($@)))')')
   
   
   dnl  Usage: m4_list_first(list,...)
   dnl
   dnl  Evaluate to the first element of the list (if any).
   
   define(m4_list_first,`$1')
   
   
   dnl  Usage: m4_list_count(list,...)
   dnl
   dnl  Evaluate to the number of elements in the list.  This can't just use $#
   dnl  because the last element might be empty.
   
   define(m4_list_count,
   `m4_list_count_internal(0,$@)')
   
   dnl  Called: m4_list_internal(count,list,...)
   define(m4_list_count_internal,
   m4_assert_numargs_range(1,1000)
   `ifelse(`$2',,$1,
   `m4_list_count_internal(eval($1+1),shift(shift($@)))')')
   
   
   dnl  --------------------------------------------------------------------------
 dnl  Various assembler things, not specific to any particular CPU.  dnl  Various assembler things, not specific to any particular CPU.
 dnl  dnl
   
Line 801  m4_assert_defined(`CONFIG_TOP_SRCDIR')
Line 967  m4_assert_defined(`CONFIG_TOP_SRCDIR')
   
 dnl  Usage: C comment ...  dnl  Usage: C comment ...
 dnl  dnl
 dnl  "C" works like a FORTRAN-style comment character.  This can be used for  dnl  This works like a FORTRAN-style comment character.  It can be used for
 dnl  comments to the right of assembly instructions, where just dnl would  dnl  comments to the right of assembly instructions, where just dnl would
 dnl  remove the linefeed, and concatenate adjacent lines.  dnl  remove the newline and concatenate adjacent lines.
 dnl  dnl
 dnl  "C" and/or "dnl" are useful when an assembler doesn't support comments,  dnl  C and/or dnl are useful when an assembler doesn't support comments, or
 dnl  or where different assemblers for a particular CPU have different  dnl  where different assemblers for a particular CPU need different styles.
 dnl  comment styles.  The intermediate ".s" files will end up with no  dnl  The intermediate ".s" files will end up with no comments, just code.
 dnl  comments, just code.  
 dnl  dnl
 dnl  Using "C" is not intended to cause offence to anyone who doesn't like  dnl  Using C is not intended to cause offence to anyone who doesn't like
 dnl  FORTRAN; but if that happens it's an unexpected bonus.  dnl  FORTRAN; but if that happens it's an unexpected bonus.
   dnl
   dnl  During development, if comments are wanted in the .s files to help see
   dnl  what's expanding where, C can be redefined with something like
   dnl
   dnl         define(`C',`#')
   
 define(C, `  define(C, `
 dnl')  dnl')
Line 821  dnl  Various possible defines passed from the Makefile
Line 991  dnl  Various possible defines passed from the Makefile
 dnl  with ifdef() rather than be expanded.  dnl  with ifdef() rather than be expanded.
   
 m4_not_for_expansion(`PIC')  m4_not_for_expansion(`PIC')
   m4_not_for_expansion(`DLL_EXPORT')
   
 dnl  aors_n  dnl  aors_n
 m4_not_for_expansion(`OPERATION_add_n')  m4_not_for_expansion(`OPERATION_add_n')
 m4_not_for_expansion(`OPERATION_sub_n')  m4_not_for_expansion(`OPERATION_sub_n')
   
 dnl  aorsmul_n  dnl  aorsmul_1
 m4_not_for_expansion(`OPERATION_addmul_1')  m4_not_for_expansion(`OPERATION_addmul_1')
 m4_not_for_expansion(`OPERATION_submul_1')  m4_not_for_expansion(`OPERATION_submul_1')
   
Line 844  dnl  popham
Line 1015  dnl  popham
 m4_not_for_expansion(`OPERATION_popcount')  m4_not_for_expansion(`OPERATION_popcount')
 m4_not_for_expansion(`OPERATION_hamdist')  m4_not_for_expansion(`OPERATION_hamdist')
   
   dnl  lorrshift
   m4_not_for_expansion(`OPERATION_lshift')
   m4_not_for_expansion(`OPERATION_rshift')
   
   
 dnl  Usage: m4_config_gmp_mparam(`symbol')  dnl  Usage: m4_config_gmp_mparam(`symbol')
 dnl  dnl
 dnl  Check that `symbol' is defined.  If it isn't, issue an error and  dnl  Check that `symbol' is defined.  If it isn't, issue an error and
 dnl  terminate immediately.  The error message explains that the symbol  dnl  terminate immediately.  The error message explains that the symbol
 dnl  should be in config.m4, copied from gmp-mparam.h.  dnl  should be in config.m4, copied from gmp-mparam.h.
 dnl  dnl
 dnl  Processing is terminated immediately since missing something like  dnl  Termination is immediate since missing say SQR_KARATSUBA_THRESHOLD can
 dnl  KARATSUBA_SQR_THRESHOLD can lead to infinite loops with endless error  dnl  lead to infinite loops and endless error messages.
 dnl  messages.  
   
 define(m4_config_gmp_mparam,  define(m4_config_gmp_mparam,
 m4_assert_numargs(1)  m4_assert_numargs(1)
Line 907  m4_assert_numargs(2)
Line 1081  m4_assert_numargs(2)
 substr(`$2',0,1)``''substr(`$2',1))')  substr(`$2',0,1)``''substr(`$2',1))')
   
   
 dnl  Usage: m4_instruction_wrapper(num)  dnl  Usage: m4_instruction_wrapper()
 dnl  dnl
 dnl  Put this, unquoted, on a line on its own, at the start of a macro  dnl  Put this, unquoted, on a line on its own, at the start of a macro
 dnl  that's a wrapper around an assembler instruction.  It adds code to give  dnl  that's a wrapper around an assembler instruction.  It adds code to give
Line 928  dnl  "jmp foo" instead of the intended "jmp( foo)".  "
Line 1102  dnl  "jmp foo" instead of the intended "jmp( foo)".  "
 dnl  argument also provokes the error message.  dnl  argument also provokes the error message.
 dnl  dnl
 dnl  m4_instruction_wrapper should only be used with wrapped instructions  dnl  m4_instruction_wrapper should only be used with wrapped instructions
 dnl  that take arguments, since obviously something meant to be used as  dnl  that take arguments, since obviously something meant to be used as say
 dnl  plain "ret", say, doesn't want to give an error when used that way.  dnl  plain "ret" doesn't want to give an error when used that way.
   
 define(m4_instruction_wrapper,  define(m4_instruction_wrapper,
 m4_assert_numargs(0)  m4_assert_numargs(0)
 ``m4_instruction_wrapper_internal'(m4_doublequote($`'0),dnl  ``m4_instruction_wrapper_internal'(m4_doublequote($`'0),dnl
 m4_doublequote(ifdef(`__file__',__file__,`the m4 sources')),dnl  ifdef(`__file__',`m4_doublequote(__file__)',``the m4 sources''),dnl
 $`#',m4_doublequote($`'1))`dnl'')  $`#',m4_doublequote($`'1))`dnl'')
   
 dnl  Called: m4_instruction_wrapper_internal($0,`filename',$#,$1)  dnl  Called: m4_instruction_wrapper_internal($0,`filename',$#,$1)
Line 944  define(m4_instruction_wrapper_internal,
Line 1118  define(m4_instruction_wrapper_internal,
 ')')')  ')')')
   
   
   dnl  Usage: m4_cpu_hex_constant(string)
   dnl
   dnl  Expand to the string prefixed by a suitable `0x' hex marker.  This
   dnl  should be redefined as necessary for CPUs with different conventions.
   
   define(m4_cpu_hex_constant,
   m4_assert_numargs(1)
   `0x`$1'')
   
   
 dnl  Usage: UNROLL_LOG2, UNROLL_MASK, UNROLL_BYTES  dnl  Usage: UNROLL_LOG2, UNROLL_MASK, UNROLL_BYTES
 dnl         CHUNK_LOG2, CHUNK_MASK, CHUNK_BYTES  dnl         CHUNK_LOG2, CHUNK_MASK, CHUNK_BYTES
 dnl  dnl
Line 1007  deflit(UNROLL_BYTES,
Line 1191  deflit(UNROLL_BYTES,
 m4_assert_defined(`UNROLL_COUNT')  m4_assert_defined(`UNROLL_COUNT')
 m4_assert_defined(`BYTES_PER_MP_LIMB')  m4_assert_defined(`BYTES_PER_MP_LIMB')
 `eval(UNROLL_COUNT * BYTES_PER_MP_LIMB)')  `eval(UNROLL_COUNT * BYTES_PER_MP_LIMB)')
   
 deflit(CHUNK_LOG2,  deflit(CHUNK_LOG2,
 m4_assert_defined(`CHUNK_COUNT')  m4_assert_defined(`CHUNK_COUNT')
 `m4_log2(CHUNK_COUNT)')  `m4_log2(CHUNK_COUNT)')
Line 1059  define_mpn(cmp)
Line 1243  define_mpn(cmp)
 define_mpn(com_n)  define_mpn(com_n)
 define_mpn(copyd)  define_mpn(copyd)
 define_mpn(copyi)  define_mpn(copyi)
   define_mpn(count_leading_zeros)
   define_mpn(count_trailing_zeros)
   define_mpn(divexact_1)
 define_mpn(divexact_by3c)  define_mpn(divexact_by3c)
 define_mpn(divrem)  define_mpn(divrem)
 define_mpn(divrem_1)  define_mpn(divrem_1)
Line 1069  define_mpn(divrem_newton)
Line 1256  define_mpn(divrem_newton)
 define_mpn(dump)  define_mpn(dump)
 define_mpn(gcd)  define_mpn(gcd)
 define_mpn(gcd_1)  define_mpn(gcd_1)
   define_mpn(gcd_finda)
 define_mpn(gcdext)  define_mpn(gcdext)
 define_mpn(get_str)  define_mpn(get_str)
 define_mpn(hamdist)  define_mpn(hamdist)
Line 1081  define_mpn(lshift)
Line 1269  define_mpn(lshift)
 define_mpn(lshiftc)  define_mpn(lshiftc)
 define_mpn(mod_1)  define_mpn(mod_1)
 define_mpn(mod_1c)  define_mpn(mod_1c)
   define_mpn(mod_34lsub1)
   define_mpn(modexact_1_odd)
   define_mpn(modexact_1c_odd)
 define_mpn(mul)  define_mpn(mul)
 define_mpn(mul_1)  define_mpn(mul_1)
 define_mpn(mul_1c)  define_mpn(mul_1c)
   define_mpn(mul_2)
 define_mpn(mul_basecase)  define_mpn(mul_basecase)
 define_mpn(mul_n)  define_mpn(mul_n)
 define_mpn(perfect_square_p)  define_mpn(perfect_square_p)
 define_mpn(popcount)  define_mpn(popcount)
   define_mpn(preinv_divrem_1)
 define_mpn(preinv_mod_1)  define_mpn(preinv_mod_1)
 define_mpn(nand_n)  define_mpn(nand_n)
 define_mpn(nior_n)  define_mpn(nior_n)
Line 1099  define_mpn(scan0)
Line 1292  define_mpn(scan0)
 define_mpn(scan1)  define_mpn(scan1)
 define_mpn(set_str)  define_mpn(set_str)
 define_mpn(sqr_basecase)  define_mpn(sqr_basecase)
   define_mpn(sqr_diagonal)
 define_mpn(sub_n)  define_mpn(sub_n)
 define_mpn(sqrtrem)  define_mpn(sqrtrem)
 define_mpn(sub)  define_mpn(sub)
Line 1114  define_mpn(udiv_qrnnd)
Line 1308  define_mpn(udiv_qrnnd)
 define_mpn(xnor_n)  define_mpn(xnor_n)
 define_mpn(xor_n)  define_mpn(xor_n)
   
 define(`ASM_START',  
         `')  
   
 define(`PROLOGUE',  dnl  Defines for C global arrays and variables, with names matching what's
         `  dnl  used in the C code.
         TEXT  dnl
         ALIGN(4)  dnl  Notice that GSYM_PREFIX is included, unlike with the function defines
         GLOBL   GSYM_PREFIX`$1'  dnl  above.  Also, "deflit" is used so that something like __clz_tab(%ebx)
         TYPE(GSYM_PREFIX`$1',`function')  dnl  comes out as __gmpn_clz_tab(%ebx), for the benefit of CPUs with that
 GSYM_PREFIX`$1':')  dnl  style assembler syntax.
   
 define(`EPILOGUE',  deflit(__clz_tab,
         `  m4_assert_defined(`GSYM_PREFIX')
         SIZE(GSYM_PREFIX`$1',.-GSYM_PREFIX`$1')')  `GSYM_PREFIX`'MPN(`clz_tab')')
   
   deflit(modlimb_invert_table,
   m4_assert_defined(`GSYM_PREFIX')
   `GSYM_PREFIX`'__gmp_modlimb_invert_table')
   
   
   dnl  Usage: ASM_START()
   dnl
   dnl  Emit any directives needed once at the start of an assembler file, like
   dnl  ".set noreorder" or whatever.  The default for this is nothing, but
   dnl  it's redefined by CPU specific m4 files.
   
   define(ASM_START)
   
   
   dnl  Usage: PROLOGUE(foo[,param])
   dnl         EPILOGUE(foo)
   dnl
   dnl  Emit directives to start or end a function.  GSYM_PREFIX is added by
   dnl  these macros if necessary, so the given "foo" is what the function will
   dnl  be called in C.
   dnl
   dnl  The second parameter to PROLOGUE is used only for some CPUs and should
   dnl  be omitted if not required.
   dnl
   dnl  Nested or overlapping PROLOGUE/EPILOGUE pairs are allowed, if that
   dnl  makes sense for the system.  The name given to EPILOGUE must be a
   dnl  currently open PROLOGUE.
   dnl
   dnl  If only one PROLOGUE is open then the name can be omitted from
   dnl  EPILOGUE.  This is encouraged, since it means the name only has to
   dnl  appear in one place, not two.
   dnl
   dnl  The given name "foo" is not fully quoted here, it will be macro
   dnl  expanded more than once.  This is the way the m4_list macros work, and
   dnl  it also helps the tune/many.pl program do a renaming like
   dnl  -D__gmpn_add_n=mpn_add_n_foo when GSYM_PREFIX is not empty.
   
   define(PROLOGUE,
   m4_assert_numargs_range(1,2)
   `define(`PROLOGUE_list',m4_list_quote($1,PROLOGUE_list))dnl
   ifelse(`$2',,
   `PROLOGUE_cpu(GSYM_PREFIX`'$1)',
   `PROLOGUE_cpu(GSYM_PREFIX`'$1,`$2')')')
   
   define(EPILOGUE,
   m4_assert_numargs_range(0,1)
   `ifelse(`$1',,
   `ifelse(m4_list_count(PROLOGUE_list),0,
   `m4_error(`no open functions for EPILOGUE
   ')',
   `ifelse(m4_list_count(PROLOGUE_list),1,
   `EPILOGUE_internal(PROLOGUE_current_function)',
   `m4_error(`more than one open function for EPILOGUE
   ')')')',
   `EPILOGUE_internal(`$1')')')
   
   define(EPILOGUE_internal,
   m4_assert_numargs(1)
   m4_assert_defined(`EPILOGUE_cpu')
   `ifelse(m4_list_find($1,PROLOGUE_list),0,
   `m4_error(`EPILOGUE without PROLOGUE: $1
   ')')dnl
   define(`PROLOGUE_list',m4_list_quote(m4_list_remove($1,PROLOGUE_list)))dnl
   EPILOGUE_cpu(GSYM_PREFIX`$1')')
   
   dnl  Currently open PROLOGUEs, as a comma-separated list.
   define(PROLOGUE_list)
   
   
   dnl  Called: PROLOGUE_check(list,...)
   dnl  Check there's no remaining open PROLOGUEs at the end of input.
   define(PROLOGUE_check,
   `ifelse($1,,,
   `m4_error(`no EPILOGUE for: $1
   ')dnl
   PROLOGUE_check(shift($@))')')
   
   m4wrap_prepend(`PROLOGUE_check(PROLOGUE_list)')
   
   
   dnl  Usage: PROLOGUE_current_function
   dnl
   dnl  This macro expands to the current PROLOGUE/EPILOGUE function, or the
   dnl  most recent PROLOGUE if such pairs are nested or overlapped.
   
   define(PROLOGUE_current_function,
   m4_assert_numargs(-1)
   `m4_list_first(PROLOGUE_list)')
   
   
   dnl  Usage: PROLOGUE_cpu(GSYM_PREFIX`'foo[,param])
   dnl         EPILOGUE_cpu(GSYM_PREFIX`'foo)
   dnl
   dnl  These macros hold the CPU-specific parts of PROLOGUE and EPILOGUE.
   dnl  Both are called with the function name, with GSYM_PREFIX already
   dnl  prepended.
   dnl
   dnl  The definitions here are something typical and sensible, but CPU or
   dnl  system specific m4 files should redefine them as necessary.  The
   dnl  optional extra parameter to PROLOGUE_cpu is not expected and not
   dnl  accepted here.
   
   define(PROLOGUE_cpu,
   m4_assert_numargs(1)
   `       TEXT
           ALIGN(8)
           GLOBL   `$1' GLOBL_ATTR
           TYPE(`$1',`function')
   `$1'LABEL_SUFFIX')
   
   define(EPILOGUE_cpu,
   `       SIZE(`$1',.-`$1')')
   
   
   dnl  Usage: L(name)
   dnl
   dnl  Generate a local label with the given name.  This is simply a
   dnl  convenient way to add LSYM_PREFIX.
   dnl
 dnl  LSYM_PREFIX might be L$, so defn() must be used to quote it or the L  dnl  LSYM_PREFIX might be L$, so defn() must be used to quote it or the L
 dnl  will expand as the L macro, an infinite recursion.  dnl  will expand again as the L macro, making an infinite recursion.
 define(`L',`defn(`LSYM_PREFIX')$1')  
   
   define(`L',
   m4_assert_numargs(1)
   `defn(`LSYM_PREFIX')$1')
   
   
   dnl  Usage: INT32(label,value)
   dnl         INT64(label,first,second)
   
 define(`INT32',  define(`INT32',
         `  m4_assert_defined(`W32')
         ALIGN(4)  `       ALIGN(4)
 $1:  `$1'`'LABEL_SUFFIX
         W32     $2          W32     $2')
         ')  
   
 define(`INT64',  define(`INT64',
         `  m4_assert_defined(`W32')
         ALIGN(8)  `       ALIGN(8)
 $1:  `$1'`'LABEL_SUFFIX
         W32     $2          W32     $2
         W32     $3          W32     $3')
         ')  
   
   
 dnl  Usage: ALIGN(bytes)  dnl  Usage: ALIGN(bytes)
 dnl  dnl
 dnl  Emit a ".align" directive.  The alignment is specified in bytes, and  dnl  Emit a ".align" directive.  The alignment is specified in bytes, and
 dnl  will normally need to be a power of 2.  The actual ".align" generated  dnl  will normally need to be a power of 2.  The actual ".align" generated
 dnl  is either bytes or logarithmic according to what ./configure detects.  dnl  is either bytes or logarithmic according to what ./configure finds the
   dnl  assembler needs.
 dnl  dnl
 dnl  ALIGN_FILL_0x90, if defined and equal to "yes", means a ", 0x90" should  dnl  If ALIGN_FILL_0x90 is defined and equal to "yes", then ", 0x90" is
 dnl  be appended (this is for x86).  dnl  appended.  This is for x86, see mpn/x86/README.
   
 define(ALIGN,  define(ALIGN,
 m4_assert_numargs(1)  m4_assert_numargs(1)
Line 1176  dnl  names separated by spaces.
Line 1493  dnl  names separated by spaces.
   
 define(`MULFUNC_PROLOGUE',  define(`MULFUNC_PROLOGUE',
 m4_assert_numargs(1)  m4_assert_numargs(1)
 `')  )
   
   
   dnl  Usage: NAILS_SUPPORT(spec spec ...)
   dnl
   dnl  A dummy macro which is grepped for by ./configure to know what nails
   dnl  are supported in an asm file.
   dnl
   dnl  Ranges can be given, or just individual values.  Multiple values or
   dnl  ranges can be given, separated by spaces.  Multiple NAILS_SUPPORT
   dnl  declarations work too.  Some examples,
   dnl
   dnl         NAILS_SUPPORT(1-20)
   dnl         NAILS_SUPPORT(1 6 9-12)
   dnl         NAILS_SUPPORT(1-10 16-20)
   
   define(NAILS_SUPPORT,
   m4_assert_numargs(1)
   )
   
   
   dnl  Usage: GMP_NUMB_MASK
   dnl
   dnl  A bit masks for the number part of a limb.  Eg.  with 6 bit nails in a
   dnl  32 bit limb, GMP_NUMB_MASK would be 0x3ffffff.
   
   define(GMP_NUMB_MASK,
   m4_assert_numargs(-1)
   m4_assert_defined(`GMP_NUMB_BITS')
   `m4_hex_lowmask(GMP_NUMB_BITS)')
   
   
 divert`'dnl  divert`'dnl

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>