]> sourceware.org Git - glibc.git/commitdiff
PowerPC floating point little-endian [12 of 15]
authorAlan Modra <amodra@gmail.com>
Sat, 17 Aug 2013 09:01:45 +0000 (18:31 +0930)
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Fri, 15 Nov 2013 17:29:10 +0000 (11:29 -0600)
http://sourceware.org/ml/libc-alpha/2013-08/msg00087.html

Fixes for little-endian in 32-bit assembly.

* sysdeps/powerpc/sysdep.h (LOWORD, HIWORD, HISHORT): Define.
* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Load little-endian
words of double from correct stack offsets.
* sysdeps/powerpc/powerpc32/fpu/s_copysignl.S: Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_lround.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Likewise.
* sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Likewise.
* sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S: Likewise.
* sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise.
* sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Use HISHORT.
* sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.

20 files changed:
ChangeLog
sysdeps/powerpc/powerpc32/fpu/s_copysign.S
sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
sysdeps/powerpc/powerpc32/fpu/s_lrint.S
sysdeps/powerpc/powerpc32/fpu/s_lround.S
sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S
sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S
sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S
sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S
sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S
sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S
sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S
sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S
sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S
sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
sysdeps/powerpc/sysdep.h

index 5327d980b9de2ddc5a2c857b31c67e36e1c9e6cc..e8e9cd938c0e7dc1a8ef857181b97748c680b4fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2013-10-04  Alan Modra  <amodra@gmail.com>
+
+       * sysdeps/powerpc/sysdep.h (LOWORD, HIWORD, HISHORT): Define.
+       * sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Load little-endian
+       words of double from correct stack offsets.
+       * sysdeps/powerpc/powerpc32/fpu/s_copysignl.S: Likewise.
+       * sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Likewise.
+       * sysdeps/powerpc/powerpc32/fpu/s_lround.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise.
+       * sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Use HISHORT.
+       * sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
+
 2013-10-04  Alan Modra  <amodra@gmail.com>
 
        * sysdeps/powerpc/fpu_control.h (_FPU_GETCW): Rewrite using
index 840891f1c388d24110924d29838f97ebc0333863..1da24f492ec0838f1fa1299ed445f213e375de71 100644 (file)
@@ -29,7 +29,7 @@ ENTRY(__copysign)
        stwu    r1,-16(r1)
        cfi_adjust_cfa_offset (16)
        stfd    fp2,8(r1)
-       lwz     r3,8(r1)
+       lwz     r3,8+HIWORD(r1)
        cmpwi   r3,0
        addi    r1,r1,16
        cfi_adjust_cfa_offset (-16)
index 4ec8389b5d146839b049a5852e246639a0931453..2ad6de273d8466153afb52fbb91deca85a3be54c 100644 (file)
@@ -30,7 +30,7 @@ ENTRY(__copysignl)
        fmr     fp0,fp1
        fabs    fp1,fp1
        fcmpu   cr7,fp0,fp1
-       lwz     r3,8(r1)
+       lwz     r3,8+HIWORD(r1)
        cmpwi   cr6,r3,0
        addi    r1,r1,16
        cfi_adjust_cfa_offset (-16)
index 27881f8cc70d4a83b23fc2bc203b10f3d093068d..249fda501f808d94392af481e78f95912845b8d1 100644 (file)
@@ -24,10 +24,10 @@ ENTRY (__lrint)
        stwu    r1,-16(r1)
        fctiw   fp13,fp1
        stfd    fp13,8(r1)
-       nop     /* Insure the following load is in a different dispatch group */
+       nop     /* Ensure the following load is in a different dispatch group */
        nop     /* to avoid pipe stall on POWER4&5.  */
        nop
-       lwz     r3,12(r1)
+       lwz     r3,8+LOWORD(r1)
        addi    r1,r1,16
        blr
        END (__lrint)
