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

     1  dnl  S/390-32 logops.
     2  
     3  dnl  Copyright 2011 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     variant 1           variant 2       variant 3
    34  C	        rp!=up  rp=up
    35  C z900		 ?	 ?		 ?		 ?
    36  C z990		 2.5	 1		 2.75		 2.75
    37  C z9		 ?			 ?		 ?
    38  C z10		 ?			 ?		 ?
    39  C z196		 ?			 ?		 ?
    40  
    41  C INPUT PARAMETERS
    42  define(`rp',	`%r2')
    43  define(`up',	`%r3')
    44  define(`vp',	`%r4')
    45  define(`nn',	`%r5')
    46  
    47  ifdef(`OPERATION_and_n',`
    48    define(`func',`mpn_and_n')
    49    define(`VARIANT_1')
    50    define(`LOGOPC',`nc')
    51    define(`LOGOP',`n')')
    52  ifdef(`OPERATION_andn_n',`
    53    define(`func',`mpn_andn_n')
    54    define(`VARIANT_2')
    55    define(`LOGOP',`n')')
    56  ifdef(`OPERATION_nand_n',`
    57    define(`func',`mpn_nand_n')
    58    define(`VARIANT_3')
    59    define(`LOGOP',`n')')
    60  ifdef(`OPERATION_ior_n',`
    61    define(`func',`mpn_ior_n')
    62    define(`VARIANT_1')
    63    define(`LOGOPC',`oc')
    64    define(`LOGOP',`o')')
    65  ifdef(`OPERATION_iorn_n',`
    66    define(`func',`mpn_iorn_n')
    67    define(`VARIANT_2')
    68    define(`LOGOP',`o')')
    69  ifdef(`OPERATION_nior_n',`
    70    define(`func',`mpn_nior_n')
    71    define(`VARIANT_3')
    72    define(`LOGOP',`o')')
    73  ifdef(`OPERATION_xor_n',`
    74    define(`func',`mpn_xor_n')
    75    define(`VARIANT_1')
    76    define(`LOGOPC',`xc')
    77    define(`LOGOP',`x')')
    78  ifdef(`OPERATION_xnor_n',`
    79    define(`func',`mpn_xnor_n')
    80    define(`VARIANT_2')
    81    define(`LOGOP',`x')')
    82  
    83  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)
    84  
    85  ASM_START()
    86  PROLOGUE(func)
    87  ifdef(`VARIANT_1',`
    88  	cr	rp, up
    89  	jne	L(normal)
    90  
    91  	sll	nn, 2
    92  	ahi	nn, -1
    93  	lr	%r1, nn
    94  	srl	%r1, 8
    95  	ltr	%r1, %r1		C < 256 bytes to copy?
    96  	je	L(1)
    97  
    98  L(tp):	LOGOPC	0(256, rp), 0(vp)
    99  	la	rp, 256(rp)
   100  	la	vp, 256(vp)
   101  	brct	%r1, L(tp)
   102  
   103  L(1):	bras	%r1, L(2)		C make r1 point to mvc insn
   104  	LOGOPC	0(1, rp), 0(vp)
   105  L(2):	ex	nn, 0(%r1)		C execute mvc with length ((nn-1) mod 256)+1
   106  L(rtn):	br	%r14
   107  
   108  
   109  L(normal):
   110  	stm	%r6, %r8, 12(%r15)
   111  	ahi	nn, 3
   112  	lhi	%r7, 3
   113  	lr	%r0, nn
   114  	srl	%r0, 2
   115  	nr	%r7, nn			C nn mod 4
   116  	je	L(b1)
   117  	chi	%r7, 2
   118  	jl	L(b2)
   119  	jne	L(top)
   120  
   121  L(b3):	lm	%r5, %r7, 0(up)
   122  	la	up, 12(up)
   123  	LOGOP	%r5, 0(vp)
   124  	LOGOP	%r6, 4(vp)
   125  	LOGOP	%r7, 8(vp)
   126  	stm	%r5, %r7, 0(rp)
   127  	la	rp, 12(rp)
   128  	la	vp, 12(vp)
   129  	j	L(mid)
   130  
   131  L(b1):	l	%r5, 0(up)
   132  	la	up, 4(up)
   133  	LOGOP	%r5, 0(vp)
   134  	st	%r5, 0(rp)
   135  	la	rp, 4(rp)
   136  	la	vp, 4(vp)
   137  	j	L(mid)
   138  
   139  L(b2):	lm	%r5, %r6, 0(up)
   140  	la	up, 8(up)
   141  	LOGOP	%r5, 0(vp)
   142  	LOGOP	%r6, 4(vp)
   143  	stm	%r5, %r6, 0(rp)
   144  	la	rp, 8(rp)
   145  	la	vp, 8(vp)
   146  	j	L(mid)
   147  
   148  L(top):	lm	%r5, %r8, 0(up)
   149  	la	up, 16(up)
   150  	LOGOP	%r5, 0(vp)
   151  	LOGOP	%r6, 4(vp)
   152  	LOGOP	%r7, 8(vp)
   153  	LOGOP	%r8, 12(vp)
   154  	stm	%r5, %r8, 0(rp)
   155  	la	rp, 16(rp)
   156  	la	vp, 16(vp)
   157  L(mid):	brct	%r0, L(top)
   158  
   159  	lm	%r6, %r8, 12(%r15)
   160  	br	%r14
   161  ')
   162  
   163  ifdef(`VARIANT_2',`
   164  	stm	%r6, %r8, 12(%r15)
   165  	lhi	%r1, -1
   166  
   167  	ahi	nn, 3
   168  	lhi	%r7, 3
   169  	lr	%r0, nn
   170  	srl	%r0, 2
   171  	nr	%r7, nn			C nn mod 4
   172  	je	L(b1)
   173  	chi	%r7, 2
   174  	jl	L(b2)
   175  	jne	L(top)
   176  
   177  L(b3):	lm	%r5, %r7, 0(vp)
   178  	la	vp, 12(vp)
   179  	xr	%r5, %r1
   180  	xr	%r6, %r1
   181  	xr	%r7, %r1
   182  	LOGOP	%r5, 0(up)
   183  	LOGOP	%r6, 4(up)
   184  	LOGOP	%r7, 8(up)
   185  	stm	%r5, %r7, 0(rp)
   186  	la	rp, 12(rp)
   187  	la	up, 12(up)
   188  	j	L(mid)
   189  
   190  L(b1):	l	%r5, 0(vp)
   191  	la	vp, 4(vp)
   192  	xr	%r5, %r1
   193  	LOGOP	%r5, 0(up)
   194  	st	%r5, 0(rp)
   195  	la	rp, 4(rp)
   196  	la	up, 4(up)
   197  	j	L(mid)
   198  
   199  L(b2):	lm	%r5, %r6, 0(vp)
   200  	la	vp, 8(vp)
   201  	xr	%r5, %r1
   202  	xr	%r6, %r1
   203  	LOGOP	%r5, 0(up)
   204  	LOGOP	%r6, 4(up)
   205  	stm	%r5, %r6, 0(rp)
   206  	la	rp, 8(rp)
   207  	la	up, 8(up)
   208  	j	L(mid)
   209  
   210  L(top):	lm	%r5, %r8, 0(vp)
   211  	la	vp, 16(vp)
   212  	xr	%r5, %r1
   213  	xr	%r6, %r1
   214  	xr	%r7, %r1
   215  	xr	%r8, %r1
   216  	LOGOP	%r5, 0(up)
   217  	LOGOP	%r6, 4(up)
   218  	LOGOP	%r7, 8(up)
   219  	LOGOP	%r8, 12(up)
   220  	la	up, 16(up)
   221  	stm	%r5, %r8, 0(rp)
   222  	la	rp, 16(rp)
   223  L(mid):	brct	%r0, L(top)
   224  
   225  	lm	%r6, %r8, 12(%r15)
   226  	br	%r14
   227  ')
   228  
   229  ifdef(`VARIANT_3',`
   230  	stm	%r6, %r8, 12(%r15)
   231  	lhi	%r1, -1
   232  
   233  	ahi	nn, 3
   234  	lhi	%r7, 3
   235  	lr	%r0, nn
   236  	srl	%r0, 2
   237  	nr	%r7, nn			C nn mod 4
   238  	je	L(b1)
   239  	chi	%r7, 2
   240  	jl	L(b2)
   241  	jne	L(top)
   242  
   243  L(b3):	lm	%r5, %r7, 0(vp)
   244  	la	vp, 12(vp)
   245  	LOGOP	%r5, 0(up)
   246  	LOGOP	%r6, 4(up)
   247  	xr	%r5, %r1
   248  	xr	%r6, %r1
   249  	LOGOP	%r7, 8(up)
   250  	xr	%r7, %r1
   251  	stm	%r5, %r7, 0(rp)
   252  	la	rp, 12(rp)
   253  	la	up, 12(up)
   254  	j	L(mid)
   255  
   256  L(b1):	l	%r5, 0(vp)
   257  	la	vp, 4(vp)
   258  	LOGOP	%r5, 0(up)
   259  	xr	%r5, %r1
   260  	st	%r5, 0(rp)
   261  	la	rp, 4(rp)
   262  	la	up, 4(up)
   263  	j	L(mid)
   264  
   265  L(b2):	lm	%r5, %r6, 0(vp)
   266  	la	vp, 8(vp)
   267  	LOGOP	%r5, 0(up)
   268  	LOGOP	%r6, 4(up)
   269  	xr	%r5, %r1
   270  	xr	%r6, %r1
   271  	stm	%r5, %r6, 0(rp)
   272  	la	rp, 8(rp)
   273  	la	up, 8(up)
   274  	j	L(mid)
   275  
   276  L(top):	lm	%r5, %r8, 0(vp)
   277  	la	vp, 16(vp)
   278  	LOGOP	%r5, 0(up)
   279  	LOGOP	%r6, 4(up)
   280  	xr	%r5, %r1
   281  	xr	%r6, %r1
   282  	LOGOP	%r7, 8(up)
   283  	LOGOP	%r8, 12(up)
   284  	xr	%r7, %r1
   285  	xr	%r8, %r1
   286  	stm	%r5, %r8, 0(rp)
   287  	la	up, 16(up)
   288  	la	rp, 16(rp)
   289  L(mid):	brct	%r0, L(top)
   290  
   291  	lm	%r6, %r8, 12(%r15)
   292  	br	%r14
   293  ')
   294  
   295  EPILOGUE()