[patch] fix wrong result in ARM __muldf3 code

Nicolas Pitre nico@cam.org
Tue Mar 2 19:26:00 GMT 2004

Current __muldf3 and __divdf3 on ARM will return wrong values for small 
negative denormalized values.

For example: 1.112537e-308 * -3.637979e-12
Current result: -8.293093e-317
Expected result: -4.047386e-320

The patch below fixes that problem and should be applied to both mainline 
and 3.4 branch since this clearly is a regression bug.

<date>  Nicolas Pitre <nico@cam.org>

	* config/arm/ieee754-df.S (muldf3, divdf3): Fix denormalization of
	small negative values.

Index: config/arm/ieee754-df.S
RCS file: /cvs/gcc/gcc/gcc/config/arm/ieee754-df.S,v
retrieving revision 1.4
diff -u -r1.4 ieee754-df.S
--- config/arm/ieee754-df.S	15 Jan 2004 16:56:34 -0000	1.4
+++ config/arm/ieee754-df.S	2 Mar 2004 19:00:40 -0000
@@ -659,8 +659,8 @@
 	orr	r3, r3, xh, lsl r5
 	mov	xl, xh, lsr r4
 	bic	xh, xh, #0x7fffffff
-	adds	xl, xl, r3, lsr #31
-	adc	xh, xh, #0
+	bic	xl, xl, xh, lsr r4
+	add	xl, xl, r3, lsr #31
 	orrs	r6, r6, lr
 	teqeq	r3, #0x80000000
 	biceq	xl, xl, #1

More information about the Gcc-patches mailing list