xref: /minix/lib/libc/arch/x86_64/stdlib/labs.S (revision ebfedea0)
1/*	$NetBSD: labs.S,v 1.2 2008/08/04 20:21:26 matt Exp $	*/
2
3/*
4 * Written by Frank van der Linden (fvdl@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.2 2008/08/04 20:21:26 matt Exp $")
12#endif
13
14#ifdef WEAK_ALIAS
15WEAK_ALIAS(imaxabs, _llabs)
16WEAK_ALIAS(llabs, _llabs)
17WEAK_ALIAS(labs, _labs)
18#endif
19
20#ifdef WEAK_ALIAS
21ENTRY(_llabs)
22ENTRY(_labs)
23#else
24ENTRY(llabs)
25ENTRY(labs)
26#endif
27        movq    %rdi,%rax
28        testq   %rax,%rax
29        jns     1f
30        negq    %rax
311:      ret
32