dsub: L1A/L1B PARTIAL (FPU OK, SSE bug), L2 FAIL#551
Open
opencode-agent[bot] wants to merge 1 commit into
Open
dsub: L1A/L1B PARTIAL (FPU OK, SSE bug), L2 FAIL#551opencode-agent[bot] wants to merge 1 commit into
opencode-agent[bot] wants to merge 1 commit into
Conversation
Co-authored-by: LSantha <LSantha@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec compliance report
l1a Implementation
core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java:1571(visit_dsub)core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompilerFPU.java:465(FPUsub)core/src/core/org/jnode/vm/x86/compiler/l1a/FPCompilerSSE.java:83(SSEsub) andarithOperation:102FSUBP(value1 - value2), pushes result. Handles constant folding correctly (fpv1 - fpv2).FPCompilerSSE.java:102. ThearithOperationmethod is shared byaddandsub. For constant folding it computesfpv1 + fpv2regardless of operation. Whensub(JvmType.DOUBLE)callsarithOperation(type, X86Operation.SSE_SUB, false), the SSE instruction emitted is correct (SUBSD), but constant folding produces the wrong result (addition instead of subtraction).l1b Implementation
core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java:1816(visit_dsub)FPCompilerhierarchy as L1A (defaults toFPCompilerFPUat line 300)l2 Implementation
core/src/core/org/jnode/vm/x86/compiler/l2/L2ByteCodeSupportChecker.java:330—visit_dsub()callsnotSupported(), throwingUnsupportedOperationExceptioncore/src/core/org/jnode/vm/x86/compiler/l2/GenericX86CodeGenerator.java:865,1033,1211,1426,1616,1772,1995,2157,2334,2496,2638,2812,2971,3130,3354,3541— EverygenerateBinaryOPoverload has acase DSUB:that throwsIllegalArgumentException("Unknown operation: " + operation)core/src/core/org/jnode/vm/x86/compiler/l2/FPX86CodeGenerator.java— Only handles compare operations (FCMPG,FCMPL,DCMPG,DCMPL); no arithmetic operationscore/src/core/org/jnode/vm/x86/compiler/l2/X86CodeGenerator.java— Thin wrapper, no overridesdsub. Any method containingdsubwill fail L2 compilation and fall back to L1.JVM Spec Reference (dsub)
..., value1, value2 → ..., resultresult = value1 - value2(bothdouble, IEEE 754 arithmetic)Summary
dsubwith constant operands when SSE is enabled.dsubcannot be compiled by L2.Closes #253
opencode session | github run