This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] Fix float-unsigned long conversion on h8300


Hi,

Attached is a patch to fix conversion from float to unsigned long on
the h8300 port.

Without the patch, due to the -DDI=SI thing in t-h8300, a wrong
function, namely __fixunssfDI in libgcc2.c, is used as __fixunssfsi.

Really we should use __fixunssfsi, so I extracted and compiled it.
Then I put it in config/h8300/lib1funcs.asm and added the function
name to LIB1ASMFUNCS in t-h8300.

With the patch, execute/980605-1.c and execute/gofast.c pass.

Tested on the branch.  Testing on the mainline right now.  OK to apply
if the testing goes well?

p.s.
If you could, please review

http://gcc.gnu.org/ml/gcc-patches/2001-07/msg01199.html

Thanks,

Kazu Hirata

Index: lib1funcs.asm
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/lib1funcs.asm,v
retrieving revision 1.6
diff -u -r1.6 lib1funcs.asm
--- lib1funcs.asm	2001/05/17 03:15:54	1.6
+++ lib1funcs.asm	2001/07/22 17:11:58
@@ -764,3 +764,84 @@
 
 #endif
 #endif /* L_mulsi3 */
+
+#ifdef L_fixunssfsi
+	.section .rodata
+	.align 1
+.LC0:
+	.float 3.27680000000000000000e4
+	.align 1
+.LC1:
+	.float -3.27680000000000000000e4
+
+#ifdef __H8300__
+	.section .text
+	.align 1
+	.global ___fixunssfsi
+___fixunssfsi:
+	push	r4
+	push	r5
+	mov.w	r1,r5
+	mov.w	r0,r4
+	mov.w	@.LC0,r2
+	mov.w	@.LC0+2,r3
+	mov.w	r3,@-r7
+	mov.w	r2,@-r7
+	jsr	@___gesf2
+	adds	#2,r7
+	adds	#2,r7
+	mov.w	r0,r0
+	blt	.L2
+	mov.w	@.LC1,r2
+	mov.w	@.LC1+2,r3
+	mov.w	r3,@-r7
+	mov.w	r2,@-r7
+	mov.w	r4,r0
+	mov.w	r5,r1
+	jsr	@___addsf3
+	adds	#2,r7
+	adds	#2,r7
+	jsr	@___fixsfsi
+	mov.w	r1,r2
+	add.b	#0,r2l
+	addx	#128,r2h
+	bra	.L5
+.L2:
+	mov.w	r4,r0
+	mov.w	r5,r1
+	jsr	@___fixsfsi
+	mov.w	r1,r2
+.L5:
+	mov.w	r2,r1
+	bld	#7,r1h
+	subx	r0l,r0l
+	subx	r0h,r0h
+	pop	r5
+	pop	r4
+	rts
+#else
+	.section .text
+	.align 1
+	.global ___fixunssfsi
+___fixunssfsi:
+	push.l	er4
+	mov.l	er0,er4
+	mov.l	@.LC0,er1
+	jsr	@___gesf2
+	mov.l	er0,er0
+	blt	.L2
+	mov.l	@.LC1,er1
+	mov.l	er4,er0
+	jsr	@___addsf3
+	jsr	@___fixsfsi
+	add.w	#32768,r0
+	bra	.L5
+.L2:
+	mov.l	er4,er0
+	jsr	@___fixsfsi
+.L5:
+	exts.l	er0
+	pop.l	er4
+	rts
+#endif
+#endif
Index: t-h8300
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/t-h8300,v
retrieving revision 1.7
diff -u -r1.7 t-h8300
--- t-h8300	2001/07/09 22:05:44	1.7
+++ t-h8300	2001/07/22 17:11:58
@@ -1,6 +1,6 @@
 LIB1ASMSRC = h8300/lib1funcs.asm
 LIB1ASMFUNCS = _cmpsi2 _ucmpsi2 _divhi3 _divsi3 _mulhi3 _mulsi3 \
-  _floatdisf _fixsfdi
+  _fixunssfsi _floatdisf _fixsfdi
 
 # We do not have DF or DI types, so fake out the libgcc2 compilation.
 TARGET_LIBGCC2_CFLAGS = -DDF=SF -DDI=SI


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]