This is the mail archive of the 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]
Other format: [Raw text]

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.

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