This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] h8300: Fix the failure of fixuns-trunc-1.c.
- From: Joern Rennecke <joern dot rennecke at superh dot com>
- To: kazu at cs dot umass dot edu (Kazu Hirata)
- Cc: gcc-patches at gcc dot gnu dot org, joern dot rennecke at superh dot com
- Date: Mon, 1 Mar 2004 14:01:52 +0000 (GMT)
- Subject: Re: [patch] h8300: Fix the failure of fixuns-trunc-1.c.
> Hi,
>
> Attached is a patch to fix the failure of fixuns-trunc-1.c.
>
> Upon investigation, I found that the hand-coded fixunssfsi for the
> plain H8/300 is wrong. If the exponent field is greater than or equal
> to (127 + 15), the function does either return -1 or the mantissa
> left-shifted by 8 bits. Well, for thins range of exponents, there
> should be other left-shift counts.
>
> The patch removes the hand-coded version and fall back to the C
> implementation in h8300/fixunssfsi.c.
>
> Tested on h8300-elf. Committed to both 3.4 and mainline.
Have you actually tested this on h8/300 hardware? I remember that there
were lots of problems with the code not fitting into the memory space.
> - cmp.b #0x47,r0h
This should just be #0x4f.
You see, we have basically three cases:
- the number is in the range 0..(1<<31)-1: we can use the signed conversion
function ___fixsfsi.
- the number is in the range 1<<31..(1LL<<32)-1: we can do the conversion by
setting the LSB of the exponent and shifting the exponent / mantissa
left by eight.
- the number is 1LL<<32 or larger, or negative: we return UINT_MAX.