]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
[BZ #22142] powerpc: Fix the carry bit on mpn_[add|sub]_n on POWER7
authorTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Fri, 13 Oct 2017 18:44:39 +0000 (15:44 -0300)
committerTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Fri, 13 Oct 2017 18:44:39 +0000 (15:44 -0300)
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.

[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.

ChangeLog
stdio-common/tst-printf.c
stdio-common/tst-printf.sh
sysdeps/powerpc/powerpc64/power7/add_n.S

index 514873b6a8f8eadd85634956f28ba92f7beb4aa3..500d1046521b2d09c4a1c5035691b9cad3c45fcc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2017-10-13  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
+
+       [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.
+
 2017-10-13  Joseph Myers  <joseph@codesourcery.com>
 
        * sysdeps/sparc/sparc32/fpu/s_fabsl.c: Include
index b6d62a5a2f840db64948f88a98346a05282422b4..162effaf6396c11aefe6a9bf61dc6083c7abbf5d 100644 (file)
@@ -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);
 }
 \f
 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);
index c413980dd3552f9a4f8336210c9c50ea719fe85b..48cb62cbca40cc44391a8bdb6bedcb93ff5c158c 100644 (file)
@@ -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
index 02335c1848a8e9a341aa64c8b5662d4d38d7f186..88aec84e5ade902231f9567ddba7b5e4a78731e2 100644 (file)
 
 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