index 92dc3787d69910cc75312adf46e9f4290f8b7b5e..6309f864b7046333b6e7daa96d4445f77232118f 100644 (file)
@@ -67,7 +67,7 @@ ENTRY (__lround)
        nop     /* Ensure the following load is in a different dispatch  */
        nop     /* group to avoid pipe stall on POWER4&5.  */
        nop
-       lwz     r3,12(r1)       /* Load return as integer.  */
+       lwz     r3,8+LOWORD(r1) /* Load return as integer.  */
 .Lout:
        addi    r1,r1,16
        blr
index 55b2850fd1c4e7d73a77584e44428c6b6c0dfa33..e7a88feb4b3ca62412306df5f204ffd1ed92f87a 100644 (file)
@@ -29,8 +29,8 @@ ENTRY (__llrint)
        nop     /* Insure the following load is in a different dispatch group */
        nop     /* to avoid pipe stall on POWER4&5.  */
        nop
-       lwz     r3,8(r1)
-       lwz     r4,12(r1)
+       lwz     r3,8+HIWORD(r1)
+       lwz     r4,8+LOWORD(r1)
        addi    r1,r1,16
        blr
        END (__llrint)
index cc80fcb02abd68957ccec63e56a11b7987e10a3a..da24ad38d3cb80cde9d9b9d6ed9265c803065323 100644 (file)
@@ -28,8 +28,8 @@ ENTRY (__llrintf)
        nop     /* Insure the following load is in a different dispatch group */
        nop     /* to avoid pipe stall on POWER4&5.  */
        nop
-       lwz     r3,8(r1)
-       lwz     r4,12(r1)
+       lwz     r3,8+HIWORD(r1)
+       lwz     r4,8+LOWORD(r1)
        addi    r1,r1,16
        blr
        END (__llrintf)
index ecd37c3cd2a0b5fab0e3fe84de58c117bb1434c6..49c8a0866151bcfdb6a4b358563bd131cf91b42c 100644 (file)
@@ -39,8 +39,8 @@ ENTRY (__llround)
        nop     /* Ensure the following load is in a different dispatch  */
        nop     /* group to avoid pipe stall on POWER4&5.  */
        nop
-       lwz     r4,12(r1)
-       lwz     r3,8(r1)
+       lwz     r3,8+HIWORD(r1)
+       lwz     r4,8+LOWORD(r1)
        addi    r1,r1,16
        blr
        END (__llround)
index d4da625bb75de9db5e61b0730f659c91ad172887..780dd9ca41e6f8e9528b7788ce73ef020eb225f7 100644 (file)
@@ -38,7 +38,7 @@ ENTRY (__lround)
        nop     /* Ensure the following load is in a different dispatch  */
        nop     /* group to avoid pipe stall on POWER4&5.  */
        nop
-       lwz     r3,12(r1)
+       lwz     r3,8+LOWORD(r1)
        addi    r1,r1,16
        blr
        END (__lround)
index f2417fdf41d6565b4a7fe399068dc55af281e582..5f7ba43a2a33cbf54b8e733d1f7c7f7859592e56 100644 (file)
@@ -27,8 +27,8 @@ EALIGN (__isnan, 4, 0)
        ori     r1,r1,0
        stfd    fp1,24(r1)      /* copy FPR to GPR */
        ori     r1,r1,0
-       lwz     r4,24(r1)
-       lwz     r5,28(r1)
+       lwz     r4,24+HIWORD(r1)
+       lwz     r5,24+LOWORD(r1)
        lis     r0,0x7ff0       /* const long r0 0x7ff00000 00000000 */
        clrlwi  r4,r4,1         /* x = fabs(x) */
        cmpw    cr7,r4,r0       /* if (fabs(x) =< inf) */
index 2c095db1d4f3497842a726f9f084be5db8726ff5..3ea18589c855e54f5eb3e8c47f8f1514e06e621f 100644 (file)
@@ -27,8 +27,8 @@ EALIGN (__isnan, 4, 0)
        ori     r1,r1,0
        stfd    fp1,24(r1)      /* copy FPR to GPR */
        ori     r1,r1,0
