|
Packit |
5c3484 |
divert(-1)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
dnl m4 macros for PowerPC assembler (32 and 64 bit).
|
|
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 Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl This is the same as the default in mpn/asm-defs.m4, but with ALIGN(4)
|
|
Packit |
5c3484 |
dnl not 8.
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl 4-byte alignment is normally enough, certainly it's what gcc gives. We
|
|
Packit |
5c3484 |
dnl don't want bigger alignment within PROLOGUE since it can introduce
|
|
Packit |
5c3484 |
dnl padding into multiple-entrypoint routines, and with gas such padding is
|
|
Packit |
5c3484 |
dnl zero words, which are not valid instructions.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
define(`PROLOGUE_cpu',
|
|
Packit |
5c3484 |
m4_assert_numargs(1)
|
|
Packit |
5c3484 |
` TEXT
|
|
Packit |
5c3484 |
ALIGN(4)
|
|
Packit |
5c3484 |
GLOBL `$1' GLOBL_ATTR
|
|
Packit |
5c3484 |
TYPE(`$1',`function')
|
|
Packit |
5c3484 |
`$1'LABEL_SUFFIX')
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
dnl Usage: r0 ... r31, cr0 ... cr7
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl Registers names, either left as "r0" etc or mapped to plain 0 etc,
|
|
Packit |
5c3484 |
dnl according to the result of the GMP_ASM_POWERPC_REGISTERS configure
|
|
Packit |
5c3484 |
dnl test.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
ifelse(WANT_R_REGISTERS,no,`
|
|
Packit |
5c3484 |
forloop(i,0,31,`deflit(`r'i,i)')
|
|
Packit |
5c3484 |
forloop(i,0,31,`deflit(`v'i,i)')
|
|
Packit |
5c3484 |
forloop(i,0,31,`deflit(`f'i,i)')
|
|
Packit |
5c3484 |
forloop(i,0,7, `deflit(`cr'i,i)')
|
|
Packit |
5c3484 |
')
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
dnl Usage: ASSERT(cond,instructions)
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl If WANT_ASSERT is 1, output the given instructions and expect the given
|
|
Packit |
5c3484 |
dnl flags condition to then be satisfied. For example,
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl ASSERT(eq, `cmpwi r6, 123')
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl The instructions can be omitted to just assert a flags condition with
|
|
Packit |
5c3484 |
dnl no extra calculation. For example,
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl ASSERT(ne)
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl The condition can be omitted to just output the given instructions when
|
|
Packit |
5c3484 |
dnl assertion checking is wanted. For example,
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl ASSERT(, `mr r11, r0')
|
|
Packit |
5c3484 |
dnl
|
|
Packit |
5c3484 |
dnl Using a zero word for an illegal instruction is probably not ideal,
|
|
Packit |
5c3484 |
dnl since it marks the beginning of a traceback table in the 64-bit ABI.
|
|
Packit |
5c3484 |
dnl But assertions are only for development, so it doesn't matter too much.
|
|
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 |
`C ASSERT
|
|
Packit |
5c3484 |
$2
|
|
Packit |
5c3484 |
ifelse(`$1',,,
|
|
Packit |
5c3484 |
` b$1 L(ASSERT_ok`'ASSERT_counter)
|
|
Packit |
5c3484 |
W32 0 C assertion failed
|
|
Packit |
5c3484 |
L(ASSERT_ok`'ASSERT_counter):
|
|
Packit |
5c3484 |
define(`ASSERT_counter',incr(ASSERT_counter))
|
|
Packit |
5c3484 |
')')')
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
define(ASSERT_counter,1)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
divert
|