1*cac8e449Smatt/* $NetBSD: llabs.S,v 1.4 2008/08/04 21:29:28 matt Exp $ */ 2e4d7c2e3Skleink 3e4d7c2e3Skleink/* 4e4d7c2e3Skleink * Copyright (c) 1992, 1993 5e4d7c2e3Skleink * The Regents of the University of California. All rights reserved. 6e4d7c2e3Skleink * 7e4d7c2e3Skleink * This software was developed by the Computer Systems Engineering group 8e4d7c2e3Skleink * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 9e4d7c2e3Skleink * contributed to Berkeley. 10e4d7c2e3Skleink * 11e4d7c2e3Skleink * Redistribution and use in source and binary forms, with or without 12e4d7c2e3Skleink * modification, are permitted provided that the following conditions 13e4d7c2e3Skleink * are met: 14e4d7c2e3Skleink * 1. Redistributions of source code must retain the above copyright 15e4d7c2e3Skleink * notice, this list of conditions and the following disclaimer. 16e4d7c2e3Skleink * 2. Redistributions in binary form must reproduce the above copyright 17e4d7c2e3Skleink * notice, this list of conditions and the following disclaimer in the 18e4d7c2e3Skleink * documentation and/or other materials provided with the distribution. 19eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors 20e4d7c2e3Skleink * may be used to endorse or promote products derived from this software 21e4d7c2e3Skleink * without specific prior written permission. 22e4d7c2e3Skleink * 23e4d7c2e3Skleink * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24e4d7c2e3Skleink * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25e4d7c2e3Skleink * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26e4d7c2e3Skleink * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27e4d7c2e3Skleink * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28e4d7c2e3Skleink * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29e4d7c2e3Skleink * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30e4d7c2e3Skleink * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31e4d7c2e3Skleink * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32e4d7c2e3Skleink * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33e4d7c2e3Skleink * SUCH DAMAGE. 34e4d7c2e3Skleink * 35e4d7c2e3Skleink * from: Header: abs.s,v 1.1 91/07/06 18:01:57 torek Exp 36e4d7c2e3Skleink */ 37e4d7c2e3Skleink 38e4d7c2e3Skleink#include <machine/asm.h> 39e4d7c2e3Skleink#if defined(LIBC_SCCS) && !defined(lint) 40e4d7c2e3Skleink#if 0 41e4d7c2e3Skleink .asciz "from: @(#)abs.s 8.1 (Berkeley) 6/4/93" 42e4d7c2e3Skleink#else 43*cac8e449Smatt RCSID("$NetBSD: llabs.S,v 1.4 2008/08/04 21:29:28 matt Exp $") 44e4d7c2e3Skleink#endif 45e4d7c2e3Skleink#endif /* LIBC_SCCS and not lint */ 46e4d7c2e3Skleink 473529d6d1Skleink#ifdef WEAK_ALIAS 483529d6d1SkleinkWEAK_ALIAS(llabs, _llabs) 49*cac8e449SmattWEAK_ALIAS(imaxabs, _llabs) 503529d6d1Skleink#endif 513529d6d1Skleink 52e4d7c2e3Skleink/* llabs - long long int absolute value */ 53*cac8e449Smatt/* imaxabs - intmax_t absolute value */ 54e4d7c2e3Skleink 55e4d7c2e3Skleink 563529d6d1Skleink#ifdef WEAK_ALIAS 573529d6d1SkleinkENTRY(_llabs) 583529d6d1Skleink#else 59e4d7c2e3SkleinkENTRY(llabs) 603529d6d1Skleink#endif 61e4d7c2e3Skleink tst %o0 62e4d7c2e3Skleink bge 1f 63e4d7c2e3Skleink nop 64e4d7c2e3Skleink subcc %g0, %o1, %o1 65e4d7c2e3Skleink subx %g0, %o0, %o0 66e4d7c2e3Skleink1: retl 67e4d7c2e3Skleink nop 68