-       lwz     r4,24(r1)
-       lwz     r5,28(r1)
+       lwz     r4,24+HIWORD(r1)
+       lwz     r5,24+LOWORD(r1)
        lis     r0,0x7ff0       /* const long r0 0x7ff00000 00000000 */
        clrlwi  r4,r4,1         /* x = fabs(x) */
        cmpw    cr7,r4,r0       /* if (fabs(x) =< inf) */
index 3344b312e2aa166a1db85da4a1b636ff3da945ec..c0660cf6ec79449e1523005a3b6dc63f4822c291 100644 (file)
@@ -29,8 +29,8 @@ ENTRY (__llrint)
 /* Insure the following load is in a different dispatch group by
    inserting "group ending nop".  */
        ori     r1,r1,0
-       lwz     r3,8(r1)
-       lwz     r4,12(r1)
+       lwz     r3,8+HIWORD(r1)
+       lwz     r4,8+LOWORD(r1)
        addi    r1,r1,16
        blr
        END (__llrint)
index 7f64f8d12b9f8958c49a3f79758d0ee6b230740d..ce298905c1fb374e8c3e34f99f88c92147236587 100644 (file)
@@ -28,8 +28,8 @@ ENTRY (__llrintf)
 /* Insure the following load is in a different dispatch group by
    inserting "group ending nop".  */
        ori     r1,r1,0
-       lwz     r3,8(r1)
-       lwz     r4,12(r1)
+       lwz     r3,8+HIWORD(r1)
+       lwz     r4,8+LOWORD(r1)
        addi    r1,r1,16
        blr
        END (__llrintf)
index 0ff04cb71821ddc21fd49bf9e2186012f4a9b497..abb0840d18cf7b2bb43bda4d2b5818728e0e3783 100644 (file)
@@ -39,8 +39,8 @@ ENTRY (__llround)
 /* Insure the following load is in a different dispatch group by
    inserting "group ending nop".  */
        ori     r1,r1,0
-       lwz     r4,12(r1)
-       lwz     r3,8(r1)
+       lwz     r3,8+HIWORD(r1)
+       lwz     r4,8+LOWORD(r1)
        addi    r1,r1,16
        blr
        END (__llround)
index b2ab5bfe7bd0875cd2630d459465d5f4c2669d5b..095c15547a4e4cc3605eabd3e9b5fa26599d233f 100644 (file)
@@ -54,9 +54,8 @@ ENTRY (__finite)
        stfd    fp1,8(r1)     /* Transfer FP to GPR's.  */
 
        ori     2,2,0         /* Force a new dispatch group.  */
-       lhz     r0,8(r1)      /* Fetch the upper portion of the high word of
-                             the FP value (where the exponent and sign bits
-                             are).  */
+       lhz     r0,8+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
+                                   (biased exponent and sign bit).  */
        clrlwi  r0,r0,17      /* r0 = abs(r0).  */
        addi    r1,r1,16      /* Reset the stack pointer.  */
        cmpwi   cr7,r0,0x7ff0 /* r4 == 0x7ff0?.  */
index 3f8af60a55e7b6cd39373938e0f0e58d7c980106..0101c8fa1752697ffae487f9d96d5d390d409592 100644 (file)
@@ -48,14 +48,13 @@ ENTRY (__isinf)
        li      r3,0
        bflr    29            /* If not INF, return.  */
 
-       /* Either we have -INF/+INF or a denormal.  */
+       /* Either we have +INF or -INF.  */
 
        stwu    r1,-16(r1)    /* Allocate stack space.  */
        stfd    fp1,8(r1)     /* Transfer FP to GPR's.  */
        ori     2,2,0         /* Force a new dispatch group.  */
