Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libgcc/m68k: Fixes for soft float #93

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

keith-packard
Copy link
Contributor

Check for non-zero denorm in __adddf3. Need to check both the upper and lower 32-bit chunks of a 64-bit float for a non-zero value when checking to see if the value is -0.

Fix __addsf3 when the sum exponent is exactly 0xff to ensure that produces infinity and not nan.

Handle converting NaN/inf values between formats.

Handle underflow and overflow when truncating.

Write a replacement for __fixxfsi so that it does not raise extra exceptions during an extra conversion from long double to double.

@keith-packard keith-packard force-pushed the m68k-soft-float branch 3 times, most recently from 7bab964 to 3393fcc Compare August 23, 2023 20:36
@MLopez-Ibanez
Copy link

This is a read-only mirror that is not managed by GCC developers.

Pull requests in this read-only mirror will be ignored forever.

If you wish to contribute to GCC please read: https://gcc.gnu.org/wiki/GettingStarted

Just like i386, you cannot extract float or double values by using
the low bits of m68k float registers. Override this hook and check
that case.

Signed-off-by: Keith Packard <keithp@keithp.com>
Fix __extenddfxf2:

  * Remove bogus denorm handling block which would never execute --
    the converted exp value is always positive as EXCESSX > EXCESSD.

  * Compute the whole significand in dl instead of doing part of it in
    ldl.

    * Mask off exponent from dl.l.upper so the denorm shift test
      works.

    * Insert the hidden one bit into dl.l.upper as needed.

Fix __truncxfdf2 denorm handling. All that is required is to shift the
significand right by the correct amount; it already has all of the
necessary bits set including the explicit one. Compute the shift
amount, then perform the wide shift across both elements of the
significand.

Fix __fixxfsi:

  * The value  was off by a factor of two as the significand contains
    32 bits, not 31 so we need to shift by one more than the equivalent
    code in __fixdfsi.

  * Simplify the code having realized that the lower 32 bits of the
    significand can never appear in the results.

Return positive qNaN instead of negative. For floats, qNaN is 0x7fff_ffff. For
doubles, qNaN is 0x7fff_ffff_ffff_ffff.

Return correctly signed zero on float and double divide underflow. This means
that Ld$underflow now expects d7 to contain the sign bit, just like the other
return paths.

Signed-off-by: Keith Packard <keithp@keithp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants