[patch] h8300: Fix the failure of fixuns-trunc-1.c.

Kazu Hirata kazu@cs.umass.edu
Fri Mar 19 08:14:00 GMT 2004


Hi Joern,

> Have you actually tested this on h8/300 hardware?

No, only with the GDB simulator.

> > -	cmp.b #0x47,r0h
> 
> This should just be #0x4f.

Fixes thus.

Tested on h8300-elf.  Committed to both 3.4 and mainline.

Kazu Hirata

2004-03-02  Kazu Hirata  <kazu@cs.umass.edu>

	* config/h8300/lib1funcs.asm (___fixunssfsi): Change the
	threshold to 0x4f.

	Revert:
	2004-02-27  Kazu Hirata  <kazu@cs.umass.edu>
	* config/h8300/fixunssfsi.c (__fixunssfsi): Enable on H8/300
	as well.
	* config/h8300/lib1funcs.asm (___fixunssfsi): Remove.
	* config/h8300/t-h8300 (LIB1ASMFUNCS): Remove _fixunssfsi_asm.

Index: fixunssfsi.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/fixunssfsi.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- fixunssfsi.c	27 Feb 2004 23:20:48 -0000	1.6
+++ fixunssfsi.c	23 Oct 2003 19:30:47 -0000	1.5
@@ -29,8 +29,10 @@
 Boston, MA 02111-1307, USA.  */
 
 /* The libgcc2.c implementation gets confused by our type setup and creates
-   a directly recursive call, so we do our own implementation.  */
+   a directly recursive call, so we do our own implementation.  For
+   the H8/300, that's in lib1funcs.asm, for H8/300H and H8S, it's here.  */
 
+#ifndef __H8300__
 long __fixunssfsi (float a);
 
 long
@@ -40,3 +42,4 @@
     return (long) (a - 32768L) + 32768L;
   return (long) a;
 }
+#endif
Index: lib1funcs.asm
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/lib1funcs.asm,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- lib1funcs.asm	27 Feb 2004 23:20:48 -0000	1.34
+++ lib1funcs.asm	25 Jan 2004 17:51:51 -0000	1.33
@@ -806,3 +806,31 @@
 
 #endif
 #endif /* L_mulsi3 */
+#ifdef L_fixunssfsi_asm
+/* For the h8300 we use asm to save some bytes, to
+   allow more programs to fit into the tiny address
+   space.  For the H8/300H and H8S, the C version is good enough.  */
+#ifdef __H8300__
+/* We still treat NANs different than libgcc2.c, but then, the
+   behavior is undefined anyways.  */
+	.global	___fixunssfsi
+___fixunssfsi:
+	cmp.b #0x4f,r0h
+	bge Large_num
+	jmp     @___fixsfsi
+Large_num:
+	bhi L_huge_num
+	xor.b #0x80,A0L
+	bmi L_shift8
+L_huge_num:
+	mov.w #65535,A0
+	mov.w A0,A1
+	rts
+L_shift8:
+	mov.b A0L,A0H
+	mov.b A1H,A0L
+	mov.b A1L,A1H
+	mov.b #0,A1L
+	rts
+#endif
+#endif /* L_fixunssfsi_asm */
Index: t-h8300
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/t-h8300,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- t-h8300	27 Feb 2004 23:20:48 -0000	1.15
+++ t-h8300	12 Nov 2003 02:03:58 -0000	1.14
@@ -1,5 +1,6 @@
 LIB1ASMSRC = h8300/lib1funcs.asm
-LIB1ASMFUNCS = _cmpsi2 _ucmpsi2 _divhi3 _divsi3 _mulhi3 _mulsi3
+LIB1ASMFUNCS = _cmpsi2 _ucmpsi2 _divhi3 _divsi3 _mulhi3 _mulsi3 \
+  _fixunssfsi_asm
 
 LIB2FUNCS_EXTRA = \
 	$(srcdir)/config/h8300/clzhi2.c \



More information about the Gcc-patches mailing list