Home | History | Annotate | Line # | Download | only in s390_64
      1 dnl  S/390-64 mpn_sublsh1_n
      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
     34 C z900		10
     35 C z990		 5
     36 C z9		 ?
     37 C z10		12
     38 C z196		 ?
     39 
     40 C TODO
     41 C  * Optimise for small n
     42 C  * Compute RETVAL for sublsh1_n less stupidly
     43 
     44 C INPUT PARAMETERS
     45 define(`rp',	`%r2')
     46 define(`up',	`%r3')
     47 define(`vp',	`%r4')
     48 define(`n',	`%r5')
     49 
     50 ifdef(`OPERATION_addlsh1_n',`
     51   define(ADSBR,		algr)
     52   define(ADSBCR,	alcgr)
     53   define(INITCY,	`lghi	%r13, -1')
     54   define(RETVAL,	`la	%r2, 2(%r1,%r13)')
     55   define(func, mpn_addlsh1_n)
     56 ')
     57 ifdef(`OPERATION_sublsh1_n',`
     58   define(ADSBR,		slgr)
     59   define(ADSBCR,	slbgr)
     60   define(INITCY,	`lghi	%r13, 0')
     61   define(RETVAL,`dnl
     62 	slgr	%r1, %r13
     63 	lghi	%r2, 1
     64 	algr	%r2, %r1')
     65   define(func, mpn_sublsh1_n)
     66 ')
     67 
     68 ASM_START()
     69 PROLOGUE(mpn_sublsh1_n)
     70 	stmg	%r6, %r13, 48(%r15)
     71 
     72 	aghi	n, 3
     73 	lghi	%r7, 3
     74 	srlg	%r0, n, 2
     75 	ngr	%r7, n			C n mod 4
     76 	je	L(b1)
     77 	cghi	%r7, 2
     78 	jl	L(b2)
     79 	jne	L(b0)
     80 
     81 L(b3):	lmg	%r5, %r7, 0(up)
     82 	la	up, 24(up)
     83 	lmg	%r9, %r11, 0(vp)
     84 	la	vp, 24(vp)
     85 
     86 	algr	%r9, %r9
     87 	alcgr	%r10, %r10
     88 	alcgr	%r11, %r11
     89 	slbgr	%r1, %r1
     90 
     91 	ADSBR	%r5, %r9
     92 	ADSBCR	%r6, %r10
     93 	ADSBCR	%r7, %r11
     94 	slbgr	%r13, %r13
     95 
     96 	stmg	%r5, %r7, 0(rp)
     97 	la	rp, 24(rp)
     98 	brctg	%r0, L(top)
     99 	j	L(end)
    100 
    101 L(b0):	lghi	%r1, -1
    102 	INITCY
    103 	j	L(top)
    104 
    105 L(b1):	lg	%r5, 0(up)
    106 	la	up, 8(up)
    107 	lg	%r9, 0(vp)
    108 	la	vp, 8(vp)
    109 
    110 	algr	%r9, %r9
    111 	slbgr	%r1, %r1
    112 	ADSBR	%r5, %r9
    113 	slbgr	%r13, %r13
    114 
    115 	stg	%r5, 0(rp)
    116 	la	rp, 8(rp)
    117 	brctg	%r0, L(top)
    118 	j	L(end)
    119 
    120 L(b2):	lmg	%r5, %r6, 0(up)
    121 	la	up, 16(up)
    122 	lmg	%r9, %r10, 0(vp)
    123 	la	vp, 16(vp)
    124 
    125 	algr	%r9, %r9
    126 	alcgr	%r10, %r10
    127 	slbgr	%r1, %r1
    128 
    129 	ADSBR	%r5, %r9
    130 	ADSBCR	%r6, %r10
    131 	slbgr	%r13, %r13
    132 
    133 	stmg	%r5, %r6, 0(rp)
    134 	la	rp, 16(rp)
    135 	brctg	%r0, L(top)
    136 	j	L(end)
    137 
    138 L(top):	lmg	%r9, %r12, 0(vp)
    139 	la	vp, 32(vp)
    140 
    141 	aghi	%r1, 1			C restore carry
    142 
    143 	alcgr	%r9, %r9
    144 	alcgr	%r10, %r10
    145 	alcgr	%r11, %r11
    146 	alcgr	%r12, %r12
    147 
    148 	slbgr	%r1, %r1		C save carry
    149 
    150 	lmg	%r5, %r8, 0(up)
    151 	la	up, 32(up)
    152 
    153 	aghi	%r13, 1			C restore carry
    154 
    155 	ADSBCR	%r5, %r9
    156 	ADSBCR	%r6, %r10
    157 	ADSBCR	%r7, %r11
    158 	ADSBCR	%r8, %r12
    159 
    160 	slbgr	%r13, %r13		C save carry
    161 
    162 	stmg	%r5, %r8, 0(rp)
    163 	la	rp, 32(rp)
    164 	brctg	%r0, L(top)
    165 
    166 L(end):	RETVAL
    167 	lmg	%r6, %r13, 48(%r15)
    168 	br	%r14
    169 EPILOGUE()
    170