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

     1  dnl  S/390-64 mpn_rshift.
     2  
     3  dnl  Copyright 2011, 2014 Free Software Foundation, Inc.
     4  
     5  dnl  This file is part of the GNU MP Library.
     6  dnl
     7  dnl  The GNU MP Library is free software; you can redistribute it and/or modify
     8  dnl  it under the terms of either:
     9  dnl
    10  dnl    * the GNU Lesser General Public License as published by the Free
    11  dnl      Software Foundation; either version 3 of the License, or (at your
    12  dnl      option) any later version.
    13  dnl
    14  dnl  or
    15  dnl
    16  dnl    * the GNU General Public License as published by the Free Software
    17  dnl      Foundation; either version 2 of the License, or (at your option) any
    18  dnl      later version.
    19  dnl
    20  dnl  or both in parallel, as here.
    21  dnl
    22  dnl  The GNU MP Library is distributed in the hope that it will be useful, but
    23  dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    24  dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    25  dnl  for more details.
    26  dnl
    27  dnl  You should have received copies of the GNU General Public License and the
    28  dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
    29  dnl  see https://www.gnu.org/licenses/.
    30  
    31  include(`../config.m4')
    32  
    33  C            cycles/limb
    34  C z900		 7
    35  C z990           3
    36  C z9		 ?
    37  C z10		 6
    38  C z196		 ?
    39  
    40  C NOTES
    41  C  * See notes in lshift.asm.
    42  
    43  C INPUT PARAMETERS
    44  define(`rp',	`%r2')
    45  define(`up',	`%r3')
    46  define(`n',	`%r4')
    47  define(`cnt',	`%r5')
    48  
    49  define(`tnc',	`%r6')
    50  
    51  ASM_START()
    52  PROLOGUE(mpn_rshift)
    53  	cghi	n, 3
    54  	jh	L(gt1)
    55  
    56  	stmg	%r6, %r7, 48(%r15)
    57  	larl	%r1, L(tab)-4
    58  	lcgr	tnc, cnt
    59  	sllg	n, n, 2
    60  	b	0(n,%r1)
    61  L(tab):	j	L(n1)
    62  	j	L(n2)
    63  	j	L(n3)
    64  
    65  L(n1):	lg	%r1, 0(up)
    66  	srlg	%r0, %r1, 0(cnt)
    67  	stg	%r0, 0(rp)
    68  	sllg	%r2, %r1, 0(tnc)
    69  	lg	%r6, 48(%r15)		C restoring r7 not needed
    70  	br	%r14
    71  
    72  L(n2):	lg	%r1, 0(up)
    73  	sllg	%r4, %r1, 0(tnc)
    74  	srlg	%r0, %r1, 0(cnt)
    75  	lg	%r1, 8(up)
    76  	sllg	%r7, %r1, 0(tnc)
    77  	ogr	%r7, %r0
    78  	srlg	%r0, %r1, 0(cnt)
    79  	stg	%r7, 0(rp)
    80  	stg	%r0, 8(rp)
    81  	lgr	%r2, %r4
    82  	lmg	%r6, %r7, 48(%r15)
    83  	br	%r14
    84  
    85  
    86  L(n3):	lg	%r1, 0(up)
    87  	sllg	%r4, %r1, 0(tnc)
    88  	srlg	%r0, %r1, 0(cnt)
    89  	lg	%r1, 8(up)
    90  	sllg	%r7, %r1, 0(tnc)
    91  	ogr	%r7, %r0
    92  	srlg	%r0, %r1, 0(cnt)
    93  	stg	%r7, 0(rp)
    94  	lg	%r1, 16(up)
    95  	sllg	%r7, %r1, 0(tnc)
    96  	ogr	%r7, %r0
    97  	srlg	%r0, %r1, 0(cnt)
    98  	stg	%r7, 8(rp)
    99  	stg	%r0, 16(rp)
   100  	lgr	%r2, %r4
   101  	lmg	%r6, %r7, 48(%r15)
   102  	br	%r14
   103  
   104  L(gt1):	stmg	%r6, %r13, 48(%r15)
   105  	lcgr	tnc, cnt		C tnc = -cnt
   106  
   107  	sllg	%r1, n, 3
   108  	srlg	%r0, n, 2		C loop count
   109  
   110  	lghi	%r7, 3
   111  	ngr	%r7, n
   112  	je	L(b0)
   113  	cghi	%r7, 2
   114  	jl	L(b1)
   115  	je	L(b2)
   116  
   117  L(b3):	aghi	rp, -8
   118  	lg	%r7, 0(up)
   119  	sllg	%r9, %r7, 0(tnc)
   120  	srlg	%r11, %r7, 0(cnt)
   121  	lg	%r8, 8(up)
   122  	lg	%r7, 16(up)
   123  	sllg	%r4, %r8, 0(tnc)
   124  	srlg	%r13, %r8, 0(cnt)
   125  	ogr	%r11, %r4
   126  	la	up, 24(up)
   127  	j	L(lm3)
   128  
   129  L(b2):	aghi	rp, -16
   130  	lg	%r8, 0(up)
   131  	lg	%r7, 8(up)
   132  	sllg	%r9, %r8, 0(tnc)
   133  	srlg	%r13, %r8, 0(cnt)
   134  	la	up, 16(up)
   135  	j	L(lm2)
   136  
   137  L(b1):	aghi	rp, -24
   138  	lg	%r7, 0(up)
   139  	sllg	%r9, %r7, 0(tnc)
   140  	srlg	%r11, %r7, 0(cnt)
   141  	lg	%r8, 8(up)
   142  	lg	%r7, 16(up)
   143  	sllg	%r4, %r8, 0(tnc)
   144  	srlg	%r10, %r8, 0(cnt)
   145  	ogr	%r11, %r4
   146  	la	up, 8(up)
   147  	j	L(lm1)
   148  
   149  L(b0):	aghi	rp, -32
   150  	lg	%r8, 0(up)
   151  	lg	%r7, 8(up)
   152  	sllg	%r9, %r8, 0(tnc)
   153  	srlg	%r10, %r8, 0(cnt)
   154  	j	L(lm0)
   155  
   156  	ALIGN(8)
   157  L(top):	sllg	%r4, %r8, 0(tnc)
   158  	srlg	%r13, %r8, 0(cnt)
   159  	ogr	%r11, %r4
   160  	stg	%r10, 0(rp)
   161  L(lm3):	stg	%r11, 8(rp)
   162  L(lm2):	sllg	%r12, %r7, 0(tnc)
   163  	srlg	%r11, %r7, 0(cnt)
   164  	lg	%r8, 0(up)
   165  	lg	%r7, 8(up)
   166  	ogr	%r13, %r12
   167  	sllg	%r4, %r8, 0(tnc)
   168  	srlg	%r10, %r8, 0(cnt)
   169  	ogr	%r11, %r4
   170  	stg	%r13, 16(rp)
   171  L(lm1):	stg	%r11, 24(rp)
   172  L(lm0):	sllg	%r12, %r7, 0(tnc)
   173  	aghi	rp, 32
   174  	srlg	%r11, %r7, 0(cnt)
   175  	lg	%r8, 16(up)
   176  	lg	%r7, 24(up)
   177  	aghi	up, 32
   178  	ogr	%r10, %r12
   179  	brctg	%r0, L(top)
   180  
   181  L(end):	sllg	%r4, %r8, 0(tnc)
   182  	srlg	%r13, %r8, 0(cnt)
   183  	ogr	%r11, %r4
   184  	stg	%r10, 0(rp)
   185  	stg	%r11, 8(rp)
   186  	sllg	%r12, %r7, 0(tnc)
   187  	srlg	%r11, %r7, 0(cnt)
   188  	ogr	%r13, %r12
   189  	stg	%r13, 16(rp)
   190  	stg	%r11, 24(rp)
   191  	lgr	%r2, %r9
   192  
   193  	lmg	%r6, %r13, 48(%r15)
   194  	br	%r14
   195  EPILOGUE()