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

Deduplicate some floating point code #448

Closed
wants to merge 6 commits into from

Commits on Apr 4, 2024

  1. Simplify canonical NaN and NaN boxing functions

    This is the first step of making the float code generic over the float size. There are no functional changes, it just removes code duplication.
    Timmmm committed Apr 4, 2024
    Configuration menu
    Copy the full SHA
    d5cd2a6 View commit details
    Browse the repository at this point in the history
  2. Replace bits(5) with regidx in float reg code

    Using this alias makes things a bit clearer.
    Timmmm committed Apr 4, 2024
    Configuration menu
    Copy the full SHA
    44d8864 View commit details
    Browse the repository at this point in the history
  3. Simplify boxed float register access functions

    This replaces the separate functions to read/write the floating point registers as smaller widths (which boxes/unboxes them) with single generic functions.
    
    Note in some cases we still need to explicitly pass the width in so it might seem like there is no benefit, but those will be removed once the code is fully generic.
    Timmmm committed Apr 4, 2024
    Configuration menu
    Copy the full SHA
    8133f43 View commit details
    Browse the repository at this point in the history
  4. Use generic versions of some float utility functions

    Make `fsplit`/`fmake`, `f_is_...` and `f_negate` generic over the float size. The vector code actually already used functions like this.
    
    This reduces a lot of copy/pasted code and will allow even more of the code to be deduplicated later.
    Timmmm committed Apr 4, 2024
    Configuration menu
    Copy the full SHA
    38fc8ac View commit details
    Browse the repository at this point in the history
  5. Simplify float by making le/lt/eq functions generic

    I'm not sure of the exact history here but only the le function is actually used. I left the other two in for reference.
    
    I also changed the flags from functions to global constants, since that's what they are.
    Timmmm committed Apr 4, 2024
    Configuration menu
    Copy the full SHA
    eb681d3 View commit details
    Browse the repository at this point in the history
  6. Simplify float by making F_or_X accessors generic

    Similar to the `F_box` accessor, these can be generic. They just need a special case for xlen == 32 when reading/writing 64-bit floats which are split over two registers when using Zfinx.
    Timmmm committed Apr 4, 2024
    Configuration menu
    Copy the full SHA
    cf7553b View commit details
    Browse the repository at this point in the history