-       lhz     r4,8(r1)      /* Fetch the upper portion of the high word of
-                             the FP value (where the exponent and sign bits
-                             are).  */
+       lhz     r4,8+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
+                                   (biased exponent and sign bit).  */
        addi    r1,r1,16      /* Reset the stack pointer.  */
        cmpwi   cr7,r4,0x7ff0 /* r4 == 0x7ff0?  */
        li      r3,1
index 99ff1269610c9174632c72f6d119c7a783440573..0ad1dcf1f7c314ec8ba698864e6bff222cbd58c3 100644 (file)
@@ -53,8 +53,8 @@ ENTRY (__isnan)
        stwu    r1,-16(r1)    /* Allocate stack space.  */
        stfd    fp1,8(r1)     /* Transfer FP to GPR's.  */
        ori     2,2,0         /* Force a new dispatch group.  */
-       lwz     r4,8(r1)      /* Load the upper half of the FP value.  */
-       lwz     r5,12(r1)     /* Load the lower half of the FP value.  */
+       lwz     r4,8+HIWORD(r1) /* Load the upper half of the FP value.  */
+       lwz     r5,8+LOWORD(r1) /* Load the lower half of the FP value.  */
        addi    r1,r1,16      /* Reset the stack pointer.  */
        lis     r0,0x7ff0     /* Load the upper portion for an INF/NaN.  */
        clrlwi  r4,r4,1       /* r4 = abs(r4).  */
index d0071c7658077f0d24c60b5b4479820c6379178c..ebec0e0badb17a0c17a301d0732f14d24e142e38 100644 (file)
@@ -39,10 +39,8 @@ EALIGN (__finite, 4, 0)
 
        stfd    fp1,-16(r1)   /* Transfer FP to GPR's.  */
        ori     2,2,0         /* Force a new dispatch group.  */
-
-       lhz     r4,-16(r1)    /* Fetch the upper portion of the high word of
-                             the FP value (where the exponent and sign bits
-                             are).  */
+       lhz     r4,-16+HISHORT(r1)  /* Fetch the upper 16 bits of the FP value
+                                   (biased exponent and sign bit).  */
        clrlwi  r4,r4,17      /* r4 = abs(r4).  */
        cmpwi   cr7,r4,0x7ff0 /* r4 == 0x7ff0?  */
        bltlr   cr7           /* LT means finite, other non-finite.  */
index 1aea12383f9ba69681e1576d1c7cff4d54e216b0..8d088db5afdcfd78cd8a6c6160206247ed8129e5 100644 (file)
@@ -38,9 +38,8 @@ EALIGN (__isinf, 4, 0)
 
        stfd    fp1,-16(r1)   /* Transfer FP to GPR's.  */
        ori     2,2,0         /* Force a new dispatch group.  */
-       lhz     r4,-16(r1)    /* Fetch the upper portion of the high word of
-                             the FP value (where the exponent and sign bits
-                             are).  */
+       lhz     r4,-16+HISHORT(r1)  /* Fetch the upper 16 bits of the FP value
+                                   (biased exponent and sign bit).  */
        cmpwi   cr7,r4,0x7ff0 /* r4 == 0x7ff0?  */
        li      r3,1
        beqlr   cr7           /* EQ means INF, otherwise -INF.  */
index 1b5334ad3480805db0f8fe3ae423bc6d8eacde90..bc2cb6681af93bea651ddf0184fb7bb23c2f6e21 100644 (file)
 
 #define VRSAVE 256
 
+/* The 32-bit words of a 64-bit dword are at these offsets in memory.  */
+#if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+# define LOWORD 0
+# define HIWORD 4
+#else
+# define LOWORD 4
+# define HIWORD 0
+#endif
+
+/* The high 16-bit word of a 64-bit dword is at this offset in memory.  */
+#if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+# define HISHORT 6
+#else
+# define HISHORT 0
+#endif
 
 /* This seems to always be the case on PPC.  */
 #define ALIGNARG(log2) log2
This page took 0.132773 seconds and 5 git commands to generate.