Home | History | Annotate | Line # | Download | only in s390_32
      1 dnl  S/390-32 mpn_rshift.
      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		 6
     35 C z990	         3
     36 C z9		 ?
     37 C z10		 ?
     38 C z196		 ?
     39 
     40 C TODO
     41 C  *
     42 
     43 C INPUT PARAMETERS
     44 define(`rp',	`%r2')
     45 define(`up',	`%r3')
     46 define(`n',	`%r4')
     47 define(`cnt',	`%r5')
     48 
     49 ASM_START()
     50 PROLOGUE(mpn_rshift)
     51 	stm	%r6, %r12, 24(%r15)
     52 	lhi	%r8, 32
     53 	sr	%r8, cnt
     54 	l	%r12, 0(up)
     55 	sll	%r12, 0(%r8)		C return value
     56 	lhi	%r7, 3
     57 	nr	%r7, n
     58 	srl	n, 2
     59 	je	L(b0)
     60 	chi	%r7, 2
     61 	jl	L(b1)
     62 	je	L(b2)
     63 
     64 L(b3):	l	%r11, 0(up)
     65 	l	%r10, 4(up)
     66 	l	%r8,  8(up)
     67 	ahi	up, 8
     68 	lr	%r9, %r10
     69 	srdl	%r10, 0(cnt)
     70 	srdl	%r8,  0(cnt)
     71 	st	%r11, 0(rp)
     72 	st	%r9,  4(rp)
     73 	ahi	rp, 8
     74 	ltr	n, n
     75 	je	L(end)
     76 	j	L(top)
     77 
     78 L(b2):	l	%r11, 0(up)
     79 	l	%r10, 4(up)
     80 	ahi	up, 4
     81 	srdl	%r10, 0(cnt)
     82 	st	%r11, 0(rp)
     83 	ahi	rp, 4
     84 	ltr	n, n
     85 	je	L(end)
     86 	j	L(top)
     87 
     88 L(b1):	ltr	n, n
     89 	je	L(end)
     90 	j	L(top)
     91 
     92 L(b0):	l	%r11, 0(up)
     93 	l	%r9,  4(up)
     94 	l	%r7,  8(up)
     95 	l	%r1, 12(up)
     96 	ahi	up, 12
     97 	lr	%r10, %r9
     98 	lr	%r8,  %r7
     99 	lr	%r6,  %r1
    100 	srdl	%r10, 0(cnt)
    101 	srdl	%r8,  0(cnt)
    102 	srdl	%r6,  0(cnt)
    103 	st	%r11, 0(rp)
    104 	st	%r9,  4(rp)
    105 	st	%r7,  8(rp)
    106 	ahi	rp, 12
    107 	ahi	n, -1
    108 	je	L(end)
    109 
    110 	ALIGN(8)
    111 L(top):	l	%r11, 0(up)
    112 	l	%r9,  4(up)
    113 	l	%r7,  8(up)
    114 	l	%r1, 12(up)
    115 	l	%r0, 16(up)
    116 	lr	%r10, %r9
    117 	lr	%r8,  %r7
    118 	lr	%r6,  %r1
    119 	ahi	up, 16
    120 	srdl	%r10, 0(cnt)
    121 	srdl	%r8,  0(cnt)
    122 	srdl	%r6,  0(cnt)
    123 	srdl	%r0,  0(cnt)
    124 	st	%r11, 0(rp)
    125 	st	%r9,  4(rp)
    126 	st	%r7,  8(rp)
    127 	st	%r1, 12(rp)
    128 	ahi	rp, 16
    129 	brct	n, L(top)
    130 
    131 L(end):	l	%r11, 0(up)
    132 	srl	%r11, 0(cnt)
    133 	st	%r11, 0(rp)
    134 
    135 	lr	%r2, %r12
    136 	lm	%r6, %r12, 24(%r15)
    137 	br	%r14
    138 EPILOGUE()
    139