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

Support Java behaviour w.r.t fmin/fmax/dmin/dmax on Z #20716

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

Conversation

matthewhall2
Copy link
Contributor

@matthewhall2 matthewhall2 commented Nov 29, 2024

  • Enables inlining of Math.max/Math.min functions for floats and doubles
  • Implements Java standard
    • +0 compares as strictly greater than -0
    • if the first arg is a NaN, returns the NaN unchanged. If only the second arg is a NaN, returns that NaN unchanged

Uses SIMD instructions for floats on z14+, and for doubles on z13+ (fixes errors on z13 machines that were seen after #20530).

https://github.ibm.com/runtimes/openj9-jit-z/issues/935#issuecomment-98667018

depends on eclipse-omr/omr#7572

- Adds java_lang_Math_max/min for float/double as a recognized method
- Adds a SupportsInlineMath_MaxMin_FD flag to the Z code generator
- Flag is only set in Z if the TR_disableInlineMath_MaxMin_FD
  environment variable is not set
- If the flag is set, call nodes are transformed to a functionally
  equivalent tree that uses fmin/fmax/dmin/dmax nodes

Signed-off-by: Matthew Hall <[email protected]>
- use new omr min/max helper
- +0.0 compares as strictly greater than -0.0
- returns first NaN unchanged if present

Signed-off-by: Matthew Hall <[email protected]>
- tests float corner cases with +/-0
- NaN cases
- confirms respective OMR changes

Signed-off-by: Matthew Hall <[email protected]>
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.

1 participant