From patchwork Tue May 20 21:20:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1041 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 9399B360098 for ; Tue, 20 May 2014 14:20:31 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14307373) id 42B4F63C37004; Tue, 20 May 2014 14:20:31 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx23.g.dreamhost.com 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 homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id 1F72F63C370AF for ; Tue, 20 May 2014 14:20:31 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; q=dns; s=default; b=d5Y Lx0a796KZ/lu8tseK4a5b3YCTbqxEVxS2DRl047dYTWDhPL2JgVVCyxVTVnPjqZz hzZVIq7ICImRbpI/Vq4CzFgi7P+F14JjpKgwr7Soonfal8Ouy3pb39pdh1e8K6pU wv/jkEpe25rX8x7anr/l7Ra7y1M32C/I5OUXRtSs= 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:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; s=default; bh=6Yq3E1ccv vbvetOg1wBCAt46Cm0=; b=jbsoEWi6iVNb3Dbo9RSkFacD80Dw2pjwALkM5eOjk eUNqIKXxTAUUF0dgimdJCzaihgSSdHSeS0y2Y4/4rXuxO5YZ/5omRyuTLkXP+KXL 5SZ+CY3vPCpaUHb28FKYQv20+UyLbqKtUMeAZQaJpVRrDndheWzjQWFwMa4sdN0N hQ= Received: (qmail 12522 invoked by alias); 20 May 2014 21:20:28 -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 12506 invoked by uid 89); 20 May 2014 21:20:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e24smtp02.br.ibm.com Message-ID: <537BC70F.1070304@linux.vnet.ibm.com> Date: Tue, 20 May 2014 18:20:15 -0300 From: Adhemerval Zanella User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: "GNU C. Library" Subject: [COMMITTED] PowerPC: Fix copysignf optimization macro X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14052021-2194-0000-0000-000008DD048D X-DH-Original-To: glibc@patchwork.siddhesh.in This patch fixes the __copysignf optimized macro meant to internal libm usage when used with constant value. Without the explicit cast to float, if it is used with const double value (for instance, on s_casinhf.c) double constants will be used and it may lead to precision issues in some algorithms. It fixes the following failures on PPC64/POWER7: Failure: Test: Real part of: cacos_downward (inf + 0 i) Result: is: 1.19209289550781250000e-07 0x1.00000000000000000000p-23 should be: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 Failure: Test: Real part of: cacos_downward (inf - 0 i) Result: is: 1.19209289550781250000e-07 0x1.00000000000000000000p-23 should be: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 Failure: Test: Real part of: cacos_downward (inf + 0.5 i) Result: is: 1.19209289550781250000e-07 0x1.00000000000000000000p-23 should be: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 Failure: Test: Real part of: cacos_downward (inf - 0.5 i) Result: is: 1.19209289550781250000e-07 0x1.00000000000000000000p-23 should be: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 Failure: Test: Real part of: cacos_towardzero (inf + 0 i) Result: is: 1.19209289550781250000e-07 0x1.00000000000000000000p-23 should be: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 Failure: Test: Real part of: cacos_towardzero (inf - 0 i) Result: is: 1.19209289550781250000e-07 0x1.00000000000000000000p-23 should be: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 Failure: Test: Real part of: cacos_towardzero (inf + 0.5 i) Result: is: 1.19209289550781250000e-07 0x1.00000000000000000000p-23 should be: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 Failure: Test: Real part of: cacos_towardzero (inf - 0.5 i) Result: is: 1.19209289550781250000e-07 0x1.00000000000000000000p-23 should be: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 --- 2014-05-20 Adhemerval Zanella * sysdeps/powerpc/fpu/math_private.h [__copysignf]: Fix copysign macro optimization when used with float constants. -- diff --git a/sysdeps/powerpc/fpu/math_private.h b/sysdeps/powerpc/fpu/math_private.h index dde153d..1ec4881 100644 --- a/sysdeps/powerpc/fpu/math_private.h +++ b/sysdeps/powerpc/fpu/math_private.h @@ -166,11 +166,13 @@ __ieee754_sqrtf (float __x) # ifndef __copysignf # define __copysignf(x, y) \ ({ float __z; \ + float __x = x; \ + float __y = y; \ __asm __volatile ( \ " fcpsgn %0,%1,%2\n" \ " frsp %0,%0\n" \ : "=f" (__z) \ - : "f" (y), "f" (x)); \ + : "f" (__y), "f" (__x));\ __z; }) # endif