11.6Suebayasi/*	$NetBSD: llabs.S,v 1.6 2014/05/23 02:34:19 uebayasi Exp $	*/
21.1Skleink
31.1Skleink/*-
41.1Skleink * Copyright (c) 1990 The Regents of the University of California.
51.1Skleink * All rights reserved.
61.1Skleink *
71.1Skleink * This code is derived from software contributed to Berkeley by
81.1Skleink * William Jolitz.
91.1Skleink *
101.1Skleink * Redistribution and use in source and binary forms, with or without
111.1Skleink * modification, are permitted provided that the following conditions
121.1Skleink * are met:
131.1Skleink * 1. Redistributions of source code must retain the above copyright
141.1Skleink *    notice, this list of conditions and the following disclaimer.
151.1Skleink * 2. Redistributions in binary form must reproduce the above copyright
161.1Skleink *    notice, this list of conditions and the following disclaimer in the
171.1Skleink *    documentation and/or other materials provided with the distribution.
181.4Sagc * 3. Neither the name of the University nor the names of its contributors
191.1Skleink *    may be used to endorse or promote products derived from this software
201.1Skleink *    without specific prior written permission.
211.1Skleink *
221.1Skleink * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231.1Skleink * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241.1Skleink * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251.1Skleink * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261.1Skleink * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271.1Skleink * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281.1Skleink * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291.1Skleink * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301.1Skleink * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311.1Skleink * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321.1Skleink * SUCH DAMAGE.
331.1Skleink *
341.1Skleink *	from: @(#)abs.s	5.2 (Berkeley) 12/17/90
351.1Skleink */
361.1Skleink
371.1Skleink#include <machine/asm.h>
381.1Skleink#if defined(LIBC_SCCS)
391.6Suebayasi	RCSID("$NetBSD: llabs.S,v 1.6 2014/05/23 02:34:19 uebayasi Exp $")
401.1Skleink#endif
411.1Skleink
421.2Skleink#ifdef WEAK_ALIAS
431.3SkleinkWEAK_ALIAS(llabs, _llabs)
441.5SmattWEAK_ALIAS(imaxabs, _llabs)
451.2Skleink#endif
461.2Skleink
471.2Skleink#ifdef WEAK_ALIAS
481.3SkleinkENTRY(_llabs)
491.3Skleink#else
501.5SmattSTRONG_ALIAS(imaxabs, llabs)
511.1SkleinkENTRY(llabs)
521.2Skleink#endif
531.1Skleink	movl	8(%esp),%edx
541.1Skleink	movl	4(%esp),%eax
551.1Skleink	testl	%edx,%edx
561.1Skleink	jns	1f
571.1Skleink	negl	%eax
581.1Skleink	adcl	$0,%edx
591.1Skleink	negl	%edx
601.1Skleink1:	ret
611.6Suebayasi#ifdef WEAK_ALIAS
621.6SuebayasiEND(_llabs)
631.6Suebayasi#else
641.6SuebayasiEND(llabs)
651.6Suebayasi#endif
66