s_copysign.S revision 1.7
11.7Sagc/*	$NetBSD: s_copysign.S,v 1.7 2003/08/07 16:44:41 agc Exp $	*/
21.6Sthorpej
31.1Sjtc/*-
41.1Sjtc * Copyright (c) 1990 The Regents of the University of California.
51.1Sjtc * All rights reserved.
61.1Sjtc *
71.1Sjtc * This code is derived from software contributed to Berkeley by
81.1Sjtc * the Systems Programming Group of the University of Utah Computer
91.1Sjtc * Science Department.
101.1Sjtc *
111.1Sjtc * Redistribution and use in source and binary forms, with or without
121.1Sjtc * modification, are permitted provided that the following conditions
131.1Sjtc * are met:
141.1Sjtc * 1. Redistributions of source code must retain the above copyright
151.1Sjtc *    notice, this list of conditions and the following disclaimer.
161.1Sjtc * 2. Redistributions in binary form must reproduce the above copyright
171.1Sjtc *    notice, this list of conditions and the following disclaimer in the
181.1Sjtc *    documentation and/or other materials provided with the distribution.
191.7Sagc * 3. Neither the name of the University nor the names of its contributors
201.1Sjtc *    may be used to endorse or promote products derived from this software
211.1Sjtc *    without specific prior written permission.
221.1Sjtc *
231.1Sjtc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
241.1Sjtc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
251.1Sjtc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
261.1Sjtc * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
271.1Sjtc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
281.1Sjtc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
291.1Sjtc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
301.1Sjtc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
311.1Sjtc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
321.1Sjtc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
331.1Sjtc * SUCH DAMAGE.
341.1Sjtc */
351.1Sjtc
361.1Sjtc#include <machine/asm.h>
371.1Sjtc
381.1Sjtc;_sccsid:
391.1Sjtc;.asciz	"from: @(#)support.s	5.2 (Berkeley) 5/17/90"
401.1Sjtc
411.7SagcRCSID("$NetBSD: s_copysign.S,v 1.7 2003/08/07 16:44:41 agc Exp $")
421.1Sjtc
431.1Sjtc| copysign(x,y)
441.1Sjtc| returns x with the sign of y.
451.1SjtcENTRY(copysign)
461.4Skleink#ifdef __SVR4_ABI__
471.6Sthorpej	tstw	%sp@(12)
481.4Skleink	jmi	Lneg
491.6Sthorpej	bclr	#31,%sp@(4)
501.6Sthorpej	fmoved	%sp@(4),%fp0
511.4Skleink	rts
521.4SkleinkLneg:
531.6Sthorpej	bset	#31,%sp@(4)
541.6Sthorpej	fmoved	%sp@(4),%fp0
551.4Skleink	rts
561.4Skleink#else
571.6Sthorpej	movl	%sp@(4),%d0
581.6Sthorpej	movl	%sp@(8),%d1
591.6Sthorpej	tstw	%sp@(12)
601.1Sjtc	jmi	Lneg
611.6Sthorpej	bclr	#31,%d0
621.1Sjtc	rts
631.1SjtcLneg:
641.6Sthorpej	bset	#31,%d0
651.1Sjtc	rts
661.4Skleink#endif
67