From patchwork Tue Aug 23 18:22:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 661994 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 3sJf2N3m1Xz9sRZ for ; Wed, 24 Aug 2016 04:23:24 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=LGWtwCkz; 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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=tIAb1YPB5lKr63q04SrrvdXsX1IJQPW JgTSaGLBRtbvMmLUKNGfmH/lunzLeMiFSusl/Su3FRJW9ocQeNx/yc5BEUZvmOhQ VXd48OurU4Mvmz2CG9a6+FfFQERGGPkSYqSTIe3p+nHZWFSA1nmPMwStzdiPc3Sn JFkQWypXiHxw= 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:subject:date:message-id:in-reply-to :references; s=default; bh=GogpVB7w9BlVUM7EBs/T+0p3RMc=; b=LGWtw CkzhjZEBZcNSMHXDzl50wDci6FOYSdh1JgZWZ28ZiIcCWR+zxeiuQC9xKfmuGJmh /MFrfSNPPVclERClx15fWW8trCZwhdMZRkS9Mu2ihDpV4QyeccRX3rM8CZPKWleF CKaQP3a9NDlkkHdKSxs0NrXXRStxtAM/iop6YI= Received: (qmail 95988 invoked by alias); 23 Aug 2016 18:23:10 -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 95897 invoked by uid 89); 23 Aug 2016 18:23:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL autolearn=no version=3.3.2 spammy= X-HELO: homiemail-a59.g.dreamhost.com From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Subject: [PATCH 1/5] Consolidate reduce_and_compute code Date: Tue, 23 Aug 2016 23:52:41 +0530 Message-Id: <1471976565-3576-2-git-send-email-siddhesh@sourceware.org> In-Reply-To: <1471976565-3576-1-git-send-email-siddhesh@sourceware.org> References: <1471976565-3576-1-git-send-email-siddhesh@sourceware.org> This patch reshuffles the reduce_and_compute code so that the structure matches other code structures of the same type elsewhere in s_sin.c and s_sincos.c. This is the beginning of an attempt to consolidate and reduce code duplication in functions in s_sin.c to make it easier to read and possibly also easier for the compiler to optimize. * sysdeps/ieee754/dbl-64/s_sin.c (reduce_and_compute): Consolidate switch cases 0 and 2. --- sysdeps/ieee754/dbl-64/s_sin.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c index 7c9a079..e1ee7a9 100644 --- a/sysdeps/ieee754/dbl-64/s_sin.c +++ b/sysdeps/ieee754/dbl-64/s_sin.c @@ -249,23 +249,20 @@ reduce_and_compute (double x, unsigned int k) k = (n + k) % 4; switch (k) { - case 0: - if (a * a < 0.01588) - retval = bsloww (a, da, x, n); - else - retval = bsloww1 (a, da, x, n); - break; - case 2: - if (a * a < 0.01588) - retval = bsloww (-a, -da, x, n); - else - retval = bsloww1 (-a, -da, x, n); - break; + case 2: + a = -a; + da = -da; + case 0: + if (a * a < 0.01588) + retval = bsloww (a, da, x, n); + else + retval = bsloww1 (a, da, x, n); + break; - case 1: - case 3: - retval = bsloww2 (a, da, x, n); - break; + case 1: + case 3: + retval = bsloww2 (a, da, x, n); + break; } return retval; }