Hi! I only recently started the transition from eglibc to glibc on powerpcspe. See the attached patch.
Unfortunately, this still contains some rough architecture specific changes: Besides conditionals around powerpc (vs. powerpcspe) specific asm which should be ok, I just deleted some powerpc specific files (e.g. s_fabs.S in sysdeps/powerpc/fpu/ and sysdeps/powerpc/powerpc32/fpu/) to force generic implementations of those functions instead of powerpc specific. This is of course not a solution to patch into the standard Debian package. Now my question to more experienced glibc developers: What would be the best way here to do those changes powerpcspe/e500 compatibly and at the same time keep the default powerpc asm files etc.? Thanks in advance, Roland
Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_copysign.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_copysign.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* Copy a sign bit between floating-point values. - Copyright (C) 1997-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - -ENTRY(__copysign) -/* double [f1] copysign (double [f1] x, double [f2] y); - copysign(x,y) returns a value with the magnitude of x and - with the sign bit of y. */ - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - stfd fp2,8(r1) - lwz r3,8+HIWORD(r1) - cmpwi r3,0 - addi r1,r1,16 - cfi_adjust_cfa_offset (-16) - blt L(0) - fabs fp1,fp1 - blr -L(0): fnabs fp1,fp1 - blr - END (__copysign) - -weak_alias (__copysign,copysign) - -/* It turns out that it's safe to use this code even for single-precision. */ -weak_alias (__copysign,copysignf) -strong_alias(__copysign,__copysignf) - -#ifdef NO_LONG_DOUBLE -weak_alias (__copysign,copysignl) -strong_alias(__copysign,__copysignl) -#endif -#ifdef IS_IN_libm -# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __copysign, copysignl, GLIBC_2_0) -# endif -#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __copysign, copysignl, GLIBC_2_0) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* Copy a sign bit between floating-point values. - IBM extended format long double version. - Copyright (C) 2006-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - -ENTRY(__copysignl) -/* long double [f1,f2] copysign (long double [f1,f2] x, long double [f3,f4] y); - copysign(x,y) returns a value with the magnitude of x and - with the sign bit of y. */ - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - stfd fp3,8(r1) - fmr fp0,fp1 - fabs fp1,fp1 - fcmpu cr7,fp0,fp1 - lwz r3,8+HIWORD(r1) - cmpwi cr6,r3,0 - addi r1,r1,16 - cfi_adjust_cfa_offset (-16) - beq cr7,L(0) - fneg fp2,fp2 -L(0): bgelr cr6 - fneg fp1,fp1 - fneg fp2,fp2 - blr -END (__copysignl) - -#ifdef IS_IN_libm -long_double_symbol (libm, __copysignl, copysignl) -#else -long_double_symbol (libc, __copysignl, copysignl) -#endif Index: glibc-2.19/sysdeps/powerpc/fpu/math_ldbl.h =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/math_ldbl.h 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/powerpc/fpu/math_ldbl.h 2014-11-10 14:30:05.156138824 +0100 @@ -2,6 +2,7 @@ #error "Never use <math_ldbl.h> directly; include <math_private.h> instead." #endif +#ifndef __NO_FPRS__ /* GCC does not optimize the default ldbl_pack code to not spill register in the stack. The following optimization tells gcc that pack/unpack is really a nop. We use fr1/fr2 because those are the regs used to @@ -32,5 +33,5 @@ #define ldbl_pack ldbl_pack_ppc #define ldbl_unpack ldbl_unpack_ppc - +#endif #include <sysdeps/ieee754/ldbl-128ibm/math_ldbl.h> Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S 2014-11-10 14:30:05.156138824 +0100 @@ -40,47 +40,83 @@ (-4@4), and target address (4@0), respectively. */ LIBC_PROBE (setjmp, 3, 4@3, -4@4, 4@0) stw r14,((JB_GPRS+0)*4)(3) +#ifndef __NO_FPRS__ stfd fp14,((JB_FPRS+0*2)*4)(3) +#endif #ifdef PTR_MANGLE PTR_MANGLE2 (r0, r6) #endif stw r0,(JB_LR*4)(3) stw r15,((JB_GPRS+1)*4)(3) +#ifndef __NO_FPRS__ stfd fp15,((JB_FPRS+1*2)*4)(3) +#endif mfcr r0 stw r16,((JB_GPRS+2)*4)(3) +#ifndef __NO_FPRS__ stfd fp16,((JB_FPRS+2*2)*4)(3) +#endif stw r0,(JB_CR*4)(3) stw r17,((JB_GPRS+3)*4)(3) +#ifndef __NO_FPRS__ stfd fp17,((JB_FPRS+3*2)*4)(3) +#endif stw r18,((JB_GPRS+4)*4)(3) +#ifndef __NO_FPRS__ stfd fp18,((JB_FPRS+4*2)*4)(3) +#endif stw r19,((JB_GPRS+5)*4)(3) +#ifndef __NO_FPRS__ stfd fp19,((JB_FPRS+5*2)*4)(3) +#endif stw r20,((JB_GPRS+6)*4)(3) +#ifndef __NO_FPRS__ stfd fp20,((JB_FPRS+6*2)*4)(3) +#endif stw r21,((JB_GPRS+7)*4)(3) +#ifndef __NO_FPRS__ stfd fp21,((JB_FPRS+7*2)*4)(3) +#endif stw r22,((JB_GPRS+8)*4)(3) +#ifndef __NO_FPRS__ stfd fp22,((JB_FPRS+8*2)*4)(3) +#endif stw r23,((JB_GPRS+9)*4)(3) +#ifndef __NO_FPRS__ stfd fp23,((JB_FPRS+9*2)*4)(3) +#endif stw r24,((JB_GPRS+10)*4)(3) +#ifndef __NO_FPRS__ stfd fp24,((JB_FPRS+10*2)*4)(3) +#endif stw r25,((JB_GPRS+11)*4)(3) +#ifndef __NO_FPRS__ stfd fp25,((JB_FPRS+11*2)*4)(3) +#endif stw r26,((JB_GPRS+12)*4)(3) +#ifndef __NO_FPRS__ stfd fp26,((JB_FPRS+12*2)*4)(3) +#endif stw r27,((JB_GPRS+13)*4)(3) +#ifndef __NO_FPRS__ stfd fp27,((JB_FPRS+13*2)*4)(3) +#endif stw r28,((JB_GPRS+14)*4)(3) +#ifndef __NO_FPRS__ stfd fp28,((JB_FPRS+14*2)*4)(3) +#endif stw r29,((JB_GPRS+15)*4)(3) +#ifndef __NO_FPRS__ stfd fp29,((JB_FPRS+15*2)*4)(3) +#endif stw r30,((JB_GPRS+16)*4)(3) +#ifndef __NO_FPRS__ stfd fp30,((JB_FPRS+16*2)*4)(3) +#endif stw r31,((JB_GPRS+17)*4)(3) +#ifndef __NO_FPRS__ stfd fp31,((JB_FPRS+17*2)*4)(3) +#endif #ifndef __NO_VMX__ # ifdef PIC mflr r6 Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S 2014-11-10 14:30:05.156138824 +0100 @@ -125,19 +125,33 @@ #endif lwz r0,(JB_LR*4)(r3) lwz r14,((JB_GPRS+0)*4)(r3) +#ifndef __NO_FPRS__ lfd fp14,((JB_FPRS+0*2)*4)(r3) +#endif lwz r15,((JB_GPRS+1)*4)(r3) +#ifndef __NO_FPRS__ lfd fp15,((JB_FPRS+1*2)*4)(r3) +#endif lwz r16,((JB_GPRS+2)*4)(r3) +#ifndef __NO_FPRS__ lfd fp16,((JB_FPRS+2*2)*4)(r3) +#endif lwz r17,((JB_GPRS+3)*4)(r3) +#ifndef __NO_FPRS__ lfd fp17,((JB_FPRS+3*2)*4)(r3) +#endif lwz r18,((JB_GPRS+4)*4)(r3) +#ifndef __NO_FPRS__ lfd fp18,((JB_FPRS+4*2)*4)(r3) +#endif lwz r19,((JB_GPRS+5)*4)(r3) +#ifndef __NO_FPRS__ lfd fp19,((JB_FPRS+5*2)*4)(r3) +#endif lwz r20,((JB_GPRS+6)*4)(r3) +#ifndef __NO_FPRS__ lfd fp20,((JB_FPRS+6*2)*4)(r3) +#endif #ifdef PTR_DEMANGLE # ifndef CHECK_SP PTR_DEMANGLE3 (r1, r24, r25) @@ -149,29 +163,51 @@ LIBC_PROBE (longjmp, 3, 4@3, -4@4, 4@0) mtlr r0 lwz r21,((JB_GPRS+7)*4)(r3) +#ifndef __NO_FPRS__ lfd fp21,((JB_FPRS+7*2)*4)(r3) +#endif lwz r22,((JB_GPRS+8)*4)(r3) +#ifndef __NO_FPRS__ lfd fp22,((JB_FPRS+8*2)*4)(r3) +#endif lwz r5,(JB_CR*4)(r3) lwz r23,((JB_GPRS+9)*4)(r3) +#ifndef __NO_FPRS__ lfd fp23,((JB_FPRS+9*2)*4)(r3) +#endif lwz r24,((JB_GPRS+10)*4)(r3) +#ifndef __NO_FPRS__ lfd fp24,((JB_FPRS+10*2)*4)(r3) +#endif lwz r25,((JB_GPRS+11)*4)(r3) +#ifndef __NO_FPRS__ lfd fp25,((JB_FPRS+11*2)*4)(r3) +#endif mtcrf 0xFF,r5 lwz r26,((JB_GPRS+12)*4)(r3) +#ifndef __NO_FPRS__ lfd fp26,((JB_FPRS+12*2)*4)(r3) +#endif lwz r27,((JB_GPRS+13)*4)(r3) +#ifndef __NO_FPRS__ lfd fp27,((JB_FPRS+13*2)*4)(r3) +#endif lwz r28,((JB_GPRS+14)*4)(r3) +#ifndef __NO_FPRS__ lfd fp28,((JB_FPRS+14*2)*4)(r3) +#endif lwz r29,((JB_GPRS+15)*4)(r3) +#ifndef __NO_FPRS__ lfd fp29,((JB_FPRS+15*2)*4)(r3) +#endif lwz r30,((JB_GPRS+16)*4)(r3) +#ifndef __NO_FPRS__ lfd fp30,((JB_FPRS+16*2)*4)(r3) +#endif lwz r31,((JB_GPRS+17)*4)(r3) +#ifndef __NO_FPRS__ lfd fp31,((JB_FPRS+17*2)*4)(r3) +#endif LIBC_PROBE (longjmp_target, 3, 4@3, -4@4, 4@0) mr r3,r4 blr Index: glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S =================================================================== --- glibc-2.19.orig/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S 2014-11-10 14:30:05.160138852 +0100 @@ -106,6 +106,7 @@ #ifdef __CONTEXT_ENABLE_FPRS /* Save the floating-point registers */ +#ifndef __NO_FPRS__ stfd fp0,_UC_FREGS+(0*8)(r3) stfd fp1,_UC_FREGS+(1*8)(r3) stfd fp2,_UC_FREGS+(2*8)(r3) @@ -140,6 +141,7 @@ stfd fp30,_UC_FREGS+(30*8)(r3) stfd fp31,_UC_FREGS+(31*8)(r3) stfd fp0,_UC_FREGS+(32*8)(r3) +#endif # ifdef __CONTEXT_ENABLE_VRS # ifdef PIC Index: glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S =================================================================== --- glibc-2.19.orig/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S 2014-11-10 14:30:05.160138852 +0100 @@ -192,11 +192,15 @@ 2: /* L(has_no_vec): */ # endif /* __CONTEXT_ENABLE_VRS */ /* Restore the floating-point registers */ +#ifndef __NO_FPRS__ lfd fp31,_UC_FREGS+(32*8)(r31) lfd fp0,_UC_FREGS+(0*8)(r31) +#endif # ifdef _ARCH_PWR6 /* Use the extended four-operand version of the mtfsf insn. */ +#ifndef __NO_FPRS__ mtfsf 0xff,fp31,1,0 +#endif # else .machine push .machine "power6" @@ -204,12 +208,18 @@ andi. r6,r7,PPC_FEATURE_HAS_DFP beq 7f /* Use the extended four-operand version of the mtfsf insn. */ +#ifndef __NO_FPRS__ mtfsf 0xff,fp31,1,0 +#endif b 8f /* Continue to operate on the FPSCR as if it were 32-bits. */ -7: mtfsf 0xff,fp31 +7: +#ifndef __NO_FPRS__ + mtfsf 0xff,fp31 +#endif 8: .machine pop # endif /* _ARCH_PWR6 */ +#ifndef __NO_FPRS__ lfd fp1,_UC_FREGS+(1*8)(r31) lfd fp2,_UC_FREGS+(2*8)(r31) lfd fp3,_UC_FREGS+(3*8)(r31) @@ -241,6 +251,7 @@ lfd fp29,_UC_FREGS+(29*8)(r31) lfd fp30,_UC_FREGS+(30*8)(r31) lfd fp31,_UC_FREGS+(31*8)(r31) +#endif #endif /* __CONTEXT_ENABLE_FPRS */ #ifdef __CONTEXT_ENABLE_E500 Index: glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S =================================================================== --- glibc-2.19.orig/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S 2014-11-10 14:30:05.160138852 +0100 @@ -108,6 +108,7 @@ #ifdef __CONTEXT_ENABLE_FPRS /* Save the floating-point registers */ +#ifndef __NO_FPRS__ stfd fp0,_UC_FREGS+(0*8)(r3) stfd fp1,_UC_FREGS+(1*8)(r3) stfd fp2,_UC_FREGS+(2*8)(r3) @@ -142,6 +143,7 @@ stfd fp30,_UC_FREGS+(30*8)(r3) stfd fp31,_UC_FREGS+(31*8)(r3) stfd fp0,_UC_FREGS+(32*8)(r3) +#endif # ifdef PIC mflr r8 @@ -421,11 +423,15 @@ 6: /* L(has_no_vec): */ # endif /* __CONTEXT_ENABLE_VRS */ /* Restore the floating-point registers */ +#ifndef __NO_FPRS__ lfd fp31,_UC_FREGS+(32*8)(r31) lfd fp0,_UC_FREGS+(0*8)(r31) +#endif # ifdef _ARCH_PWR6 /* Use the extended four-operand version of the mtfsf insn. */ +#ifndef __NO_FPRS__ mtfsf 0xff,fp31,1,0 +#endif # else .machine push .machine "power6" @@ -433,12 +439,18 @@ andi. r6,r7,PPC_FEATURE_HAS_DFP beq 7f /* Use the extended four-operand version of the mtfsf insn. */ +#ifndef __NO_FPRS__ mtfsf 0xff,fp31,1,0 +#endif b 8f /* Continue to operate on the FPSCR as if it were 32-bits. */ -7: mtfsf 0xff,fp31 +7: +#ifndef __NO_FPRS__ + mtfsf 0xff,fp31 +#endif 8: .machine pop #endif /* _ARCH_PWR6 */ +#ifndef __NO_FPRS__ lfd fp1,_UC_FREGS+(1*8)(r31) lfd fp2,_UC_FREGS+(2*8)(r31) lfd fp3,_UC_FREGS+(3*8)(r31) @@ -470,6 +482,7 @@ lfd fp29,_UC_FREGS+(29*8)(r31) lfd fp30,_UC_FREGS+(30*8)(r31) lfd fp31,_UC_FREGS+(31*8)(r31) +#endif #endif /* __CONTEXT_ENABLE_FPRS */ #ifdef __CONTEXT_ENABLE_E500 Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/fprsave.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/fprsave.S 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/powerpc/powerpc32/fpu/fprsave.S 2014-11-10 14:30:05.164138881 +0100 @@ -25,84 +25,132 @@ .globl C_TEXT(_savef14) .globl C_TEXT(_savefpr_14) C_TEXT(_savef14): -C_TEXT(_savefpr_14): stfd fp14,-144(r1) +C_TEXT(_savefpr_14): +#ifndef __NO_FPRS__ + stfd fp14,-144(r1) +#endif cfi_offset(fp14,-144) .globl C_TEXT(_savef15) .globl C_TEXT(_savefpr_15) C_TEXT(_savef15): -C_TEXT(_savefpr_15): stfd fp15,-136(r1) +C_TEXT(_savefpr_15): +#ifndef __NO_FPRS__ + stfd fp15,-136(r1) +#endif cfi_offset(fp15,-136) .globl C_TEXT(_savef16) .globl C_TEXT(_savefpr_16) C_TEXT(_savef16): -C_TEXT(_savefpr_16): stfd fp16,-128(r1) +C_TEXT(_savefpr_16): +#ifndef __NO_FPRS__ + stfd fp16,-128(r1) +#endif cfi_offset(fp16,-128) .globl C_TEXT(_savef17) .globl C_TEXT(_savefpr_17) C_TEXT(_savef17): -C_TEXT(_savefpr_17): stfd fp17,-120(r1) +C_TEXT(_savefpr_17): +#ifndef __NO_FPRS__ + stfd fp17,-120(r1) +#endif cfi_offset(fp17,-120) .globl C_TEXT(_savef18) .globl C_TEXT(_savefpr_18) C_TEXT(_savef18): -C_TEXT(_savefpr_18): stfd fp18,-112(r1) +C_TEXT(_savefpr_18): +#ifndef __NO_FPRS__ + stfd fp18,-112(r1) +#endif cfi_offset(fp18,-112) .globl C_TEXT(_savef19) .globl C_TEXT(_savefpr_19) C_TEXT(_savef19): -C_TEXT(_savefpr_19): stfd fp19,-104(r1) +C_TEXT(_savefpr_19): +#ifndef __NO_FPRS__ + stfd fp19,-104(r1) +#endif cfi_offset(fp19,-104) .globl C_TEXT(_savef20) .globl C_TEXT(_savefpr_20) C_TEXT(_savef20): -C_TEXT(_savefpr_20): stfd fp20,-96(r1) +C_TEXT(_savefpr_20): +#ifndef __NO_FPRS__ + stfd fp20,-96(r1) +#endif cfi_offset(fp20,-96) .globl C_TEXT(_savef21) .globl C_TEXT(_savefpr_21) C_TEXT(_savef21): -C_TEXT(_savefpr_21): stfd fp21,-88(r1) +C_TEXT(_savefpr_21): +#ifndef __NO_FPRS__ + stfd fp21,-88(r1) +#endif cfi_offset(fp21,-88) .globl C_TEXT(_savef22) .globl C_TEXT(_savefpr_22) C_TEXT(_savef22): -C_TEXT(_savefpr_22): stfd fp22,-80(r1) +C_TEXT(_savefpr_22): +#ifndef __NO_FPRS__ + stfd fp22,-80(r1) +#endif cfi_offset(fp22,-80) .globl C_TEXT(_savef23) .globl C_TEXT(_savefpr_23) C_TEXT(_savef23): -C_TEXT(_savefpr_23): stfd fp23,-72(r1) +C_TEXT(_savefpr_23): +#ifndef __NO_FPRS__ + stfd fp23,-72(r1) +#endif cfi_offset(fp23,-72) .globl C_TEXT(_savef24) .globl C_TEXT(_savefpr_24) C_TEXT(_savef24): -C_TEXT(_savefpr_24): stfd fp24,-64(r1) +C_TEXT(_savefpr_24): +#ifndef __NO_FPRS__ + stfd fp24,-64(r1) +#endif cfi_offset(fp24,-64) .globl C_TEXT(_savef25) .globl C_TEXT(_savefpr_25) C_TEXT(_savef25): -C_TEXT(_savefpr_25): stfd fp25,-56(r1) +C_TEXT(_savefpr_25): +#ifndef __NO_FPRS__ + stfd fp25,-56(r1) +#endif cfi_offset(fp25,-56) .globl C_TEXT(_savef26) .globl C_TEXT(_savefpr_26) C_TEXT(_savef26): -C_TEXT(_savefpr_26): stfd fp26,-48(r1) +C_TEXT(_savefpr_26): +#ifndef __NO_FPRS__ + stfd fp26,-48(r1) +#endif cfi_offset(fp26,-48) .globl C_TEXT(_savef27) .globl C_TEXT(_savefpr_27) C_TEXT(_savef27): -C_TEXT(_savefpr_27): stfd fp27,-40(r1) +C_TEXT(_savefpr_27): +#ifndef __NO_FPRS__ + stfd fp27,-40(r1) +#endif cfi_offset(fp27,-40) .globl C_TEXT(_savef28) .globl C_TEXT(_savefpr_28) C_TEXT(_savef28): -C_TEXT(_savefpr_28): stfd fp28,-32(r1) +C_TEXT(_savefpr_28): +#ifndef __NO_FPRS__ + stfd fp28,-32(r1) +#endif cfi_offset(fp28,-32) .globl C_TEXT(_savef29) .globl C_TEXT(_savefpr_29) C_TEXT(_savef29): -C_TEXT(_savefpr_29): stfd fp29,-24(r1) #save f29 +C_TEXT(_savefpr_29): +#ifndef __NO_FPRS__ + stfd fp29,-24(r1) #save f29 stfd fp30,-16(r1) #save f30 stfd fp31,-8(r1) #save f31 +#endif cfi_offset(fp29,-24) cfi_offset(fp30,-16) cfi_offset(fp31,-8) Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/fprrest.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/fprrest.S 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/powerpc/powerpc32/fpu/fprrest.S 2014-11-10 14:30:05.164138881 +0100 @@ -25,70 +25,119 @@ .globl C_TEXT(_restf14) .globl C_TEXT(_restfpr_14) C_TEXT(_restf14): -C_TEXT(_restfpr_14): lfd fp14,-144(r1) +C_TEXT(_restfpr_14): +#ifndef __NO_FPRS__ + lfd fp14,-144(r1) +#endif .globl C_TEXT(_restf15) .globl C_TEXT(_restfpr_15) C_TEXT(_restf15): -C_TEXT(_restfpr_15): lfd fp15,-136(r1) +C_TEXT(_restfpr_15): +#ifndef __NO_FPRS__ + lfd fp15,-136(r1) +#endif .globl C_TEXT(_restf16) .globl C_TEXT(_restfpr_16) C_TEXT(_restf16): -C_TEXT(_restfpr_16): lfd fp16,-128(r1) +C_TEXT(_restfpr_16): +#ifndef __NO_FPRS__ + lfd fp16,-128(r1) +#endif .globl C_TEXT(_restf17) .globl C_TEXT(_restfpr_17) C_TEXT(_restf17): -C_TEXT(_restfpr_17): lfd fp17,-120(r1) +C_TEXT(_restfpr_17): +#ifndef __NO_FPRS__ + lfd fp17,-120(r1) +#endif .globl C_TEXT(_restf18) .globl C_TEXT(_restfpr_18) C_TEXT(_restf18): -C_TEXT(_restfpr_18): lfd fp18,-112(r1) +C_TEXT(_restfpr_18): +#ifndef __NO_FPRS__ + lfd fp18,-112(r1) +#endif .globl C_TEXT(_restf19) .globl C_TEXT(_restfpr_19) C_TEXT(_restf19): -C_TEXT(_restfpr_19): lfd fp19,-104(r1) +C_TEXT(_restfpr_19): +#ifndef __NO_FPRS__ + lfd fp19,-104(r1) +#endif .globl C_TEXT(_restf20) .globl C_TEXT(_restfpr_20) C_TEXT(_restf20): -C_TEXT(_restfpr_20): lfd fp20,-96(r1) +C_TEXT(_restfpr_20): +#ifndef __NO_FPRS__ + lfd fp20,-96(r1) +#endif .globl C_TEXT(_restf21) .globl C_TEXT(_restfpr_21) C_TEXT(_restf21): -C_TEXT(_restfpr_21): lfd fp21,-88(r1) +C_TEXT(_restfpr_21): +#ifndef __NO_FPRS__ + lfd fp21,-88(r1) +#endif .globl C_TEXT(_restf22) .globl C_TEXT(_restfpr_22) C_TEXT(_restf22): -C_TEXT(_restfpr_22): lfd fp22,-80(r1) +C_TEXT(_restfpr_22): +#ifndef __NO_FPRS__ + lfd fp22,-80(r1) +#endif .globl C_TEXT(_restf23) .globl C_TEXT(_restfpr_23) C_TEXT(_restf23): -C_TEXT(_restfpr_23): lfd fp23,-72(r1) +C_TEXT(_restfpr_23): +#ifndef __NO_FPRS__ + lfd fp23,-72(r1) +#endif .globl C_TEXT(_restf24) .globl C_TEXT(_restfpr_24) C_TEXT(_restf24): -C_TEXT(_restfpr_24): lfd fp24,-64(r1) +C_TEXT(_restfpr_24): +#ifndef __NO_FPRS__ + lfd fp24,-64(r1) +#endif .globl C_TEXT(_restf25) .globl C_TEXT(_restfpr_25) C_TEXT(_restf25): -C_TEXT(_restfpr_25): lfd fp25,-56(r1) +C_TEXT(_restfpr_25): +#ifndef __NO_FPRS__ + lfd fp25,-56(r1) +#endif .globl C_TEXT(_restf26) .globl C_TEXT(_restfpr_26) C_TEXT(_restf26): -C_TEXT(_restfpr_26): lfd fp26,-48(r1) +C_TEXT(_restfpr_26): +#ifndef __NO_FPRS__ + lfd fp26,-48(r1) +#endif .globl C_TEXT(_restf27) .globl C_TEXT(_restfpr_27) C_TEXT(_restf27): -C_TEXT(_restfpr_27): lfd fp27,-40(r1) +C_TEXT(_restfpr_27): +#ifndef __NO_FPRS__ + lfd fp27,-40(r1) +#endif .globl C_TEXT(_restf28) .globl C_TEXT(_restfpr_28) C_TEXT(_restf28): -C_TEXT(_restfpr_28): lfd fp28,-32(r1) +C_TEXT(_restfpr_28): +#ifndef __NO_FPRS__ + lfd fp28,-32(r1) +#endif .globl C_TEXT(_restf29) .globl C_TEXT(_restfpr_29) C_TEXT(_restf29): C_TEXT(_restfpr_29): lwz r0,8(r1) #get return address from frame +#ifndef __NO_FPRS__ lfd fp29,-24(r1) #restore f29 +#endif mtlr r0 #move return address to LR +#ifndef __NO_FPRS__ lfd fp30,-16(r1) #restore f30 lfd fp31,-8(r1) #restore f31 +#endif blr #return END (_restfpr_all) Index: glibc-2.19/sysdeps/powerpc/fpu/fenv_libc.h =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/fenv_libc.h 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/powerpc/fpu/fenv_libc.h 2014-11-10 14:30:05.164138881 +0100 @@ -32,11 +32,14 @@ /* Equivalent to fegetenv, but returns a fenv_t instead of taking a pointer. */ -#define fegetenv_register() \ +#define fegetenv_register() ({fenv_t env; /* fegetenv(&env);*/ env; }) +#if 0 ({ fenv_t env; asm volatile ("mffs %0" : "=f" (env)); env; }) +#endif /* Equivalent to fesetenv, but takes a fenv_t instead of a pointer. */ -#define fesetenv_register(env) \ +#define fesetenv_register(env) do { /*fesetenv(&env);*/ } while(0) +#if 0 do { \ double d = (env); \ if(GLRO(dl_hwcap) & PPC_FEATURE_HAS_DFP) \ @@ -47,6 +50,7 @@ else \ asm volatile ("mtfsf 0xff,%0" : : "f" (d)); \ } while(0) +#endif /* This very handy macro: - Sets the rounding mode to 'round to nearest'; Index: glibc-2.19/sysdeps/powerpc/fpu/math_private.h =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/math_private.h 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/powerpc/fpu/math_private.h 2014-11-10 14:30:05.164138881 +0100 @@ -25,11 +25,15 @@ #include <fenv_private.h> #include_next <math_private.h> +#ifdef __NO_FPRS__ +# define __CPU_HAS_FSQRT 0 +#else # if __WORDSIZE == 64 || defined _ARCH_PWR4 # define __CPU_HAS_FSQRT 1 # else # define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0) # endif +#endif extern double __slow_ieee754_sqrt (double); extern __always_inline double Index: glibc-2.19/sysdeps/powerpc/fpu/e_sqrt.c =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/e_sqrt.c 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/powerpc/fpu/e_sqrt.c 2014-11-10 14:30:05.164138881 +0100 @@ -150,7 +150,11 @@ feraiseexcept (FE_INVALID); x = a_nan.value; } +#ifdef __NO_FPRS__ + return x; +#else return f_wash (x); +#endif } #undef __ieee754_sqrt Index: glibc-2.19/sysdeps/powerpc/fpu/e_sqrtf.c =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/e_sqrtf.c 2014-11-10 14:30:05.192139074 +0100 +++ glibc-2.19/sysdeps/powerpc/fpu/e_sqrtf.c 2014-11-10 14:30:05.168138909 +0100 @@ -126,7 +126,11 @@ feraiseexcept (FE_INVALID); x = a_nan.value; } +#ifdef __NO_FPRS__ + return x; +#else return f_washf (x); +#endif } #undef __ieee754_sqrtf Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_ceil.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_ceil.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/* ceil function. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 - - .section ".text" -ENTRY (__ceil) - mffs fp11 /* Save current FPU rounding mode. */ -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnllr- cr7 - mtfsfi 7,2 /* Set rounding mode toward +inf. */ - ble- cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr - END (__ceil) - -weak_alias (__ceil, ceil) - -#ifdef NO_LONG_DOUBLE -weak_alias (__ceil, ceill) -strong_alias (__ceil, __ceill) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __ceil, ceill, GLIBC_2_0) -#endif Index: glibc-2.19/sysdeps/powerpc/fpu/s_fabs.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/s_fabs.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/* Floating-point absolute value. PowerPC version. - Copyright (C) 1997-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - -ENTRY(__fabs) -/* double [f1] fabs (double [f1] x); */ - fabs fp1,fp1 - blr -END(__fabs) - -weak_alias (__fabs,fabs) - -/* It turns out that it's safe to use this code even for single-precision. */ -strong_alias(__fabs,__fabsf) -weak_alias (__fabs,fabsf) - -#ifdef NO_LONG_DOUBLE -weak_alias (__fabs,__fabsl) -weak_alias (__fabs,fabsl) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_floor.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_floor.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/* Floor function. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 - - .section ".text" -ENTRY (__floor) - mffs fp11 /* Save current FPU rounding mode. */ -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnllr- cr7 - mtfsfi 7,3 /* Set rounding mode toward -inf. */ - ble- cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr - END (__floor) - -weak_alias (__floor, floor) - -#ifdef NO_LONG_DOUBLE -weak_alias (__floor, floorl) -strong_alias (__floor, __floorl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __floor, floorl, GLIBC_2_0) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_rint.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_rint.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/* Round to int floating-point values. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 - - .section ".text" -ENTRY (__rint) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnllr cr7 - bng cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = 0.0; */ -.L4: - bnllr cr6 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = -0.0; */ - END (__rint) - -weak_alias (__rint, rint) - -#ifdef NO_LONG_DOUBLE -weak_alias (__rint, rintl) -strong_alias (__rint, __rintl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __rint, rintl, GLIBC_2_0) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* float ceil function. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**23 */ - .long 0x4b000000 - - .section ".text" -ENTRY (__ceilf) - mffs fp11 /* Save current FPU rounding mode. */ -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnllr- cr7 - mtfsfi 7,2 /* Set rounding mode toward +inf. */ - ble- cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr - END (__ceilf) - -weak_alias (__ceilf, ceilf) - Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_fabsl.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_fabsl.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -/* Copy a sign bit between floating-point values. - IBM extended format long double version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - -ENTRY(__fabsl) -/* long double [f1,f2] fabs (long double [f1,f2] x); - fabs(x,y) returns a value with the magnitude of x and - with the sign bit of y. */ - fmr fp0,fp1 - fabs fp1,fp1 - fcmpu cr1,fp0,fp1 - beqlr cr1 - fneg fp2,fp2 - blr -END (__fabsl) - -long_double_symbol (libm, __fabsl, fabsl) Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_floorf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_floorf.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* float Floor function. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**23 */ - .long 0x4b000000 - - .section ".text" -ENTRY (__floorf) - mffs fp11 /* Save current FPU rounding mode. */ -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnllr- cr7 - mtfsfi 7,3 /* Set rounding mode toward -inf. */ - ble- cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr - END (__floorf) - -weak_alias (__floorf, floorf) - Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_isnan.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_isnan.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/* isnan(). PowerPC32 version. - Copyright (C) 2008-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - -/* int __isnan(x) */ - .machine power4 -EALIGN (__isnan, 4, 0) - mffs fp0 - mtfsb0 4*cr6+lt /* reset_fpscr_bit (FPSCR_VE) */ - fcmpu cr7,fp1,fp1 - mtfsf 255,fp0 - li r3,0 - beqlr+ cr7 /* (x == x) then not a NAN */ - li r3,1 /* else must be a NAN */ - blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -#ifndef __isnan -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) -#endif - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#ifndef IS_IN_libm -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif - Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_lrint.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_lrint.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* Round double to long int. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - -/* long int[r3] __lrint (double x[fp1]) */ -ENTRY (__lrint) - stwu r1,-16(r1) - fctiw fp13,fp1 - stfd fp13,8(r1) - nop /* Ensure the following load is in a different dispatch group */ - nop /* to avoid pipe stall on POWER4&5. */ - nop - lwz r3,8+LOWORD(r1) - addi r1,r1,16 - blr - END (__lrint) - -weak_alias (__lrint, lrint) - -strong_alias (__lrint, __lrintf) -weak_alias (__lrint, lrintf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__lrint, __lrintl) -weak_alias (__lrint, lrintl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __lrint, lrintl, GLIBC_2_1) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_lround.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_lround.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -/* lround function. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 0.5 */ - .long 0x3f000000 - .section ".text" - -/* long [r3] lround (float x [fp1]) - IEEE 1003.1 lround function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we can't use the PowerPC "round to Nearest" mode. Instead we set - "round toward Zero" mode and round by adding +-0.5 before rounding - to the integer value. It is necessary to detect when x is - (+-)0x1.fffffffffffffp-2 because adding +-0.5 in this case will - cause an erroneous shift, carry and round. We simply return 0 if - 0.5 > x > -0.5. */ - -ENTRY (__lround) - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp10,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp10,.LC0@l(r9) -#endif - fabs fp2, fp1 /* Get the absolute value of x. */ - fsub fp12,fp10,fp10 /* Compute 0.0. */ - fcmpu cr6, fp2, fp10 /* if |x| < 0.5 */ - fcmpu cr7, fp1, fp12 /* x is negative? x < 0.0 */ - blt- cr6,.Lretzero - fadd fp3,fp2,fp10 /* |x|+=0.5 bias to prepare to round. */ - bge cr7,.Lconvert /* x is positive so don't negate x. */ - fnabs fp3,fp3 /* -(|x|+=0.5) */ -.Lconvert: - fctiwz fp4,fp3 /* Convert to Integer word lround toward 0. */ - stfd fp4,8(r1) - nop /* Ensure the following load is in a different dispatch */ - nop /* group to avoid pipe stall on POWER4&5. */ - nop - lwz r3,8+LOWORD(r1) /* Load return as integer. */ -.Lout: - addi r1,r1,16 - blr -.Lretzero: /* when 0.5 > x > -0.5 */ - li r3,0 /* return 0. */ - b .Lout - END (__lround) - -weak_alias (__lround, lround) - -strong_alias (__lround, __lroundf) -weak_alias (__lround, lroundf) - -#ifdef NO_LONG_DOUBLE -weak_alias (__lround, lroundl) -strong_alias (__lround, __lroundl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __lround, lroundl, GLIBC_2_1) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/* Round to int floating-point values. PowerPC32 version. - Copyright (C) 2011-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Adhemerval Zanella <[email protected]>, 2011 - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include <sysdep.h> - - -/* float [fp1] nearbyintf(float [fp1] x) */ - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: - .long 0x4B000000 /* TWO23: 2**23 */ - - .section ".text" -ENTRY (__nearbyintf) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23 */ - bgelr cr7 - fcmpu cr7,fp1,fp12 /* if (x > 0.0 */ - ble cr7,L(lessthanzero) - mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ - fadds fp1,fp1,fp13 /* x += TWO23 */ - fsubs fp1,fp1,fp13 /* x -= TWO23 */ - fabs fp1,fp1 /* if (x == 0.0) */ - mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */ - blr -L(lessthanzero): - bgelr cr7 - mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ - fsubs fp1,fp1,fp13 /* x -= TWO23 */ - fadds fp1,fp1,fp13 /* x += TWO23 */ - fnabs fp1,fp1 /* if (x == 0.0) */ - mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */ - blr -END (__nearbyintf) - -weak_alias (__nearbyintf, nearbyintf) Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -/* Round to int floating-point values. PowerPC32 version. - Copyright (C) 2011-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Adhemerval Zanella <[email protected]>, 2011 - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - - -/* double [fp1] nearbyint(double [fp1] x) */ - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 /* TWO52: 2**52 */ - - .section ".text" -ENTRY (__nearbyint) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52 */ - bgelr cr7 - fcmpu cr7,fp1,fp12 /* if (x > 0.0 */ - ble cr7,L(lessthanzero) - mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ - fadd fp1,fp1,fp13 /* x += TWO52 */ - fsub fp1,fp1,fp13 /* x -= TWO52 */ - fabs fp1,fp1 /* if (x == 0.0 */ - mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */ - blr -L(lessthanzero): - bgelr cr7 - mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ - fsub fp1,fp1,fp13 /* x -= TWO52 */ - fadd fp1,fp1,fp13 /* x += TWO52 */ - fnabs fp1,fp1 /* if (x == 0.0) */ - mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */ - blr -END (__nearbyint) - -weak_alias (__nearbyint, nearbyint) - -#ifdef NO_LONG_DOUBLE -weak_alias (__nearbyint, nearbyintl) -strong_alias (__nearbyint, __nearbyintl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_1) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_rintf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_rintf.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* Round float to int floating-point values. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**23 */ - .long 0x4b000000 - - .section ".text" -ENTRY (__rintf) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnllr cr7 - bng cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = 0.0; */ -.L4: - bnllr cr6 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = -0.0; */ - END (__rintf) - -weak_alias (__rintf, rintf) - Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_roundf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_roundf.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -/* roundf function. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - - .section .rodata.cst8,"aM",@progbits,8 - .align 3 -.LC0: /* 2**23 */ - .long 0x4b000000 -.LC1: /* 0.5 */ - .long 0x3f000000 - -/* float [fp1] roundf (float x [fp1]) - IEEE 1003.1 round function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "Round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we can't use the PowerPC "Round to Nearest" mode. Instead we set - "Round toward Zero" mode and round by adding +-0.5 before rounding - to the integer value. */ - - .section ".text" -ENTRY (__roundf ) - mffs fp11 /* Save current FPU rounding mode. */ -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - addi r9,r9,.LC0-got_label@l - mtlr r11 - cfi_same_value (lr) - lfs fp13,0(r9) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnllr- cr7 - mtfsfi 7,1 /* Set rounding mode toward 0. */ -#ifdef SHARED - lfs fp10,.LC1-.LC0(r9) -#else - lfs fp10,.LC1@l(r9) -#endif - ble- cr6,.L4 - fadds fp1,fp1,fp10 /* x+= 0.5; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr -.L4: - fsubs fp9,fp1,fp10 /* x+= 0.5; */ - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp9,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr - END (__roundf) - -weak_alias (__roundf, roundf) - Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_round.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_round.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -/* round function. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - - .section .rodata.cst8,"aM",@progbits,8 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 -.LC1: /* 0.5 */ - .long 0x3f000000 - -/* double [fp1] round (double x [fp1]) - IEEE 1003.1 round function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "Round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we can't use the PowerPC "Round to Nearest" mode. Instead we set - "Round toward Zero" mode and round by adding +-0.5 before rounding - to the integer value. */ - - .section ".text" -ENTRY (__round) - mffs fp11 /* Save current FPU rounding mode. */ -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - addi r9,r9,.LC0-got_label@l - mtlr r11 - cfi_same_value (lr) - lfs fp13,0(r9) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnllr- cr7 - mtfsfi 7,1 /* Set rounding mode toward 0. */ -#ifdef SHARED - lfs fp10,.LC1-.LC0(r9) -#else - lis r9,.LC1@ha - lfs fp10,.LC1@l(r9) -#endif - ble- cr6,.L4 - fadd fp1,fp1,fp10 /* x+= 0.5; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr -.L4: - fsub fp9,fp1,fp10 /* x+= 0.5; */ - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp9,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr - END (__round) - -weak_alias (__round, round) - -#ifdef NO_LONG_DOUBLE -weak_alias (__round, roundl) -strong_alias (__round, __roundl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __round, roundl, GLIBC_2_1) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_truncf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_truncf.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/* truncf function. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**23 */ - .long 0x4b000000 - -/* float [fp1] truncf (float x [fp1]) - IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer - value, in floating format, nearest to but no larger in magnitude - then the argument." - We set "round toward Zero" mode and trunc by adding +-2**23 then - subtracting +-2**23. */ - - .section ".text" -ENTRY (__truncf) - mffs fp11 /* Save current FPU rounding mode. */ -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnllr- cr7 - mtfsfi 7,1 /* Set rounding toward 0 mode. */ - ble- cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr - END (__truncf) - -weak_alias (__truncf, truncf) - Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_trunc.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_trunc.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -/* trunc function. PowerPC32 version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <math_ldbl_opt.h> - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 - -/* double [fp1] trunc (double x [fp1]) - IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer - value, in floating format, nearest to but no larger in magnitude - then the argument." - We set "round toward Zero" mode and trunc by adding +-2**52 then - subtracting +-2**52. */ - - .section ".text" -ENTRY (__trunc) - mffs fp11 /* Save current FPU rounding mode. */ -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnllr- cr7 - mtfsfi 7,1 /* Set rounding toward 0 mode. */ - ble- cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0x01,fp11 /* restore previous rounding mode. */ - blr - END (__trunc) - -weak_alias (__trunc, trunc) - -#ifdef NO_LONG_DOUBLE -weak_alias (__trunc, truncl) -strong_alias (__trunc, __truncl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __trunc, truncl, GLIBC_2_1) -#endif Index: glibc-2.19/sysdeps/powerpc/fpu/s_fmax.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/s_fmax.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* Floating-point maximum. PowerPC version. - Copyright (C) 1997-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - -ENTRY(__fmax) -/* double [f1] fmax (double [f1] x, double [f2] y); */ - fcmpu cr0,fp1,fp2 - blt cr0,0f /* if x < y, neither x nor y can be NaN... */ - bnulr+ cr0 -/* x and y are unordered, so one of x or y must be a NaN... */ - fcmpu cr1,fp2,fp2 - bunlr cr1 -0: fmr fp1,fp2 - blr -END(__fmax) - -weak_alias (__fmax,fmax) - -/* It turns out that it's safe to use this code even for single-precision. */ -strong_alias(__fmax,__fmaxf) -weak_alias (__fmax,fmaxf) - -#ifdef NO_LONG_DOUBLE -weak_alias (__fmax,__fmaxl) -weak_alias (__fmax,fmaxl) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_fmax.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_fmax.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -#include <math_ldbl_opt.h> -#include <sysdeps/powerpc/fpu/s_fmax.S> -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1) -#endif Index: glibc-2.19/sysdeps/powerpc/fpu/s_fmin.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/s_fmin.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* Floating-point minimum. PowerPC version. - Copyright (C) 1997-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - -ENTRY(__fmin) -/* double [f1] fmin (double [f1] x, double [f2] y); */ - fcmpu cr0,fp1,fp2 - bgt cr0,0f /* if x > y, neither x nor y can be NaN... */ - bnulr+ cr0 -/* x and y are unordered, so one of x or y must be a NaN... */ - fcmpu cr1,fp2,fp2 - bunlr cr1 -0: fmr fp1,fp2 - blr -END(__fmin) - -weak_alias (__fmin,fmin) - -/* It turns out that it's safe to use this code even for single-precision. */ -strong_alias(__fmin,__fminf) -weak_alias (__fmin,fminf) - -#ifdef NO_LONG_DOUBLE -weak_alias (__fmin,__fminl) -weak_alias (__fmin,fminl) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_fmin.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_fmin.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -#include <math_ldbl_opt.h> -#include <sysdeps/powerpc/fpu/s_fmin.S> -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __fmin, fminl, GLIBC_2_1) -#endif Index: glibc-2.19/sysdeps/powerpc/fpu/s_fma.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/s_fma.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* Compute x * y + z as ternary operation. PowerPC version. - Copyright (C) 2010-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - -ENTRY(__fma) -/* double [f1] fma (double [f1] x, double [f2] y, double [f3] z); */ - fmadd fp1,fp1,fp2,fp3 - blr -END(__fma) - -weak_alias (__fma,fma) - -#ifdef NO_LONG_DOUBLE -weak_alias (__fma,__fmal) -weak_alias (__fma,fmal) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_fma.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_fma.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -#include <math_ldbl_opt.h> -#include <sysdeps/powerpc/fpu/s_fma.S> -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __fma, fmal, GLIBC_2_1) -#endif Index: glibc-2.19/sysdeps/powerpc/fpu/s_fmaf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/s_fmaf.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -/* Compute x * y + z as ternary operation. PowerPC version. - Copyright (C) 2010-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> - -ENTRY(__fmaf) -/* float [f1] fmaf (float [f1] x, float [f2] y, float [f3] z); */ - fmadds fp1,fp1,fp2,fp3 - blr -END(__fmaf) - -weak_alias (__fmaf,fmaf) Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_copysignf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_copysignf.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -/* __copysignf is in s_copysign.S */ Index: glibc-2.19/sysdeps/powerpc/fpu/s_lrintf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/s_lrintf.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -/* __lrintf is in s_lrint.c */ Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_fabs.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_fabs.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -#include <math_ldbl_opt.h> -#include <sysdeps/powerpc/fpu/s_fabs.S> -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __fabs, fabsl, GLIBC_2_0) -#endif Index: glibc-2.19/sysdeps/powerpc/powerpc32/fpu/s_lroundf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/powerpc32/fpu/s_lroundf.S 2014-11-10 14:30:05.192139074 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -/* __lroundf is in s_lround.S */ Index: glibc-2.19/sysdeps/powerpc/fpu/s_fabsf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/s_fabsf.S 2014-02-07 10:04:38.000000000 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -/* __fabsf is in s_fabs.S */ Index: glibc-2.19/sysdeps/powerpc/fpu/s_fmaxf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/s_fmaxf.S 2014-02-07 10:04:38.000000000 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -/* __fmaxf is in s_fmax.c */ Index: glibc-2.19/sysdeps/powerpc/fpu/s_fminf.S =================================================================== --- glibc-2.19.orig/sysdeps/powerpc/fpu/s_fminf.S 2014-02-07 10:04:38.000000000 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -/* __fminf is in s_fmin.c */

