From owner-svn-src-head@freebsd.org Tue Nov 28 20:37:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94AA0DEE1E9; Tue, 28 Nov 2017 20:37:28 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 609DE7752F; Tue, 28 Nov 2017 20:37:28 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASKbR6g068415; Tue, 28 Nov 2017 20:37:27 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASKbRIj068414; Tue, 28 Nov 2017 20:37:27 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201711282037.vASKbRIj068414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Tue, 28 Nov 2017 20:37:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326342 - head/lib/libc/mips/gen X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/lib/libc/mips/gen X-SVN-Commit-Revision: 326342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 20:37:28 -0000 Author: arichardson Date: Tue Nov 28 20:37:27 2017 New Revision: 326342 URL: https://svnweb.freebsd.org/changeset/base/326342 Log: Fix fabs() for MIPS when used on -0.0 It would previously return negative zero for -0.0 since -0.0 does not compare less than 0. The issue was discovered when running the libc++ test suite on softfloat MIPS64. I have verified that both clang and GCC generate sensible code for the builtin. For soft float they clear the sign bit using integer operations and in hard float mode they use abs.d. Reviewed by: #mips, jhb, brooks, imp, emaste Approved by: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D13135 Modified: head/lib/libc/mips/gen/fabs.c Modified: head/lib/libc/mips/gen/fabs.c ============================================================================== --- head/lib/libc/mips/gen/fabs.c Tue Nov 28 19:57:16 2017 (r326341) +++ head/lib/libc/mips/gen/fabs.c Tue Nov 28 20:37:27 2017 (r326342) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); double fabs(double x) { - if (x < 0) - x = -x; - return(x); + + return (__builtin_fabs(x)); }