10Sstevel@tonic-gate/* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 56812Sraf * Common Development and Distribution License (the "License"). 66812Sraf * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 216812Sraf 226812Sraf/* 236812Sraf * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 246812Sraf * Use is subject to license terms. 256812Sraf */ 266812Sraf 270Sstevel@tonic-gate/* Copyright (c) 1988 AT&T */ 280Sstevel@tonic-gate/* All Rights Reserved */ 290Sstevel@tonic-gate 30*7298SMark.J.Nelson@Sun.COM .file "lshiftl.s" 310Sstevel@tonic-gate 320Sstevel@tonic-gate/* 330Sstevel@tonic-gate * Shift a double long value. Ported from m32 version to sparc. 340Sstevel@tonic-gate * 350Sstevel@tonic-gate * dl_t 360Sstevel@tonic-gate * lshiftl (op, cnt) 370Sstevel@tonic-gate * dl_t op; 380Sstevel@tonic-gate * int cnt; 390Sstevel@tonic-gate */ 400Sstevel@tonic-gate 416812Sraf#include "SYS.h" 420Sstevel@tonic-gate 430Sstevel@tonic-gate ENTRY(lshiftl) 440Sstevel@tonic-gate 450Sstevel@tonic-gate ld [%o7+8],%o4 ! Instruction at ret-addr should be a 460Sstevel@tonic-gate cmp %o4,8 ! 'unimp 8' indicating a valid call. 470Sstevel@tonic-gate be 1f ! if OK, go forward. 480Sstevel@tonic-gate nop ! delay instruction. 490Sstevel@tonic-gate jmp %o7+8 ! return 500Sstevel@tonic-gate nop ! delay instruction. 510Sstevel@tonic-gate 520Sstevel@tonic-gate1: 530Sstevel@tonic-gate ld [%o0+0],%o2 ! fetch op.dl_hop 540Sstevel@tonic-gate ld [%o0+4],%o3 ! fetch op.dl_lop 550Sstevel@tonic-gate subcc %g0,%o1,%o4 ! test cnt < 0 and save reciprocol 560Sstevel@tonic-gate bz .done 570Sstevel@tonic-gate ld [%sp+(16*4)],%o0 ! address to store result into 580Sstevel@tonic-gate bg .right ! 590Sstevel@tonic-gate nop 600Sstevel@tonic-gate ! Positive (or null) shift (left) 610Sstevel@tonic-gate and %o1,0x3f,%o1 ! Reduce range to 0..63 620Sstevel@tonic-gate subcc %o1,32,%o5 ! cnt - 32 (also test cnt >= 32) 630Sstevel@tonic-gate bneg,a .leftsmall ! 640Sstevel@tonic-gate add %o4,32,%o4 ! 32 - cnt (actually ((-cnt) + 32) 650Sstevel@tonic-gate sll %o3,%o5,%o2 ! R.h = R.l << (cnt - 32) 660Sstevel@tonic-gate ba .done ! 670Sstevel@tonic-gate or %g0,%g0,%o3 ! R.l = 0 680Sstevel@tonic-gate 690Sstevel@tonic-gate.leftsmall: 700Sstevel@tonic-gate srl %o3,%o4,%o5 ! temp = R.l >> (31 - cnt) 710Sstevel@tonic-gate sll %o3,%o1,%o3 ! R.l = R.l << cnt 720Sstevel@tonic-gate sll %o2,%o1,%o2 ! R.h = R.h << cnt 730Sstevel@tonic-gate ba .done ! 740Sstevel@tonic-gate or %o2,%o5,%o2 ! R.h = R.h | temp 750Sstevel@tonic-gate 760Sstevel@tonic-gate.right: ! Negative shift (right) 770Sstevel@tonic-gate and %o4,0x3f,%o4 ! Reduce range to 0..63 780Sstevel@tonic-gate subcc %o4,32,%o5 ! cnt - 32 (also test cnt >= 32) 790Sstevel@tonic-gate bneg,a .rightsmall ! 800Sstevel@tonic-gate add %o1,32,%o1 ! 32 - cnt (actually ((-cnt) + 32) 810Sstevel@tonic-gate srl %o2,%o5,%o3 ! R.l = R.h >> (cnt - 32) 820Sstevel@tonic-gate ba .done ! 830Sstevel@tonic-gate or %g0,%g0,%o2 ! R.h = 0 840Sstevel@tonic-gate 850Sstevel@tonic-gate.rightsmall: 860Sstevel@tonic-gate sll %o2,%o1,%o5 ! temp = R.h << (31 - cnt) 870Sstevel@tonic-gate srl %o3,%o4,%o3 ! R.l = R.l >> cnt 880Sstevel@tonic-gate srl %o2,%o4,%o2 ! R.h = R.h >> cnt 890Sstevel@tonic-gate ba .done ! 900Sstevel@tonic-gate or %o3,%o5,%o3 ! R.l = R.l | temp 910Sstevel@tonic-gate 920Sstevel@tonic-gate.done: 930Sstevel@tonic-gate st %o2,[%o0+0] ! store result, dl_hop 940Sstevel@tonic-gate jmp %o7+12 ! return 950Sstevel@tonic-gate st %o3,[%o0+4] ! store result, dl_lop 960Sstevel@tonic-gate 970Sstevel@tonic-gate SET_SIZE(lshiftl) 98