summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc32
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc/powerpc32')
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_copysignl.S23
1 files changed, 20 insertions, 3 deletions
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S b/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
index aed783ad59..1eec8474ed 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
@@ -24,22 +24,39 @@ 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.  */
+#ifdef _ARCH_PPCGR
+	/* fsel available.  */
 	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	fp3,fp2
+	fsel	fp2,fp0,fp2,fp3
+	bgelr	cr6
+	fneg	fp1,fp1
 	fneg	fp2,fp2
-L(0):	bgelr	cr6
+	blr
+#else
+	stwu	r1,-32(r1)
+	cfi_adjust_cfa_offset (32)
+	stfd	fp3,8(r1)
+	stfd	fp1,16(r1)
+	lwz	r3,8+HIWORD(r1)
+	lwz	r4,16+HIWORD(r1)
+	xor	r3,r3,r4
+	cmpwi	cr6,r3,0
+	addi	r1,r1,32
+	cfi_adjust_cfa_offset (-32)
+	bgelr	cr6
 	fneg	fp1,fp1
 	fneg	fp2,fp2
 	blr
+#endif
 END (__copysignl)
 
 #if IS_IN (libm)