4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
33 * Shift a double long value. Ported from m32 version to sparc.
45 ld [%o7+
8],%o4
! Instruction at ret-addr should
be a
46 cmp %o4
,8 ! 'unimp 8' indicating
a valid call.
47 be 1f
! if OK
, go forward.
48 nop ! delay instruction.
50 nop ! delay instruction.
53 ld [%o0+
0],%o2
! fetch op.dl_hop
54 ld [%o0+
4],%o3
! fetch op.dl_lop
55 subcc
%g0
,%o1
,%o4
! test cnt
< 0 and save reciprocol
57 ld [%sp+
(16*4)],%o0
! address to store result into
60 ! Positive
(or null
) shift
(left
)
61 and %o1
,0x3f,%o1
! Reduce range to
0..63
62 subcc
%o1
,32,%o5
! cnt
- 32 (also test cnt
>= 32)
64 add %o4
,32,%o4
! 32 - cnt
(actually
((-cnt
) + 32)
65 sll
%o3
,%o5
,%o2
! R.h
= R.
l << (cnt
- 32)
67 or %g0
,%g0
,%o3
! R.
l = 0
70 srl
%o3
,%o4
,%o5
! temp
= R.
l >> (31 - cnt
)
71 sll
%o3
,%o1
,%o3
! R.
l = R.
l << cnt
72 sll
%o2
,%o1
,%o2
! R.h
= R.h
<< cnt
74 or %o2
,%o5
,%o2
! R.h
= R.h | temp
76 .right: ! Negative shift (right)
77 and %o4
,0x3f,%o4
! Reduce range to
0..63
78 subcc
%o4
,32,%o5
! cnt
- 32 (also test cnt
>= 32)
80 add %o1
,32,%o1
! 32 - cnt
(actually
((-cnt
) + 32)
81 srl
%o2
,%o5
,%o3
! R.
l = R.h
>> (cnt
- 32)
83 or %g0
,%g0
,%o2
! R.h
= 0
86 sll
%o2
,%o1
,%o5
! temp
= R.h
<< (31 - cnt
)
87 srl
%o3
,%o4
,%o3
! R.
l = R.
l >> cnt
88 srl
%o2
,%o4
,%o2
! R.h
= R.h
>> cnt
90 or %o3
,%o5
,%o3
! R.
l = R.
l | temp
93 st %o2
,[%o0+
0] ! store result
, dl_hop
95 st %o3
,[%o0+
4] ! store result
, dl_lop