github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/arm64/logops_n.asm (about)

     1  dnl  ARM64 mpn_and_n, mpn_andn_n. mpn_nand_n, etc.
     2  
     3  dnl  Contributed to the GNU project by Torbjörn Granlund.
     4  
     5  dnl  Copyright 2013 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  include(`../config.m4')
    34  
    35  C	     cycles/limb
    36  C Cortex-A53	 ?
    37  C Cortex-A57	 ?
    38  
    39  changecom(@&*$)
    40  
    41  define(`rp', `x0')
    42  define(`up', `x1')
    43  define(`vp', `x2')
    44  define(`n',  `x3')
    45  
    46  define(`POSTOP', `dnl')
    47  
    48  ifdef(`OPERATION_and_n',`
    49    define(`func',    `mpn_and_n')
    50    define(`LOGOP',   `and	$1, $2, $3')')
    51  ifdef(`OPERATION_andn_n',`
    52    define(`func',    `mpn_andn_n')
    53    define(`LOGOP',   `bic	$1, $2, $3')')
    54  ifdef(`OPERATION_nand_n',`
    55    define(`func',    `mpn_nand_n')
    56    define(`POSTOP',  `mvn	$1, $1')
    57    define(`LOGOP',   `and	$1, $2, $3')')
    58  ifdef(`OPERATION_ior_n',`
    59    define(`func',    `mpn_ior_n')
    60    define(`LOGOP',   `orr	$1, $2, $3')')
    61  ifdef(`OPERATION_iorn_n',`
    62    define(`func',    `mpn_iorn_n')
    63    define(`LOGOP',   `orn	$1, $2, $3')')
    64  ifdef(`OPERATION_nior_n',`
    65    define(`func',    `mpn_nior_n')
    66    define(`POSTOP',  `mvn	$1, $1')
    67    define(`LOGOP',   `orr	$1, $2, $3')')
    68  ifdef(`OPERATION_xor_n',`
    69    define(`func',    `mpn_xor_n')
    70    define(`LOGOP',   `eor	$1, $2, $3')')
    71  ifdef(`OPERATION_xnor_n',`
    72    define(`func',    `mpn_xnor_n')
    73    define(`LOGOP',   `eon	$1, $2, $3')')
    74  
    75  MULFUNC_PROLOGUE(mpn_and_n mpn_andn_n mpn_nand_n mpn_ior_n mpn_iorn_n mpn_nior_n mpn_xor_n mpn_xnor_n)
    76  
    77  ASM_START()
    78  PROLOGUE(func)
    79  	tbz	n, #0, L(b0)
    80  
    81  	ldr	x4, [up],#8
    82  	ldr	x6, [vp],#8
    83  	sub	n, n, #1
    84  	LOGOP(	x8, x4, x6)
    85  	POSTOP(	x8)
    86  	str	x8, [rp],#8
    87  	cbz	n, L(rtn)
    88  
    89  L(b0):	ldp	x4, x5, [up],#16
    90  	ldp	x6, x7, [vp],#16
    91  	sub	n, n, #2
    92  	b	L(mid)
    93  
    94  L(top):	ldp	x4, x5, [up],#16
    95  	ldp	x6, x7, [vp],#16
    96  	sub	n, n, #2
    97  	stp	x8, x9, [rp],#16
    98  L(mid):	LOGOP(	x8, x4, x6)
    99  	LOGOP(	x9, x5, x7)
   100  	POSTOP(	x8)
   101  	POSTOP(	x9)
   102  	cbnz	n, L(top)
   103  
   104  	stp	x8, x9, [rp],#16
   105  L(rtn):	ret
   106  EPILOGUE()