lshrdi3.S revision 1.1
11.1Sjtc/*	$NetBSD: lshrdi3.S,v 1.1 1996/05/31 02:05:47 jtc Exp $	*/
21.1Sjtc
31.1Sjtc/*-
41.1Sjtc * Copyright (c) 1996 The NetBSD Foundation, Inc.
51.1Sjtc * All rights reserved.
61.1Sjtc *
71.1Sjtc * This code is derived from software contributed to The NetBSD Foundation
81.1Sjtc * by J.T. Conklin.
91.1Sjtc *
101.1Sjtc * Redistribution and use in source and binary forms, with or without
111.1Sjtc * modification, are permitted provided that the following conditions
121.1Sjtc * are met:
131.1Sjtc * 1. Redistributions of source code must retain the above copyright
141.1Sjtc *    notice, this list of conditions and the following disclaimer.
151.1Sjtc * 2. Redistributions in binary form must reproduce the above copyright
161.1Sjtc *    notice, this list of conditions and the following disclaimer in the
171.1Sjtc *    documentation and/or other materials provided with the distribution.
181.1Sjtc * 3. All advertising materials mentioning features or use of this software
191.1Sjtc *    must display the following acknowledgement:
201.1Sjtc *        This product includes software developed by the NetBSD
211.1Sjtc *        Foundation, Inc. and its contributors.
221.1Sjtc * 4. Neither the name of The NetBSD Foundation nor the names of its
231.1Sjtc *    contributors may be used to endorse or promote products derived
241.1Sjtc *    from this software without specific prior written permission.
251.1Sjtc *
261.1Sjtc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
271.1Sjtc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
281.1Sjtc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
291.1Sjtc * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
301.1Sjtc * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
311.1Sjtc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
321.1Sjtc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
331.1Sjtc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
341.1Sjtc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
351.1Sjtc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
361.1Sjtc * POSSIBILITY OF SUCH DAMAGE.
371.1Sjtc */
381.1Sjtc
391.1Sjtc#include <machine/asm.h>
401.1Sjtc
411.1Sjtc| d0 msw
421.1Sjtc| d1 lsw
431.1Sjtc| d2 shift
441.1Sjtc| d3 offset (32 - shift)
451.1Sjtc
461.1SjtcENTRY(__lshrdi3)
471.1Sjtc	link	a6,#0
481.1Sjtc	moveml	d2-d4,sp@-
491.1Sjtc	movel	a6@(8),d0
501.1Sjtc	movel	a6@(12),d1
511.1Sjtc	movel	a6@(16),d2
521.1Sjtc	moveq	#32,d3
531.1Sjtc	subl	d2,d3
541.1Sjtc	jgt	L2
551.1Sjtc	negl	d3
561.1Sjtc	movel	d0,d1
571.1Sjtc	lsrl	d3,d1
581.1Sjtc	clrl	d0
591.1Sjtc	jra	L3
601.1SjtcL2:	lsrl	d2,d1
611.1Sjtc	movel	d0,d4
621.1Sjtc	asll	d3,d4
631.1Sjtc	orl	d4,d1
641.1Sjtc	lsrl	d2,d0
651.1SjtcL3:	moveml	a6@(-12),d2-d4
661.1Sjtc	unlk	a6
671.1Sjtc	rts
68