From patchwork Fri Sep 15 13:46:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 814280 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-84642-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="KBUQxvzW"; dkim-atps=neutral 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 3xtxY155F7z9sxR for ; Fri, 15 Sep 2017 23:47:33 +1000 (AEST) 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; q=dns; s= default; b=ldjRbj67oSRyDSzxlR50Pb6xbkATTHVk0Zx1i2N+D14aktf1wVqo8 +VYG2uwLo2DFwn5nHQ6rb4zWBGTBD9996jtYZYqGLQ+H89HcqpjSwdaJ+Koi+UMf 35V9DW+cPjqVIab7+aQ9+sJRs8AYLb36jiO7/9FQX1rBkSGEd+rofk= 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; s=default; bh=orbG1/ftvZE4fDYph2U1SIYfMvc=; b=KBUQxvzW73LOa0eGYqOhF3mCTjxI P1VXATRieS/v712ABYlSPWoa1XjjeTXivV9OvYXDkCLfKPm+GFaP+0Bq1mnx2FEW K5vQU42vSjuf8NaXsjGyN2S6aXsYUc8rBoJZ9U3hcYAg8Jg2sAcDEqpOhP4qsXnR bC8Uf1O5NFGpx0g= Received: (qmail 114644 invoked by alias); 15 Sep 2017 13:47: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 113275 invoked by uid 89); 15 Sep 2017 13:47:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_LOTSOFHASH, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=Doctor, 1234, doctor X-HELO: mx0a-001b2d01.pphosted.com From: "Tulio Magno Quites Machado Filho" To: libc-alpha@sourceware.org Subject: [PATCH] [BZ #22142] powerpc: Fix the carry bit on mpn_[add|sub]_n on POWER7 Date: Fri, 15 Sep 2017 10:46:56 -0300 X-TM-AS-GCONF: 00 x-cbid: 17091513-0052-0000-0000-00000261A039 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007742; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000228; SDB=6.00917399; UDB=6.00460774; IPR=6.00697626; BA=6.00005589; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017168; XFM=3.00000015; UTC=2017-09-15 13:47:21 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17091513-0053-0000-0000-000052041658 Message-Id: <20170915134656.1277-1-tuliom@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-15_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709150201 Fix the ifdef clause that was being used in the opposite way, setting a wrong value of the carry bit. This is also correcting 2 memory accesses that were mistakenly referring to r0 while they were supposed to mean the immediate value 0. 2017-09-15 Tulio Magno Quites Machado Filho [BZ #22142] * stdio-common/tst-printf.c (fp_test): Add tests for DBL_MAX and -DBL_MAX. (do_test): Likewise. * stdio-common/tst-printf.sh: Likewise. * sysdeps/powerpc/powerpc64/power7/add_n.S: Invert the initial ifdef clause in order to set the carry bit right. Replace r0 by 0 without changing the behavior. --- stdio-common/tst-printf.c | 4 ++++ stdio-common/tst-printf.sh | 8 ++++++++ sysdeps/powerpc/powerpc64/power7/add_n.S | 8 ++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/stdio-common/tst-printf.c b/stdio-common/tst-printf.c index b6d62a5..162effa 100644 --- a/stdio-common/tst-printf.c +++ b/stdio-common/tst-printf.c @@ -136,6 +136,8 @@ fp_test (void) } printf("%10s\n", (char *) NULL); printf("%-10s\n", (char *) NULL); + printf("%.8f\n", DBL_MAX); + printf("%.8f\n", -DBL_MAX); } static int @@ -181,6 +183,8 @@ I am ready for my first lesson today."; printf("null string:\t\"%s\"\n", (char *)NULL); printf("limited string:\t\"%.22s\"\n", longstr); + printf("a-style max:\t\"%a\"\n", DBL_MAX); + printf("a-style -max:\t\"%a\"\n", -DBL_MAX); printf("e-style >= 1:\t\"%e\"\n", 12.34); printf("e-style >= .1:\t\"%e\"\n", 0.1234); printf("e-style < .1:\t\"%e\"\n", 0.001234); diff --git a/stdio-common/tst-printf.sh b/stdio-common/tst-printf.sh index c413980..48cb62c 100644 --- a/stdio-common/tst-printf.sh +++ b/stdio-common/tst-printf.sh @@ -57,6 +57,8 @@ space-padded string: " Hi, Z." left-adjusted S string: "Hi, Z. " null string: "(null)" limited string: "Good morning, Doctor C" +a-style max: "0x1.fffffffffffffp+1023" +a-style -max: "-0x1.fffffffffffffp+1023" e-style >= 1: "1.234000e+01" e-style >= .1: "1.234000e-01" e-style < .1: "1.234000e-03" @@ -124,6 +126,8 @@ prefix 6d 6o 6x 6X 6u % | -123 | 377 | ff | FF |4294967295 | (null) (null) +179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00000000 +-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00000000 1.234568e+06 should be 1.234568e+06 1234567.800000 should be 1234567.800000 1.23457e+06 should be 1.23457e+06 @@ -173,6 +177,8 @@ space-padded string: " Hi, Z." left-adjusted S string: "Hi, Z. " null string: "(null)" limited string: "Good morning, Doctor C" +a-style max: "0x1.fffffffffffffp+1023" +a-style -max: "-0x1.fffffffffffffp+1023" e-style >= 1: "1.234000e+01" e-style >= .1: "1.234000e-01" e-style < .1: "1.234000e-03" @@ -240,6 +246,8 @@ prefix 6d 6o 6x 6X 6u % | -123 | 377 | ff | FF |4294967295 | (null) (null) +179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00000000 +-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00000000 1.234568e+06 should be 1.234568e+06 1234567.800000 should be 1234567.800000 1.23457e+06 should be 1.23457e+06 diff --git a/sysdeps/powerpc/powerpc64/power7/add_n.S b/sysdeps/powerpc/powerpc64/power7/add_n.S index 02335c1..88aec84 100644 --- a/sysdeps/powerpc/powerpc64/power7/add_n.S +++ b/sysdeps/powerpc/powerpc64/power7/add_n.S @@ -38,17 +38,17 @@ ENTRY_TOCLESS (FUNC, 5) #ifdef USE_AS_SUB - addic r0, r0, 0 + addic r0, r1, -1 #else - addic r0, r1, -1 + addic r0, r0, 0 #endif andi. r7, N, 1 beq L(bx0) ld r7, 0(UP) - ld r9, r0(VP) + ld r9, 0(VP) ADDSUBC r11, r9, r7 - std r11, r0(RP) + std r11, 0(RP) cmpldi N, N, 1 beq N, L(end) addi UP, UP, 8