Blame mpn/ia64/ia64-defs.m4

Packit 5c3484
divert(-1)
Packit 5c3484
Packit 5c3484
Packit 5c3484
dnl  Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
Packit 5c3484
Packit 5c3484
dnl  This file is part of the GNU MP Library.
Packit 5c3484
dnl
Packit 5c3484
dnl  The GNU MP Library is free software; you can redistribute it and/or modify
Packit 5c3484
dnl  it under the terms of either:
Packit 5c3484
dnl
Packit 5c3484
dnl    * the GNU Lesser General Public License as published by the Free
Packit 5c3484
dnl      Software Foundation; either version 3 of the License, or (at your
Packit 5c3484
dnl      option) any later version.
Packit 5c3484
dnl
Packit 5c3484
dnl  or
Packit 5c3484
dnl
Packit 5c3484
dnl    * the GNU General Public License as published by the Free Software
Packit 5c3484
dnl      Foundation; either version 2 of the License, or (at your option) any
Packit 5c3484
dnl      later version.
Packit 5c3484
dnl
Packit 5c3484
dnl  or both in parallel, as here.
Packit 5c3484
dnl
Packit 5c3484
dnl  The GNU MP Library is distributed in the hope that it will be useful, but
Packit 5c3484
dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit 5c3484
dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit 5c3484
dnl  for more details.
Packit 5c3484
dnl
Packit 5c3484
dnl  You should have received copies of the GNU General Public License and the
Packit 5c3484
dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
Packit 5c3484
dnl  see https://www.gnu.org/licenses/.
Packit 5c3484
Packit 5c3484
Packit 5c3484
dnl  ia64 assembler comments are C++ style "//" to the end of line.  gas
Packit 5c3484
dnl  also accepts "#" as a comment, if it's the first non-blank on a line.
Packit 5c3484
dnl
Packit 5c3484
dnl  BSD m4 can't handle a multi-character comment like "//" (see notes in
Packit 5c3484
dnl  mpn/asm-defs.m4).  For now the default "#" is left, but with care taken
Packit 5c3484
dnl  not to put any macros after "foo#" (since of course they won't expand).
Packit 5c3484
Packit 5c3484
Packit 5c3484
define(`ASM_START',
Packit 5c3484
m4_assert_numargs(0)
Packit 5c3484
`')
Packit 5c3484
Packit 5c3484
Packit 5c3484
dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
Packit 5c3484
dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
Packit 5c3484
dnl
Packit 5c3484
dnl  32-byte alignment is used for the benefit of itanium-2, where the code
Packit 5c3484
dnl  fetcher will only take 2 bundles from a 32-byte aligned target.  At
Packit 5c3484
dnl  16mod32 it only reads 1 in the first cycle.  This might not make any
Packit 5c3484
dnl  difference if the rotate buffers are full or there's other work holding
Packit 5c3484
dnl  up execution, but we use 32-bytes to give the best chance of peak
Packit 5c3484
dnl  throughput.
Packit 5c3484
dnl
Packit 5c3484
dnl  We can use .align here despite the gas bug noted in mpn/ia64/README,
Packit 5c3484
dnl  since we're not expecting to execute across a PROLOGUE(), at least not
Packit 5c3484
dnl  currently.
Packit 5c3484
Packit 5c3484
define(`PROLOGUE_cpu',
Packit 5c3484
m4_assert_numargs(1)
Packit 5c3484
	`
Packit 5c3484
	.text
Packit 5c3484
	.align	32
Packit 5c3484
	.global	$1#
Packit 5c3484
	.proc	$1#
Packit 5c3484
$1:')
Packit 5c3484
Packit 5c3484
define(`EPILOGUE_cpu',
Packit 5c3484
m4_assert_numargs(1)
Packit 5c3484
	`
Packit 5c3484
	.endp	$1#
Packit 5c3484
')
Packit 5c3484
Packit 5c3484
define(`DATASTART',
Packit 5c3484
	`dnl
Packit 5c3484
	DATA
Packit 5c3484
$1:')
Packit 5c3484
define(`DATAEND',`dnl')
Packit 5c3484
Packit 5c3484
define(`ASM_END',`dnl')
Packit 5c3484
Packit 5c3484
Packit 5c3484
dnl  Usage: ALIGN(bytes)
Packit 5c3484
dnl
Packit 5c3484
dnl  Emit a ".align" directive.  "bytes" is eval()ed, so can be an
Packit 5c3484
dnl  expression.
Packit 5c3484
dnl
Packit 5c3484
dnl  This version overrides the definition in mpn/asm-defs.m4.  We suppress
Packit 5c3484
dnl  any .align if the gas byte-swapped-nops bug was detected by configure
Packit 5c3484
dnl  GMP_ASM_IA64_ALIGN_OK.
Packit 5c3484
Packit 5c3484
define(`ALIGN',
Packit 5c3484
m4_assert_numargs(1)
Packit 5c3484
m4_assert_defined(`IA64_ALIGN_OK')
Packit 5c3484
`ifelse(IA64_ALIGN_OK,no,,
Packit 5c3484
`.align	eval($1)')')
Packit 5c3484
Packit 5c3484
Packit 5c3484
dnl  Usage: ASSERT([pr] [,code])
Packit 5c3484
dnl
Packit 5c3484
dnl  Require that the given predicate register is true after executing the
Packit 5c3484
dnl  test code.  For example,
Packit 5c3484
dnl
Packit 5c3484
dnl         ASSERT(p6,
Packit 5c3484
dnl         `       cmp.eq  p6,p0 = r3, r4')
Packit 5c3484
dnl
Packit 5c3484
dnl  If the predicate register argument is empty then nothing is tested, the
Packit 5c3484
dnl  code is just executed.  This can be used for setups required by later
Packit 5c3484
dnl  ASSERTs.  The code argument can be omitted to just test a predicate
Packit 5c3484
dnl  with no special setup code.
Packit 5c3484
dnl
Packit 5c3484
dnl  For convenience, stops are inserted before and after the code emitted.
Packit 5c3484
Packit 5c3484
define(ASSERT,
Packit 5c3484
m4_assert_numargs_range(1,2)
Packit 5c3484
m4_assert_defined(`WANT_ASSERT')
Packit 5c3484
`ifelse(WANT_ASSERT,1,
Packit 5c3484
`	;;
Packit 5c3484
ifelse(`$2',,,
Packit 5c3484
`$2
Packit 5c3484
	;;
Packit 5c3484
')
Packit 5c3484
ifelse(`$1',,,
Packit 5c3484
`($1)	br	.LASSERTok`'ASSERT_label_counter ;;
Packit 5c3484
	cmp.ne	p6,p6 = r0, r0	C illegal instruction
Packit 5c3484
	;;
Packit 5c3484
.LASSERTok`'ASSERT_label_counter:
Packit 5c3484
define(`ASSERT_label_counter',eval(ASSERT_label_counter+1))
Packit 5c3484
')
Packit 5c3484
')')
Packit 5c3484
define(`ASSERT_label_counter',1)
Packit 5c3484
Packit 5c3484
define(`getfsig', `getf.sig')
Packit 5c3484
define(`setfsig', `setf.sig')
Packit 5c3484
define(`cmpeq',   `cmp.eq')
Packit 5c3484
define(`cmpne',   `cmp.ne')
Packit 5c3484
define(`cmpltu',  `cmp.ltu')
Packit 5c3484
define(`cmpleu',  `cmp.leu')
Packit 5c3484
define(`cmpgtu',  `cmp.gtu')
Packit 5c3484
define(`cmpgeu',  `cmp.geu')
Packit 5c3484
define(`cmple',   `cmp.le')
Packit 5c3484
define(`cmpgt',   `cmp.gt')
Packit 5c3484
define(`cmpeqor', `cmp.eq.or')
Packit 5c3484
define(`cmpequc', `cmp.eq.unc')
Packit 5c3484
Packit 5c3484
divert