From patchwork Fri Sep 4 16:05:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco X-Patchwork-Id: 514646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 80B981401CD for ; Sat, 5 Sep 2015 02:06:03 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=ejF/wK6l; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:references:in-reply-to:subject:date :message-id:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=L13l+FCvkJnTNRSysVLXwVBKWRAJwXvjpk3BWQrcSbS xQjfMMmpuqnjZqt17hwemnxkuimLbk6jApjbEoGi434cShKpEElacS1ngYtK+SvS A2jT+u7vB7ze5ssH9TWkj+q0hwHzRKyCRxz+WFyl836MzeVisH2fzOjLrTldycvg = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:references:in-reply-to:subject:date :message-id:mime-version:content-type:content-transfer-encoding; s=default; bh=5wlD3VkBvUVdKZTBFisxHjDUZnE=; b=ejF/wK6lBL7442BFC u/UOotZkzoECc4AFJKuXhiEV/oAg+xOA5/fD/EACA1t+Ulv9WkLIx1sJWdRCFj8v aRd8Y38/PWIJsr1SJ+4yUNniWppWnbUvM9vmhE9LJEpddwVVCJREETUJUbES7QOT Rn5xfKxO4YA0DrA0v9Oy5+CoqM= Received: (qmail 92744 invoked by alias); 4 Sep 2015 16:05:57 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 92710 invoked by uid 89); 4 Sep 2015 16:05:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com From: "Wilco Dijkstra" To: "'Joseph Myers'" Cc: "'GNU C Library'" References: <001401d0e723$29cdf720$7d69e560$@com> In-Reply-To: Subject: RE: [PATCH] Use builtins in signbit implementation Date: Fri, 4 Sep 2015 17:05:43 +0100 Message-ID: <001501d0e72b$8da141f0$a8e3c5d0$@com> MIME-Version: 1.0 X-MC-Unique: ngbxE8v4TX-5vFrombf5ew-1 > Joseph Myers wrote: > On Fri, 4 Sep 2015, Wilco Dijkstra wrote: > > > Use the GCC builtin functions for the non-inlined signbit implementations. > > This excludes the 128ibm format as I'm not sure whether the builtins work > > for that case. > > signbit should work fine for ldbl-128ibm (it's copysign and fabs that have > issues in some cases). OK, I added that version as well. > > @@ -19,13 +19,9 @@ > > > > #include > > > > -#include > > > > I'd say that when removing this #include, one of the blank lines about it > should be removed as well. Done, see below: ChangeLog: 2015-08-20 Wilco Dijkstra * sysdeps/ieee754/dbl-64/s_signbit.c (__signbit): Use __builtin_signbit. * sysdeps/ieee754/flt-32/s_signbitf.c (__signbitf): Use __builtin_signbitf. * sysdeps/ieee754/ldbl-128/s_signbitl.c (__signbitl): Use __builtin_signbitl. * sysdeps/ieee754/ldbl-96/s_signbitl.c (__signbitl): Likewise. --- sysdeps/ieee754/dbl-64/s_signbit.c | 7 +------ sysdeps/ieee754/flt-32/s_signbitf.c | 7 +------ sysdeps/ieee754/ldbl-128/s_signbitl.c | 7 +------ sysdeps/ieee754/ldbl-128ibm/s_signbitl.c | 8 +------- sysdeps/ieee754/ldbl-96/s_signbitl.c | 7 +------ 5 files changed, 5 insertions(+), 31 deletions(-) diff --git a/sysdeps/ieee754/dbl-64/s_signbit.c b/sysdeps/ieee754/dbl-64/s_signbit.c index 764f11a..91797ee 100644 --- a/sysdeps/ieee754/dbl-64/s_signbit.c +++ b/sysdeps/ieee754/dbl-64/s_signbit.c @@ -19,13 +19,8 @@ #include -#include - int __signbit (double x) { - int32_t hx; - - GET_HIGH_WORD (hx, x); - return hx & 0x80000000; + return __builtin_signbit (x); } diff --git a/sysdeps/ieee754/flt-32/s_signbitf.c b/sysdeps/ieee754/flt-32/s_signbitf.c index 169820e..034c175 100644 --- a/sysdeps/ieee754/flt-32/s_signbitf.c +++ b/sysdeps/ieee754/flt-32/s_signbitf.c @@ -19,13 +19,8 @@ #include -#include - int __signbitf (float x) { - int32_t hx; - - GET_FLOAT_WORD (hx, x); - return hx & 0x80000000; + return __builtin_signbitf (x); } diff --git a/sysdeps/ieee754/ldbl-128/s_signbitl.c b/sysdeps/ieee754/ldbl-128/s_signbitl.c index acfe859..ea689a6 100644 --- a/sysdeps/ieee754/ldbl-128/s_signbitl.c +++ b/sysdeps/ieee754/ldbl-128/s_signbitl.c @@ -19,13 +19,8 @@ #include -#include - int __signbitl (long double x) { - int64_t e; - - GET_LDOUBLE_MSW64 (e, x); - return e < 0; + return __builtin_signbitl (x); } diff --git a/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c b/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c index e95ad55..5e2bd90 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c @@ -18,18 +18,12 @@ . */ #include -#include #include int ___signbitl (long double x) { - int64_t e; - double xhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (e, xhi); - return e < 0; + return __builtin_signbitl (x); } #if IS_IN (libm) long_double_symbol (libm, ___signbitl, __signbitl); diff --git a/sysdeps/ieee754/ldbl-96/s_signbitl.c b/sysdeps/ieee754/ldbl-96/s_signbitl.c index bbe72a6..ea689a6 100644 --- a/sysdeps/ieee754/ldbl-96/s_signbitl.c +++ b/sysdeps/ieee754/ldbl-96/s_signbitl.c @@ -19,13 +19,8 @@ #include -#include - int __signbitl (long double x) { - int32_t e; - - GET_LDOUBLE_EXP (e, x); - return e & 0x8000; + return __builtin_signbitl (x); }