Index: lib/libc/arm/gen/Makefile.inc =================================================================== --- lib/libc/arm/gen/Makefile.inc +++ lib/libc/arm/gen/Makefile.inc @@ -1,7 +1,7 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \ +SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.S \ infinity.c ldexp.c makecontext.c \ __aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S flt_rounds.c \ arm_initfini.c \ Index: lib/libc/arm/gen/fabs.S =================================================================== --- lib/libc/arm/gen/fabs.S +++ lib/libc/arm/gen/fabs.S @@ -1,7 +1,10 @@ -/* $NetBSD: fabs.c,v 1.2 2002/05/26 11:48:01 wiz Exp $ */ - -/* - * Copyright (c) 1996 Mark Brinicombe +/*- + * Copyright (c) 2017 Andrew Turner + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -11,12 +14,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mark Brinicombe - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -31,16 +28,16 @@ * SUCH DAMAGE. */ -/* - * fabs(x) returns the absolute value of x. - */ -#include +#include __FBSDID("$FreeBSD$"); -double -fabs(double x) -{ - if (x < 0) - x = -x; - return(x); -} +ENTRY(fabs) +#if __ARM_ARCH >= 6 + vabs.f64 d0, d0 +#elif __ARM_BIG_ENDIAN + bic r0, r0, #(1 << 31) +#else + bic r1, r1, #(1 << 31) +#endif + RET +END(fabs)