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

Simplify softfloat interface #289

Closed
wants to merge 2 commits into from
Closed

Commits on Aug 5, 2023

  1. Simplify softfloat interface

    Currently the softfloat interface relies on two global registers defined in Sail to return values, one of which is a mirror of `fflags`. Unfortunately this doesn't work if the model is compiled with `-static` or wrapped in an anonymous namespace (I am doing the latter in a similar way to [@arichardson's method here](https://github.com/CTSRD-CHERI/cheri-compressed-cap/blob/89d21384c0183e5c422e23e1e5b37e127ad14e96/test/sail_wrapper_common.c#L50)).
    
    This commit changes the design so that there is only a one-way dependency - the softfloat implementation does not depend on the model. This is done by returning the result of the floating point operation as a normal function return value, and then the model retrieves the new flags by simply calling another platform function (`extern_float_flags()`).
    
    This is a bit cleaner, works with `-static` and also removes the need for `write_fflags()` and `update_softfloat_fflags()`.
    
    Tested with `run_fp_tests.sh` - all 82 tests pass.
    
    This commit only applies the changes to f16add/sub/mul/div to make review easier.
    Timmmm committed Aug 5, 2023
    Configuration menu
    Copy the full SHA
    e6b6012 View commit details
    Browse the repository at this point in the history
  2. Apply softfloat simplification to remaining methods

    Copy/paste the changes in the previous commit to all softfloat methods.
    Timmmm committed Aug 5, 2023
    Configuration menu
    Copy the full SHA
    979d6f2 View commit details
    Browse the repository at this point in the history