github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/powerpc32/powerpc-defs.m4 (about)

     1  divert(-1)
     2  
     3  dnl  m4 macros for PowerPC assembler (32 and 64 bit).
     4  
     5  dnl  Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
     6  
     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 modify
    10  dnl  it under the terms of either:
    11  dnl
    12  dnl    * the GNU Lesser General Public License as published by the Free
    13  dnl      Software Foundation; either version 3 of the License, or (at your
    14  dnl      option) any later version.
    15  dnl
    16  dnl  or
    17  dnl
    18  dnl    * the GNU General Public License as published by the Free Software
    19  dnl      Foundation; either version 2 of the License, or (at your option) any
    20  dnl      later version.
    21  dnl
    22  dnl  or both in parallel, as here.
    23  dnl
    24  dnl  The GNU MP Library is distributed in the hope that it will be useful, but
    25  dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    26  dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    27  dnl  for more details.
    28  dnl
    29  dnl  You should have received copies of the GNU General Public License and the
    30  dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
    31  dnl  see https://www.gnu.org/licenses/.
    32  
    33  
    34  dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
    35  dnl
    36  dnl  This is the same as the default in mpn/asm-defs.m4, but with ALIGN(4)
    37  dnl  not 8.
    38  dnl
    39  dnl  4-byte alignment is normally enough, certainly it's what gcc gives.  We
    40  dnl  don't want bigger alignment within PROLOGUE since it can introduce
    41  dnl  padding into multiple-entrypoint routines, and with gas such padding is
    42  dnl  zero words, which are not valid instructions.
    43  
    44  define(`PROLOGUE_cpu',
    45  m4_assert_numargs(1)
    46  `	TEXT
    47  	ALIGN(4)
    48  	GLOBL	`$1' GLOBL_ATTR
    49  	TYPE(`$1',`function')
    50  `$1'LABEL_SUFFIX')
    51  
    52  
    53  dnl  Usage: r0 ... r31, cr0 ... cr7
    54  dnl
    55  dnl  Registers names, either left as "r0" etc or mapped to plain 0 etc,
    56  dnl  according to the result of the GMP_ASM_POWERPC_REGISTERS configure
    57  dnl  test.
    58  
    59  ifelse(WANT_R_REGISTERS,no,`
    60  forloop(i,0,31,`deflit(`r'i,i)')
    61  forloop(i,0,31,`deflit(`v'i,i)')
    62  forloop(i,0,31,`deflit(`f'i,i)')
    63  forloop(i,0,7, `deflit(`cr'i,i)')
    64  ')
    65  
    66  
    67  dnl  Usage: ASSERT(cond,instructions)
    68  dnl
    69  dnl  If WANT_ASSERT is 1, output the given instructions and expect the given
    70  dnl  flags condition to then be satisfied.  For example,
    71  dnl
    72  dnl         ASSERT(eq, `cmpwi r6, 123')
    73  dnl
    74  dnl  The instructions can be omitted to just assert a flags condition with
    75  dnl  no extra calculation.  For example,
    76  dnl
    77  dnl         ASSERT(ne)
    78  dnl
    79  dnl  The condition can be omitted to just output the given instructions when
    80  dnl  assertion checking is wanted.  For example,
    81  dnl
    82  dnl         ASSERT(, `mr r11, r0')
    83  dnl
    84  dnl  Using a zero word for an illegal instruction is probably not ideal,
    85  dnl  since it marks the beginning of a traceback table in the 64-bit ABI.
    86  dnl  But assertions are only for development, so it doesn't matter too much.
    87  
    88  define(ASSERT,
    89  m4_assert_numargs_range(1,2)
    90  m4_assert_defined(`WANT_ASSERT')
    91  `ifelse(WANT_ASSERT,1,
    92  	`C ASSERT
    93  	$2
    94  ifelse(`$1',,,
    95  `	b$1	L(ASSERT_ok`'ASSERT_counter)
    96  	W32	0	C assertion failed
    97  L(ASSERT_ok`'ASSERT_counter):
    98  define(`ASSERT_counter',incr(ASSERT_counter))
    99  ')')')
   100  
   101  define(ASSERT_counter,1)
   102  
   103  
   104  divert