Home | History | Annotate | Line # | Download | only in stdlib
      1 /*	$NetBSD: labs.S,v 1.3 2014/05/22 15:01:56 uebayasi Exp $	*/
      2 
      3 /*
      4  * Written by Frank van der Linden (fvdl (at) wasabisystems.com)
      5  * Public Domain.
      6  */
      7 
      8 #include <machine/asm.h>
      9 
     10 #if defined(LIBC_SCCS)
     11 	RCSID("$NetBSD: labs.S,v 1.3 2014/05/22 15:01:56 uebayasi Exp $")
     12 #endif
     13 
     14 #ifdef WEAK_ALIAS
     15 WEAK_ALIAS(imaxabs, _llabs)
     16 WEAK_ALIAS(llabs, _llabs)
     17 WEAK_ALIAS(labs, _labs)
     18 #endif
     19 
     20 #ifdef WEAK_ALIAS
     21 ENTRY(_llabs)
     22 ENTRY(_labs)
     23 #else
     24 ENTRY(llabs)
     25 ENTRY(labs)
     26 #endif
     27         movq    %rdi,%rax
     28         testq   %rax,%rax
     29         jns     1f
     30         negq    %rax
     31 1:      ret
     32 #ifdef WEAK_ALIAS
     33 END(_llabs)
     34 END(_labs)
     35 #else
     36 END(llabs)
     37 END(labs)
     38 #endif
     39