-
Notifications
You must be signed in to change notification settings - Fork 397
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
Define fmax/fmin/dmax/dmin opcode specifications #7293
Comments
In my opinion, the default semantics of the OMR IL opcodes should be as broadly applicable to other language environments as possible. In this particular case, I'd say IEEE 754 semantics fits the bill. Variations in the IL opcode semantics in different language environments can be handled with frontend queries during operations such as constant folding, simplification, or code generation to do the right thing based on the requirements of a particular language. The frontend queries in OMR will answer all the questions as if it were following IEEE 754 semantics, and Java would potentially provide different answers. |
@r30shah @0xdaryl @hzongaro While testing this PR for this issue I came across a bug in As for the NaNs, the current simplifier works for the Java spec (folds to the first arg, unchanged, if it's a NaN, or the second arg, unchanged, if only the second arg is a NaN), but this does not comply with IEEE-754. An OpenJ9 specific fmax/dmax/fmin/dmin simplifier is needed to get OMR up to the IEEE-754 standard. Current simplifier for reference:
|
@matthewhall2 As a first step to that, can we fix the OMRSimplifier to treat +0 and -0 correctly, this will allow you to get your J9 Tests to finish. For OMR side fix, eventually we need to fix NAN case in the OMR simplifier and extend the function in OpenJ9 that behaves as Java specification. |
I wanted to start a discussion around fmax/min and dmax/min IL Opcodes in OMR [1][2]. While working on one accelerating performance of sequence we would generate for code in OpenJ9 where we could leverage such opcodes, we did run into questions involving the specifications for such opcode. Especially how would we handle special cases where operand are signed zero or NaN values. [3]. OMR do not formally define specification for such opcode.
Should we follow IEEE-754 standard for these operations to standardize how to treat NaN / signed Zero? One concern with that would be the difference in how Java treats max / min operations and treats NaN value.
[1]. https://github.com/eclipse/omr/blob/6c6d6383ccd93937d1987de8e818a0a63118b01e/compiler/il/OMROpcodes.enum#L7944-L7975
[2]. https://github.com/eclipse/omr/blob/6c6d6383ccd93937d1987de8e818a0a63118b01e/compiler/il/OMROpcodes.enum#L8040-L8071
[3]. #7266 (comment)
The text was updated successfully, but these errors were encountered: